:root {
    --theme-color: #7f7f7f; /* The new default grey color */
    --theme-color-hover: #999999; /* A slightly lighter shade for hover effects */
}

body {
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    font-family: 'Roboto Mono', monospace;
}

.notebook-container {
    width: 850px;
    height: 470px; 
    background-color: #fff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    position: relative;
    border-radius: 10px; 
    /* Removed overflow: hidden; here so buttons can sit outside the container boundaries without being clipped */
}

#notebook-cover {
    width: 40px;
    background-color: var(--theme-color); /* Uses theme color */
    color: white;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    overflow: hidden; /* Added here instead to contain cover text */
    cursor: pointer;
}

.cover-text {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    margin: 10px 0;
    white-space: nowrap;
    outline: none;
    cursor: text;
}
#subject-title { font-family: 'Permanent Marker', cursive; font-size: 1.5rem; font-weight: bold; }
.notebook-cover p { font-size: 0.8rem; }

.notebook-pages {
    display: flex;
    flex: 1;
    margin-left: 40px;
}

.page {
    flex: 1;
    padding: 20px;
    background-color: #fafafa;
    border-right: 1px solid #ddd;
    box-sizing: border-box;
    position: relative; /* Needed to position the absolute page numbers */
}
.page:last-child { 
    border-right: none; 
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    overflow: hidden; /* Added here instead to contain page text */
}

textarea.lined-paper {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    background-color: transparent;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5rem; /* The height of the lines (24px) */
    padding: 0;
    box-sizing: border-box;
    background-image: linear-gradient(to bottom, transparent 1.4rem, #c0c0c0 1.4rem);
    background-size: 100% 1.5rem; /* Line height */
    outline: none;
    color: #333;
    overflow: auto; /* SCROLLING ENABLED */
    text-overflow: clip; 
    white-space: pre-wrap;
    word-wrap: break-word;
    direction: ltr; 
}

.left-page textarea {
    padding-left: 30px;
    /* CHANGED: Uses var(--theme-color) for the margin line */
    background-image: linear-gradient(to bottom, transparent 1.4rem, #c0c0c0 1.4rem), 
                      linear-gradient(to right, var(--theme-color) 2px, transparent 2px);
    background-size: 100% 1.5rem, 30px 100%;
    background-repeat: repeat-y, no-repeat;
}

/* Page Number Styles */
.page-number {
    position: absolute;
    bottom: 5px;
    right: 10px;
    font-size: 0.8rem;
    color: #999;
}

/* Styles for the navigation buttons */
.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background-color: var(--theme-color); /* Uses theme color */
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    user-select: none;
    opacity: 0.8;
    transition: opacity 0.3s, background-color 0.3s;
    z-index: 100;
}

.nav-button:hover {
    opacity: 1;
    background-color: var(--theme-color-hover); /* Uses hover theme color */
}

#nav-left { left: -40px; }
#nav-right { right: -40px; }

.nav-button.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background-color: var(--theme-color);
}

.notebook-cover #subject-title.flash {
    background-color: #ffe5e5;
}