/* Responsive Structural Resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
}
:root {
    --bg-body: #e4e9ed;
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #ccd1d9;
    --paper-color: #fdfcf7;
    --paper-lines: #e8f1f5;
    --shadow: rgba(0, 0, 0, 0.1);
}
/* NEW DARK THEME OVERRIDES MAP */
[data-theme="dark"] {
    --bg-body: #1a252f;
    --bg-card: #2c3e50;
    --text-main: #f5f7fa;
    --text-muted: #bdc3c7;
    --border-color: #4f5d75;
    --paper-color: #232d37;
    --paper-lines: #2c3a47;
    --shadow: rgba(0, 0, 0, 0.4);
}

body {
    background-color: var(--bg-body);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 10px;
    width: 100vw;
    overflow-x: hidden;
}

.hidden { display: none !important; }
.font-handwriting {
    font-family: 'Caveat', cursive;
    font-size: 18px !important; /* Slightly enlarged to fit the row spacing */
    line-height: 28px !important; /* Matches background-size height exactly */
    padding-top: 14px !important; /* Shifts the first line down to rest on the blue line */
}

.font-typewriter {
    font-family: 'Courier Prime', monospace;
    font-size: 15px !important;
    line-height: 28px !important; /* Matches background-size height exactly */
    padding-top: 17px !important; /* Shifts the first line down to rest on the blue line */
}
.note-body {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    resize: none;
    font-size: 15px;
    line-height: 28px; /* Matches the background-size height exactly */
    color: #2c3e50;
    width: 100%;
    padding-top: 18px; /* Shifts the starting point down to sit precisely on the first line */
}
/* Transitions & Animations */
.animate-fade {
    animation: fadeIn 0.3s ease-in-out forwards;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-turn-next { animation: turnNext 0.4s ease-in-out; }
.page-turn-prev { animation: turnPrev 0.4s ease-in-out; }

@keyframes turnNext {
    0% { transform: rotateY(0deg); transform-origin: left; opacity: 1; }
    50% { transform: rotateY(-90deg); opacity: 0.5; background: #e0ded7; }
    100% { transform: rotateY(0deg); opacity: 1; }
}

@keyframes turnPrev {
    0% { transform: rotateY(0deg); transform-origin: left; opacity: 1; }
    50% { transform: rotateY(30deg); opacity: 0.5; background: #e0ded7; }
    100% { transform: rotateY(0deg); opacity: 1; }
}

/* Dashboard Layout styles */
.dashboard {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 15px;
}
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dashboard h2 {
    text-align: center;
    color: var(--text-main);
    font-size: 24px;
}
.theme-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-size: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px var(--shadow);
    transition: transform 0.2s;
}
.theme-toggle-btn:hover { transform: scale(1.05); }

.creator-box {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px var(--shadow);
}

.color-picker-wrapper { margin-bottom: 15px; }
.color-picker-wrapper label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.color-options { display: flex; gap: 12px; }

.color-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s;
    border: 2px solid transparent;
}
.color-dot:hover { transform: scale(1.1); }
.color-dot.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--text-main);
    transform: scale(1.1);
}

.add-btn {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: bold;
    background-color: var(--accent-color);
    color: gray;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
    transition: background-color 0.15s;
}
.add-btn:hover { background-color: #27ae60; }

.saved-section h3 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* NEW ELEMENT: Live Search Bar Layout styling */
.search-input {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    margin-bottom: 15px;
    background-color: var(--bg-card);
    transition: border-color 0.2s;
}
.search-input:focus {
    border-color: var(--accent-color);
}

.notebooks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 40vh;
    overflow-y: auto;
}

/* Dashboard List Items */
.notebook-item {
    background: var(--bg-card);
    padding: 14px 18px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px var(--shadow);
    transition: background 0.2s, transform 0.2s;
}
.notebook-item:hover { background: #f8f9fa; transform: translateX(2px); }
.notebook-item .info-side { display: flex; flex-direction: column; gap: 4px; }
.notebook-item .title { font-weight: bold; color: var(--text-main); }
.notebook-item .page-count { font-size: 12px; color: var(--text-muted); }

.delete-btn {
    background: none;
    border: none;
    color: var(--text-danger);
    font-size: 18px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.2s;
}
.delete-btn:hover { background: #fdf2f2; }

.empty-list-text {
    text-align: center;
    color: #95a5a6;
    padding: 15px;
    font-size: 14px;
}

/* Notebook Container Layout */
.notebook-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    gap: 10px;
}

.nav-btn {
    background-color: transparent;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
}
.nav-btn:hover { background-color: #2c3e50; }

.notebook {
    display: flex;
    background: #fff;
    flex: 1;
    height: 65vh;
    min-height: 400px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    position: relative;
    border-left-width: 14px;
    border-left-style: solid;
    perspective: 1000px;
}

.binding {
    position: absolute;
    left: 4px;
    top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 15px 0;
    z-index: 10;
}

.ring {
    width: 20px;
    height: 10px;
    background: linear-gradient(to bottom, #dcdcdc, #95a5a6, #7f8c8d);
    border-radius: 4px;
}

.page {
    flex: 1;
    background-color: #fdfcf7;
    position: relative;
    padding: 40px 20px 45px 55px;
    overflow: hidden;
    background-image: linear-gradient(#e8f1f5 1px, transparent 1px);
    background-size: 100% 28px;
}

.margin-line {
    position: absolute;
    top: 0;
    left: 45px;
    width: 1px;
    height: 100%;
    background-color: #ff9aa2;
}

.content { display: flex; flex-direction: column; height: 100%; position: relative; }

/* NEW FEATURE ELEMENT: Auto Save Dynamic UI Status Alert Badge */
.save-status {
    position: absolute;
    top: -10px;
    right: 0;
    font-size: 11px;
    font-weight: bold;
    color: #2ecc71;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    transition: color 0.15s, opacity 0.15s;
}

.note-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    border: none;
    background: transparent;
    outline: none;
    margin-bottom: 15px;
    width: 100%;
}


.page-number {
    position: absolute;
    bottom: -15px;
    right: 0;
    font-size: 12px;
    color: #95a5a6;
}

.page-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: absolute;
    bottom: -20px;
    left: 0;
    width: 100%;
    font-size: 12px;
    color: var(--text-muted);
    font-family: system-ui, sans-serif;
}

.font-dropdown {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 11px;
}
/* Control Buttons Layout Row */
.controls {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 800px;
    padding: 0 54px;
}

.action-btn {
    flex: 1;
    padding: 12px 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    color: white;
    font-size: 13px;
    text-align: center;
}

.back-btn { background-color: #7f8c8d; }
.back-btn:hover { background-color: #95a5a6; }
.clear-btn { background-color: #e74c3c; }
.clear-btn:hover { background-color: #c0392b; }
.print-btn { background-color: #3498db; }
.print-btn:hover { background-color: #2980b9; }
/* Responsive break points */
@media (max-width: 580px) {
    body { padding: 5px; }
    .notebook-container { position: relative; gap: 0; }
    
    .nav-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        box-shadow: 0 4px 8px rgba(0,0,0,0.4);
        z-index: 100;
    }
    .left-nav { left: 5px; }
    .right-nav { right: 5px; }
    
    .page { padding-left: 45px; padding-right: 15px; }
    .margin-line { left: 35px; }
    
    .controls { padding: 0; flex-wrap: wrap; }
    .action-btn { flex: unset; width: 100%; }
    .back-btn { order: 3; }
}

/* NEW PRINT FORMAT EXTRACTION MODULE */
@media print {
    body { background: white !important; color: black !important; padding: 0; }
    .dashboard, .nav-btn, .controls, .binding, .save-status, .page-footer { display: none !important; }
    .notebook-container, .notebook, .page {
        display: block !important; width: 100% !important; height: auto !important;
        border: none !important; box-shadow: none !important; background: transparent !important; padding: 0 !important;
    }
    .margin-line { display: none !important; }
    .note-title { font-size: 28px !important; margin-bottom: 20px !important; color: black !important; border-bottom: 2px solid #000 !important; }
    .note-body { color: black !important; font-size: 16pt !important; line-height: 1.6 !important; overflow: visible !important; height: auto !important; }
}
