/* ==========================================================================
   BOOKGRADE - CSS DESIGN SYSTEM (GLASSMORPHIC DARK HARMONY)
   ========================================================================== */

/* --- CSS Variables & Palettes --- */
:root {
    --bg-main: #05050a;
    --bg-card: rgba(13, 13, 23, 0.55);
    --bg-card-hover: rgba(20, 20, 38, 0.75);
    
    --border-light: rgba(255, 255, 255, 0.07);
    --border-glow: rgba(139, 92, 246, 0.25);
    --border-hover: rgba(6, 182, 212, 0.35);

    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --primary: #8b5cf6;       /* Electric Indigo */
    --primary-glow: rgba(139, 92, 246, 0.4);
    --secondary: #06b6d4;     /* Cyber Cyan */
    --secondary-glow: rgba(6, 182, 212, 0.4);
    --accent: #ec4899;        /* Neon Pink */
    --success: #10b981;       /* Emerald */
    --danger: #ef4444;        /* Crimson */

    --font-sans: 'Inter', sans-serif;
    --font-title: 'Outfit', sans-serif;
    --font-book: 'Playfair Display', Georgia, serif;

    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   MODO DIA / LIGHT THEME (OPCIONAL)
   ========================================================================== */
body.theme-light {
    --bg-main: #f1f5f9; /* Slate 100 */
    --bg-card: rgba(255, 255, 255, 0.82); /* Card branco premium translúcido */
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    
    --border-light: rgba(15, 23, 42, 0.08); /* Borda escura sutil */
    --border-glow: rgba(139, 92, 246, 0.15);
    --border-hover: rgba(6, 182, 212, 0.25);

    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #334155; /* Slate 700 */
    --text-muted: #64748b; /* Slate 500 */

    --primary: #7c3aed;       /* Violeta forte */
    --primary-glow: rgba(124, 58, 237, 0.15);
    --secondary: #0891b2;     /* Cyan forte */
    --secondary-glow: rgba(8, 145, 178, 0.15);
    --accent: #db2777;        /* Rosa forte */
}

/* Ajustes finos no modo claro para visual impecável */
body.theme-light .ambient-glow {
    opacity: 0.07;
    mix-blend-mode: multiply;
}

body.theme-light .logo-text {
    color: #0f172a !important; /* Slate 900 */
}

body.theme-light .book-card-title {
    color: #0f172a !important; /* Slate 900 */
}

body.theme-light .filter-btn {
    color: #475569 !important; /* Slate 600 */
}

body.theme-light .filter-btn.active, 
body.theme-light .filter-btn:hover {
    color: var(--primary) !important;
    background: rgba(124, 58, 237, 0.08) !important;
}

body.theme-light .btn-logout,
body.theme-light .btn-theme-toggle {
    background: rgba(15, 23, 42, 0.05) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    color: #334155 !important;
}

body.theme-light .btn-logout:hover,
body.theme-light .btn-theme-toggle:hover {
    background: rgba(15, 23, 42, 0.1) !important;
    color: var(--primary) !important;
}

body.theme-light .main-header {
    background: rgba(255, 255, 255, 0.7) !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
}

body.theme-light .nav-item {
    color: #475569 !important;
}

body.theme-light .nav-item.active {
    background: rgba(124, 58, 237, 0.08) !important;
    color: var(--primary) !important;
    border: 1px solid rgba(124, 58, 237, 0.15) !important;
}

body.theme-light .cornell-textarea,
body.theme-light .form-input,
body.theme-light select,
body.theme-light textarea {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(15, 23, 42, 0.1) !important;
    color: #0f172a !important;
}

/* Select Option and Optgroup styling for Light Theme */
body.theme-light select.form-input option,
body.theme-light select option {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

body.theme-light select.form-input optgroup,
body.theme-light select optgroup {
    background-color: #ffffff !important;
    color: var(--secondary) !important;
    font-weight: 700;
    font-style: italic;
}

body.theme-light select.form-input optgroup option,
body.theme-light select optgroup option {
    background-color: #ffffff !important;
    color: #334155 !important;
    font-weight: 500;
    font-style: normal;
}

/* Mindmap Light Theme Styling */
body.theme-light .mindmap-select {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.15) !important;
    color: #0f172a !important;
}

body.theme-light .mindmap-viewport {
    background-color: #f8fafc !important;
    background-image: radial-gradient(rgba(15, 23, 42, 0.08) 1.5px, transparent 1.5px) !important;
    border-color: rgba(15, 23, 42, 0.1) !important;
}

body.theme-light .mindmap-help {
    background: rgba(0, 0, 0, 0.02) !important;
    border-color: rgba(15, 23, 42, 0.08) !important;
    color: #334155 !important;
}

body.theme-light .mindmap-node {
    background: rgba(124, 58, 237, 0.12) !important;
    border-color: var(--primary) !important;
    color: #5b21b6 !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06) !important;
}

body.theme-light .mindmap-node.root-node {
    background: rgba(8, 145, 178, 0.12) !important;
    border-color: var(--secondary) !important;
    color: #155e75 !important;
    box-shadow: 0 4px 15px rgba(8, 145, 178, 0.15) !important;
}

body.theme-light .mindmap-node.selected {
    background: var(--accent) !important;
    border-color: #fff !important;
    color: #fff !important;
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.4) !important;
}

body.theme-light .mindmap-node input {
    color: #0f172a !important;
}

body.theme-light .mm-ctrl-btn {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(15, 23, 42, 0.1) !important;
    color: #0f172a !important;
}

body.theme-light .mm-ctrl-btn:hover {
    background: #ffffff !important;
    color: var(--primary) !important;
}

body.theme-light .cornell-textarea:focus,
body.theme-light .form-input:focus,
body.theme-light select:focus,
body.theme-light textarea:focus {
    background: #fff !important;
    border-color: var(--primary) !important;
}

body.theme-light .reader-page-content {
    background: #fff !important;
    color: #1e293b !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(15, 23, 42, 0.06) !important;
}

body.theme-light .reader-stat-pill,
body.theme-light .time-remaining-pill {
    background: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    color: #334155 !important;
}

body.theme-light #sessionChronometer {
    color: #0f172a !important;
}

body.theme-light .btn-nav-page {
    background: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    color: #334155 !important;
}

body.theme-light .btn-nav-page:hover:not(:disabled) {
    background: rgba(124, 58, 237, 0.1) !important;
    color: var(--primary) !important;
}

/* Ajustes no modal RSVP no modo claro */
body.theme-light .rsvp-modal {
    background: rgba(241, 245, 249, 0.9) !important;
}

body.theme-light .rsvp-content {
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.1) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1) !important;
}

body.theme-light .rsvp-word-part.left,
body.theme-light .rsvp-word-part.right {
    color: #334155 !important;
}

body.theme-light .rsvp-btn {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #334155 !important;
}

body.theme-light .rsvp-btn:hover {
    background: rgba(124, 58, 237, 0.1) !important;
    color: var(--primary) !important;
}

body.theme-light .rsvp-progress {
    color: #334155 !important;
}

body.theme-light #rsvpProgressIndex {
    color: #0f172a !important;
}

/* --- Resets & Base Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Ambient Backdrops (Dribbble/Apple aesthetic) --- */
.ambient-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.25;
    mix-blend-mode: screen;
}

.glow-1 {
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -200px;
    left: -100px;
    animation: floatGlow 12s infinite alternate ease-in-out;
}

.glow-2 {
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    bottom: -200px;
    right: -100px;
    animation: floatGlow 15s infinite alternate-reverse ease-in-out;
}

.glow-3 {
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    top: 30%;
    left: 40%;
    width: 400px;
    height: 400px;
    opacity: 0.12;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(80px, 50px) scale(1.15); }
}

/* --- Scrollbar Customization --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* --- Layout Container --- */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0 40px;
}

/* --- Header / Navigation --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-family: var(--font-title);
    font-weight: 800;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.logo-text {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 24px;
    color: #fff;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--secondary);
}

.main-nav {
    display: flex;
    gap: 20px;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.nav-item:hover, .nav-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.welcome-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.username {
    font-weight: 600;
    color: var(--secondary);
}

.btn-logout {
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
}

.btn-logout:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* --- Form Styles (Login & Signup Glass Cards) --- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.4s ease-out;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.auth-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 28px;
    margin-bottom: 8px;
    text-align: center;
    background: linear-gradient(to right, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 14px;
    transition: var(--transition-smooth);
}

/* Select Option and Optgroup styling for Dark Theme (default) */
select.form-input option,
select option {
    background-color: #121220;
    color: #f3f4f6;
}

select.form-input optgroup,
select optgroup {
    background-color: #121220;
    color: var(--secondary) !important;
    font-weight: 700;
    font-style: italic;
}

select.form-input optgroup option,
select optgroup option {
    background-color: #121220;
    color: #f3f4f6 !important;
    font-weight: 500;
    font-style: normal;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: var(--transition-bounce);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* --- Messages / Notifications --- */
.messages-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.message {
    background: rgba(13, 13, 23, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 16px 20px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    transition: var(--transition-smooth);
}

.message.error {
    border-left: 4px solid var(--danger);
}

.message.success {
    border-left: 4px solid var(--success);
}

.message.info {
    border-left: 4px solid var(--secondary);
}

.close-msg {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    margin-left: auto;
}

/* --- Library Dashboard --- */
.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.library-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 32px;
}

.btn-upload-trigger {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: var(--transition-bounce);
}

.btn-upload-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

/* Daily Goal Widget */
.daily-goal-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(13, 13, 23, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 8px 14px;
    transition: var(--transition-smooth);
}

.daily-goal-widget:hover {
    border-color: var(--border-hover);
    background: rgba(20, 20, 38, 0.85);
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: var(--transition-bounce);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-family: var(--font-title);
    font-size: 22px;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
}

/* Upload Area */
.upload-dropzone {
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-dropzone:hover {
    border-color: var(--secondary);
    background: rgba(6, 182, 212, 0.05);
}

.upload-icon {
    color: var(--secondary);
}

.file-info {
    font-size: 14px;
    color: var(--success);
    font-weight: 500;
    display: none;
}

/* Category Filters */
.library-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 15px;
}

.filter-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.filter-btn.active, .filter-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
    padding-bottom: 60px;
}

/* Book Card */
.book-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: var(--transition-bounce);
    overflow: hidden;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    opacity: 0;
    transition: var(--transition-smooth);
}

.book-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: var(--border-hover);
    box-shadow: 0 15px 30px rgba(6, 182, 212, 0.15);
}

.book-card:hover::before {
    opacity: 1;
}

.book-cover-container {
    aspect-ratio: 2/3;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-cover-procedural {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.book-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    width: max-content;
    margin-bottom: 8px;
}

.tag-quero-ler { background: rgba(236, 72, 153, 0.15); color: var(--accent); }
.tag-lendo { background: rgba(6, 182, 212, 0.15); color: var(--secondary); }
.tag-lido { background: rgba(16, 185, 129, 0.15); color: var(--success); }

.book-card-title {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 16px;
    line-height: 1.3;
    margin-bottom: 4px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-author {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-category {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--secondary);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Optgroup styling */
select.form-input optgroup {
    font-weight: 700;
    color: var(--secondary);
    background: #0d0d17;
}

select.form-input option {
    font-weight: 400;
    color: var(--text-primary);
    background: #0d0d17;
    padding: 4px 8px;
}

/* Card Progress bar */
.book-progress-wrapper {
    margin-top: auto;
}

.book-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.book-progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.book-progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: var(--transition-smooth);
}

.book-actions-overlay {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    gap: 6px;
    opacity: 0;
    z-index: 20 !important;
    transition: var(--transition-smooth);
}

.book-card:hover .book-actions-overlay {
    opacity: 1;
}

.action-icon-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-light);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.action-icon-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
}

/* --- Reader Interface (Side-by-Side Splitscreen) --- */
.reader-container {
    display: flex;
    height: calc(100vh - 120px);
    gap: 30px;
    padding-bottom: 20px;
}

/* Left Pane: Book Reader Page */
.reader-pane-left {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 30px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    height: 100%;
    overflow: hidden;  /* keeps border-radius clipping */
    min-height: 0;     /* allows flex children to shrink */
}

/* Top Toolbar inside Reader */
.reader-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.reader-book-title {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.reader-settings-panel {
    display: flex;
    align-items: center;
    gap: 15px;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

.size-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 2px 6px;
    font-weight: 700;
}

/* Equalizer TTS Animation */
.equalizer-anim {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    width: 24px;
    height: 16px;
    margin-right: 8px;
}

.eq-bar {
    width: 3px;
    background: var(--secondary);
    height: 3px;
    border-radius: 1.5px;
    transition: var(--transition-smooth);
}

.equalizer-anim.speaking .eq-bar {
    animation: eqBounce 0.8s infinite alternate ease-in-out;
}

.equalizer-anim.speaking .eq-bar:nth-child(1) { animation-delay: 0.1s; }
.equalizer-anim.speaking .eq-bar:nth-child(2) { animation-delay: 0.3s; }
.equalizer-anim.speaking .eq-bar:nth-child(3) { animation-delay: 0.5s; }
.equalizer-anim.speaking .eq-bar:nth-child(4) { animation-delay: 0.2s; }

@keyframes eqBounce {
    0% { height: 3px; }
    100% { height: 16px; }
}

/* Float Controls for TTS */
.tts-controls-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.4);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.tts-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.tts-btn:hover {
    color: var(--secondary);
}

.voice-select {
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--border-light);
    color: #fff;
    font-size: 11px;
    padding: 4px;
    border-radius: 4px;
    max-width: 110px;
}

.speed-select {
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--border-light);
    color: #fff;
    font-size: 11px;
    padding: 4px;
    border-radius: 4px;
}

/* Actual Page text viewer */
.reader-page-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    margin-bottom: 20px;
}

.reader-page-content {
    font-family: var(--font-book);
    font-size: 18px;
    line-height: 1.7;
    color: #e5e7eb;
    text-align: justify;
    user-select: text;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Bottom Reader Bar (Progress, page indicator) */
.reader-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.time-remaining-pill {
    background: rgba(6, 182, 212, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.05);
}

.page-navigation {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-nav-page {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.btn-nav-page:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1);
}

.btn-nav-page:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-indicator {
    font-family: var(--font-title);
    font-weight: 600;
    font-size: 14px;
}

/* Right Pane: Study Panel tabs */
.reader-pane-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    height: 100%;
    overflow: hidden;
}

.study-tabs-nav {
    display: flex;
    gap: 5px;
    background: rgba(0,0,0,0.3);
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition-smooth);
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.study-tab-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow-y: auto;
}

.study-tab-content.active {
    display: flex;
}

/* Cornell Note Layout */
.cornell-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.cornell-row {
    display: flex;
    gap: 15px;
    flex: 1.5;
    min-height: 200px;
}

.cornell-cues-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cornell-notes-col {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cornell-summary-row {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 100px;
}

.cornell-textarea {
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 13px;
    padding: 10px;
    resize: none;
    transition: var(--transition-smooth);
}

.cornell-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.cornell-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-save-notes {
    background: var(--success);
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 5px;
    transition: var(--transition-smooth);
}

.btn-save-notes:hover {
    filter: brightness(1.1);
}

/* Mind Map Workspace */
.mindmap-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mindmap-help {
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.02);
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid var(--border-light);
}

.mindmap-viewport {
    flex: 1;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background-color: #020205;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1.5px, transparent 1.5px);
    background-size: 24px 24px;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

.mindmap-viewport:active {
    cursor: grabbing;
}

.mindmap-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.mindmap-nodes-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

/* Node Elements */
.mindmap-node {
    position: absolute;
    background: rgba(139, 92, 246, 0.25);
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    padding: 8px 12px;
    min-width: 80px;
    max-width: 180px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    user-select: none;
    transition: box-shadow 0.2s, background-color 0.2s;
    backdrop-filter: blur(4px);
}

.mindmap-node.root-node {
    background: rgba(6, 182, 212, 0.3);
    border-color: var(--secondary);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
    font-size: 14px;
}

.mindmap-node.selected {
    background: var(--accent) !important;
    border-color: #fff !important;
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.5) !important;
}

.mindmap-node input {
    background: none;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-align: center;
    width: 100%;
    outline: none;
}

.mindmap-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.mm-ctrl-btn {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-light);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Active Recall / Flashcards layout */
.flashcards-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.flashcard-form {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flashcards-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-right: 5px;
}

.study-flashcard-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    position: relative;
    cursor: pointer;
}

.study-flashcard-q {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    margin-bottom: 5px;
}

.study-flashcard-a {
    font-size: 12px;
    color: var(--text-secondary);
    display: none;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 5px;
    margin-top: 5px;
}

.study-flashcard-card.flipped .study-flashcard-a {
    display: block;
}

.leinter-actions {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    display: none;
}

.study-flashcard-card.flipped .leinter-actions {
    display: flex;
}

.btn-recall {
    flex: 1;
    font-size: 10px;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    color: #fff;
}
.btn-recall-hard { background: var(--danger); }
.btn-recall-good { background: var(--primary); }
.btn-recall-easy { background: var(--success); }

/* Active Recall Simulator Mode */
.active-recall-simulation {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    height: 100%;
}

.simulator-title {
    font-family: var(--font-title);
    font-size: 20px;
    font-weight: 700;
}

.sim-q {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

/* --- Async Background Processing Keyframes --- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.03); filter: brightness(1.1); }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.processing-card {
    cursor: wait !important;
}

/* --- Reader Stats Pills (WPM, Chronometer, Planned Time) --- */
.reader-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.reader-stat-pill:hover {
    border-color: var(--border-hover);
    background: rgba(6, 182, 212, 0.07);
}

/* Reader footer layout update */
.reader-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
    flex-shrink: 0;
}

/* --- Speed Reading / Leitura Dinâmica --- */

/* Action Button Toggles */
.btn-speed-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.btn-speed-toggle:hover {
    color: #fff;
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.1);
}

.btn-speed-toggle.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

.btn-speed-toggle.active-pacer {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--secondary);
    color: var(--secondary);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

/* Bionic reading class modifier */
.bionic-wrapper strong {
    font-weight: 800 !important;
    color: #fff !important;
    text-shadow: 0 0 1px rgba(255,255,255,0.3);
}

.bionic-wrapper span {
    opacity: 0.72 !important;
}

/* RSVP Glassmorphic Immersive Modal */
.rsvp-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 16, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rsvp-modal.show {
    opacity: 1;
}

.rsvp-content {
    background: rgba(20, 20, 31, 0.65);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    width: 90%;
    max-width: 600px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rsvp-modal.show .rsvp-content {
    transform: scale(1);
}

.rsvp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.rsvp-header h3 {
    font-family: var(--font-title);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rsvp-close-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.rsvp-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-color: var(--danger);
}

/* Display Centralizado */
.rsvp-display-container {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 30px;
}

/* Linhas e Marcadores de Foco */
.rsvp-focus-lines {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}

.rsvp-focus-line {
    position: absolute;
    left: 10%; right: 10%;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.rsvp-focus-line.top { top: 25%; }
.rsvp-focus-line.bottom { bottom: 25%; }

/* Indicador central do Ponto Focal de Reconhecimento (ORP) */
.rsvp-focus-indicator {
    position: absolute;
    left: 36.5%; /* O ponto focal de reconhecimento de spritz é a ~36% da largura */
    width: 2px;
    height: 12px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.rsvp-focus-indicator.top { top: 25%; transform: translateY(-50%); }
.rsvp-focus-indicator.bottom { bottom: 25%; transform: translateY(50%); }

/* Word Viewport - Fonte Monoespaçada para que o alinhamento central nunca oscile */
.rsvp-word-viewport {
    font-family: 'Courier New', Courier, monospace;
    font-size: 38px;
    font-weight: 700;
    display: flex;
    width: 100%;
    /* Centralização perfeita ancorada no caractere do meio */
}

.rsvp-word-part {
    display: inline-block;
    white-space: pre;
}

.rsvp-word-part.left {
    width: 36.5%;
    text-align: right;
    color: var(--text-secondary);
}

.rsvp-word-part.center {
    color: var(--accent);
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
}

.rsvp-word-part.right {
    width: 63.5%;
    text-align: left;
    color: #fff;
}

/* RSVP Controls */
.rsvp-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.rsvp-btn {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    border: none;
    border-radius: 12px;
    color: #fff;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    transition: var(--transition-bounce);
}

.rsvp-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.rsvp-wpm-control {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 6px 14px;
}

.rsvp-wpm-control label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 75px;
}

.rsvp-wpm-control input[type="range"] {
    width: 120px;
    accent-color: var(--primary);
    cursor: pointer;
}

.rsvp-progress {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
/* ==========================================================================
   OTIMIZAÇÕES DE TEMA CLARO E CONTRASTE GERAL DE PÁGINAS E LISTAS
   ========================================================================== */

/* Dropzone no tema claro */
body.theme-light .upload-dropzone {
    background: rgba(0, 0, 0, 0.02) !important;
    border-color: rgba(15, 23, 42, 0.15) !important;
    color: #0f172a !important;
}

/* Botões de ação do card do livro no tema claro */
body.theme-light .action-icon-btn {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(15, 23, 42, 0.15) !important;
    color: #0f172a !important;
}

body.theme-light .action-icon-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger) !important;
    border-color: var(--danger) !important;
}

/* Dropdown de status no tema claro */
body.theme-light .dropdown-content-status {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.15) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
}

body.theme-light .dropdown-content-status a {
    color: #334155 !important;
}

body.theme-light .dropdown-content-status a:hover {
    background: rgba(124, 58, 237, 0.08) !important;
    color: var(--primary) !important;
}

/* Meta Diária Widget no tema claro */
body.theme-light .goal-setter-widget {
    background: var(--bg-card) !important;
    border-color: rgba(15, 23, 42, 0.1) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
}

body.theme-light .stats-goal-input {
    background: rgba(0, 0, 0, 0.04) !important;
    color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.15) !important;
}

body.theme-light .stats-goal-input:focus {
    background: #ffffff !important;
    border-color: var(--primary) !important;
}

