:root {
    --bg-color: #050505;
    --surface-color: #121212;
    --primary-color: #ff3b30;
    /* Neon Red */
    --secondary-color: #ffffff;
    --text-color: #e0e0e0;
    --dim-text: #666;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --focus-guide-color: rgba(255, 59, 48, 0.15);
    --reader-bg: #000000;
    --modal-bg: #0a0a0a;
    --tooltip-bg: rgba(15, 15, 15, 0.95);
    --tooltip-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'Space Mono', monospace;
    --transition-speed: 0.3s;

    /* Reader Dynamic Properties */
    --reader-font-size: 100%;
    /* Scale factor */
    --reader-font-family: var(--font-heading);
    --reader-text-upper: none;
    --reader-word-weight: 600;
    --reader-orp-weight: 750;
}

:root[data-theme="light"] {
    --bg-color: #f5f5f7;
    --surface-color: #ffffff;
    --primary-color: #ff3b30;
    --secondary-color: #1d1d1f;
    --text-color: #1d1d1f;
    --dim-text: #86868b;
    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.1);
    --reader-bg: #ffffff;
    --modal-bg: #ffffff;
    --tooltip-bg: rgba(255, 255, 255, 0.98);
    --tooltip-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-heading);
    height: 100vh;
    display: flex;
    overflow: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    /* App-like feel */
}

.app-container {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.logo .highlight {
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 50;
    /* Ensure buttons are above other content */
}

/* Main Layout */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
    /* Flexbox scrolling fix */
}

/* Reader Display - The Core */
.reader-display {
    flex: 1.5;
    background: var(--reader-bg);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin-bottom: 0;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

/* Hide the vertical guide line - we'll use underline instead */
.focus-line {
    display: none;
}

/* 
   We use CSS Grid to perfectly align the ORP (Optimal Recognition Point)
   to the center of the screen.
   Columns: 1fr (Right Aligned Text) | auto (The Red Letter) | 1fr (Left Aligned Text)
*/
.word-container {
    font-family: var(--reader-font-family);
    font-size: calc(clamp(3rem, 10vw, 6rem) * var(--reader-font-size));
    font-weight: var(--reader-word-weight);
    color: var(--secondary-color);
    white-space: nowrap;
    z-index: 10;
    line-height: 1;
    position: relative;
    top: -4px;
    width: 100%;
    max-width: 90%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: baseline;
    gap: 0;
    margin: 0 auto;
}


.word-left,
.word-orp,
.word-right {
    text-transform: var(--reader-text-upper);
}

.word-left {
    text-align: right;
}

.word-orp {
    color: var(--primary-color);
    font-weight: var(--reader-orp-weight);
    text-align: center;
    text-decoration: underline;
    text-decoration-color: var(--primary-color);
    text-decoration-thickness: 3px;
    text-underline-offset: 8px;
}

.word-right {
    text-align: left;
}

/* Highlight the Optimal Recognition Point (ORP) - Legacy support removed */

/* Controls */
.controls-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    height: auto;
    padding: 1.5rem;
    position: relative;
    min-height: 140px;
}

.glass-panel {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    backdrop-filter: blur(10px);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.main-controls-row {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 0 1rem;
}

.controls-spacer {
    width: 120px;
    flex-shrink: 0;
}

@media (max-width: 1100px) {
    .controls-spacer {
        display: none;
    }
}

.playback-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    /* Ensure controls are above other reader elements */
}

.control-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    /* overflow: hidden; REMOVED to allow tooltips */
}

/* Ensure icon/text text sits above the shine */
.control-btn>* {
    position: relative;
    z-index: 2;
}

/* Subtle glass highlight on hover - Moved to ::after to free ::before for tooltips */
.control-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    border-radius: 50%;
    /* Match button shape manually since overflow is visible */
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.control-btn:hover::after {
    opacity: 1;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px) scale(1.05);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.control-btn:active {
    transform: translateY(0) scale(0.95);
}

.control-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.35);
}

/* Big Play Button - The Star of the Show */
.control-btn.big-play {
    width: 72px;
    height: 72px;
    background: var(--secondary-color);
    color: var(--reader-bg);
    border: none;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    animation: neon-pulse 3s infinite;
}

@keyframes neon-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(255, 59, 48, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    }
}

.control-btn.big-play:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 10px 30px rgba(255, 59, 48, 0.4);
    /* Stronger glow on hover */
    animation: none;
    /* Stop pulsing on hover so it feels solid */
}

.control-btn.big-play:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 10px rgba(255, 59, 48, 0.3);
}

/* Directional Animations */
#rewindBtn svg {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#rewindBtn:hover svg {
    transform: translateX(-3px);
}

#forwardBtn svg {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#forwardBtn:hover svg {
    transform: translateX(3px);
}

/* Reset Rotation Animation */
#resetBtn svg {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#resetBtn:hover svg {
    transform: rotate(-180deg);
}

.settings-group {
    display: flex;
    flex: 1;
    gap: 2rem;
    align-items: center;
}

.wpm-control-container {
    margin-left: auto;
}

.wpm-control-group {
    display: grid;
    grid-template-columns: auto auto auto auto;
    align-items: center;
    gap: 0.6rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    padding: 0.45rem 0.65rem;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
}

.wpm-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--dim-text);
    letter-spacing: 0.08em;
    padding: 0 0.25rem;
}

.wpm-step-btn {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.wpm-step-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 59, 48, 0.45);
    background: rgba(255, 59, 48, 0.12);
}

#wpmDisplay {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--secondary-color);
    min-width: 3.2ch;
    text-align: center;
}


.progress-control {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#progressBar {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    border: 0;
    outline: none;
    background:
        linear-gradient(90deg, var(--primary-color), var(--primary-color)) 0 0 / 0% 100% no-repeat,
        rgba(255, 255, 255, 0.14);
}

#progressBar::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: transparent;
}

#progressBar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -6px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    background: #ffffff;
    box-shadow: 0 0 0 5px rgba(255, 59, 48, 0.12), 0 2px 12px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

#progressBar::-moz-range-track {
    height: 6px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

#progressBar::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--primary-color);
}

#progressBar::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    background: #ffffff;
    box-shadow: 0 0 0 5px rgba(255, 59, 48, 0.12), 0 2px 12px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--dim-text);
}

.stat-item {
    display: flex;
    gap: 0.3rem;
}

.highlight-stat {
    color: var(--primary-color);
    font-weight: 700;
}

.time-stat {
    color: var(--text-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.time-divider {
    opacity: 0.3;
    font-weight: 300;
}

.time-icon {
    opacity: 0.7;
    font-size: 0.95em;
}


/* Input Section */
.input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--dim-text);
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 1.2rem;
    transition: 0.3s;
    outline: none;
    /* Remove blue outline */
}

.tab-btn.active {
    color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    box-shadow: 0 0 0 1px var(--glass-border);
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

#contentArea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-heading);
    line-height: 1.6;
    resize: none;
    font-size: 1rem;
    outline: none;
}

.btn-primary,
.btn-secondary {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: var(--font-heading);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-primary {
    background: #ffffff;
    color: #000000;
    width: fit-content;
    align-self: center;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
    background: #f0f0f0;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.file-drop-zone {
    flex: 1;
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--dim-text);
    cursor: pointer;
    transition: 0.3s;
}

.kofi-link,
.kofi-link:visited {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.85rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    display: inline-block;
}

.kofi-link:hover {
    opacity: 1;
    color: var(--primary-color);
}

/* FAQ Button */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--dim-text);
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.2s;
    border-radius: 50%;
}

.btn-icon:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.05);
}

/* Custom Instant Tooltip */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--tooltip-bg);
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-family: var(--font-heading);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
    border: 1px solid var(--glass-border);
    box-shadow: var(--tooltip-shadow);
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Modal Styling */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    margin: auto;
    width: 90%;
    max-width: 600px;
    padding: 2.5rem;
    position: relative;
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    background: var(--modal-bg);
    /* Enhance glass panel for modal */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    color: var(--dim-text);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

.modal h2 {
    margin-bottom: 2rem;
    font-size: 1.8rem;
    color: var(--secondary-color);
}

.faq-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.faq-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-section h3 {
    margin-bottom: 0.8rem;
    color: var(--text-color);
    font-size: 1.2rem;
}

.faq-section p,
.faq-section li {
    line-height: 1.6;
    color: var(--dim-text);
    font-size: 0.95rem;
}

.faq-section ul {
    padding-left: 1.2rem;
    margin-top: 0.5rem;
}

/* Focus Guides: Vertical Lines above/below */
.reader-display {
    position: relative;
    /* Ensure absolute children position relative to this */
}

/* Top Vertical Guide - Lengthened */
.reader-display::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: calc(50% - 132px);
    height: 24px;
    width: 2px;
    background-color: var(--primary-color);
    opacity: 0.82;
    pointer-events: none;
}

/* Bottom Vertical Guide - Lengthened */
.reader-display::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(50% - 132px);
    height: 24px;
    width: 2px;
    background-color: var(--primary-color);
    opacity: 0.82;
    pointer-events: none;
}

/* Cleanup ORP */
.word-orp {
    color: var(--part-primary-color, #ff3b30);
    font-weight: 700;
    margin: 0;
    text-decoration: none !important;
    /* Remove any default underline */
    position: relative;
    display: inline-block;
}

/* Horizontal Bracket removed as requested */
.word-orp::after {
    display: none;
}

/* Fluid Alignment: Force ORP to be dead center */
.word-chunk {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    line-height: normal;
    /* prevent vertical jumping */
}

.word-left {
    flex: 1;
    text-align: right;
    display: inline-block;
    white-space: pre;
}

.word-orp {
    color: var(--part-primary-color, #ff3b30);
    /* fallback or variable */
    font-weight: 700;
    margin: 0;
}

.word-right {
    flex: 1;
    text-align: left;
    display: inline-block;
    white-space: pre;
}

/* Responsive Design (Aggressive Mobile-First Overhaul) */

.url-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

@media (max-width: 768px) {
    body {
        height: auto;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .app-container {
        padding: 1rem 1rem 4rem 1rem;
        gap: 1.5rem;
        height: auto;
        min-height: 100vh;
        display: block;
    }

    main {
        display: block;
        height: auto;
    }

    .sidebar-section {
        width: 100%;
        height: auto;
        margin-bottom: 2rem;
        padding: 1.2rem;
    }

    .workspace-main {
        width: 100%;
        height: auto;
        gap: 1.5rem;
    }

    .reader-display {
        height: 250px;
        min-height: 200px;
        margin-bottom: 1.5rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .word-container {
        font-size: clamp(2rem, 15vw, 4rem);
        max-width: 95vw;
        overflow-wrap: break-word;
        /* Prevent overflow */
        word-break: break-word;
        text-align: center;
        line-height: 1.2;
    }

    .controls-container {
        padding: 1rem;
        gap: 1.2rem;
        min-height: auto;
    }

    .main-controls-row {
        flex-direction: column;
        gap: 1.5rem;
    }

    .playback-controls {
        position: static;
        transform: none;
        order: 1;
        justify-content: center;
        width: 100%;
        gap: 1.2rem;
    }

    .wpm-control-container {
        margin-left: 0;
        width: 100%;
        order: 2;
    }

    .wpm-control-group {
        width: auto;
        justify-content: center;
        padding: 0.65rem 0.8rem;
        margin: 0 auto;
    }

    .progress-stats {
        justify-content: space-around;
        gap: 1rem;
    }

    .tabs {
        padding-bottom: 0.5rem;
        margin-bottom: 0.8rem;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    /* URL Import Redesign for Mobile */
    .url-input-group {
        flex-direction: column;
        height: auto;
        gap: 1rem;
        margin: 0.5rem 0 2rem 0;
    }

    .url-field {
        width: 100%;
        height: 54px;
        font-size: 0.95rem;
    }

    .url-actions {
        display: flex;
        width: 100%;
        gap: 0.8rem;
        align-items: center;
    }

    #extractUrlBtn {
        flex: 1;
        height: 54px;
        order: 1;
    }

    .tooltip-container {
        order: 2;
        margin: 0;
    }

    .info-icon {
        width: 44px;
        height: 44px;
    }

    .smart-tooltip {
        width: calc(100vw - 3rem);
        right: 0;
        left: auto;
        bottom: 120%;
        transform: translateY(10px);
    }

    .tooltip-container:hover .smart-tooltip {
        transform: translateY(0);
    }

    .smart-tooltip::after {
        right: 14px;
    }

    .footer-links-container {
        margin-top: 2rem;
        padding-bottom: 2rem;
    }
}

@media (max-width: 480px) {
    .word-container {
        font-size: clamp(2.5rem, 15vw, 4rem);
    }

    .big-play {
        width: 60px;
        height: 60px;
    }

    .reader-display {
        border-radius: 16px;
    }

    .app-container {
        padding: 0.8rem;
    }
}



/* Appearance & Header Controls */
.appearance-wrapper {
    position: relative;
    display: inline-block;
}

.appearance-panel {
    position: absolute;
    top: 120%;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
}

.appearance-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.appearance-row label {
    font-size: 0.8rem;
    color: var(--dim-text);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.segmented-control {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 2px;
    border: 1px solid var(--glass-border);
    align-items: center;
    /* Center items vertically */
}

.segmented-control.three-way {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2px;
}

.segment-btn {
    background: transparent;
    border: none;
    color: var(--dim-text);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-align: center;
}

.segment-btn:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.segment-btn.active {
    background: var(--secondary-color);
    color: var(--bg-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.segment-display {
    flex: 1;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .appearance-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        transform: none;
        border-radius: 20px 20px 0 0;
        padding-bottom: 2rem;
        background: var(--surface-color);
        /* More solid background for mobile sheet */
    }
}

/* Language Selector */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lang-select {
    background: transparent;
    color: var(--dim-text);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.3rem 0.6rem;
    font-family: var(--font-heading);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.lang-select:hover {
    color: var(--secondary-color);
    border-color: var(--text-color);
}

.lang-select option {
    background: var(--surface-color);
    color: var(--text-color);
}

/* Ultra Focus - Autohide UI */
.autohide-ui {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
}

.ui-hidden .autohide-ui {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(20px);
}

/* Cinematic Centering for Reader */
.reader-display {
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        background-color var(--transition-speed),
        border-color var(--transition-speed),
        box-shadow 0.8s ease;
    z-index: 10;
}

.ui-hidden .reader-display {
    transform: translateY(20vh);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Report Modal Specifics */
.report-content {
    text-align: center;
}

.report-stat-card {
    transition: transform 0.3s ease;
}

.report-stat-card:hover {
    transform: translateY(-5px);
}

.report-value {
    display: block;
    line-height: 1.2;
}

@keyframes reportPop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Full Screen Focus Mode Enhancements */
:fullscreen .app-container {
    max-width: 100vw;
    padding: 5vh 5vw;
}

:fullscreen .reader-display {
    border-radius: 40px;
    box-shadow: 0 50px 120px rgba(0, 0, 0, 0.5);
    background-color: var(--reader-bg);
}

:fullscreen .word-container {
    font-size: clamp(6rem, 15vw, 15rem);
}

:fullscreen .app-footer,
:fullscreen .kofi-link {
    display: none !important;
}

:fullscreen .modal-content {
    max-width: 600px;
}

.report-content {
    animation: reportPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* URL Extraction Layout */
.url-input-group {
    display: flex;
    gap: 1rem;
    margin: 1.5rem auto;
    height: 50px;
    align-items: center;
    max-width: 800px;
    width: 100%;
}

.url-field {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0 1.2rem;
    color: var(--text-color);
    font-family: var(--font-heading);
    font-size: 1rem;
    height: 100%;
    transition: all 0.3s;
}

.url-field:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.1);
}

#extractUrlBtn {
    white-space: nowrap;
    height: 100%;
    padding: 0 1.5rem;
    border-radius: 12px;
}

/* Header Icon Buttons */
.header-control-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--dim-text);
    width: 48px;
    /* Slight increase */
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    /* SVG has own viewbox */
}

.header-control-btn:hover {
    color: var(--secondary-color);
    background: var(--glass-bg);
    border-color: var(--glass-border);
}

.header-control-btn svg {
    pointer-events: none;
    display: block;
}

.btn-icon {
    /* Legacy / other usage */
    background: transparent;
    border: 1px solid transparent;
    color: var(--dim-text);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    /* Circle */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-icon:hover {
    color: var(--secondary-color);
    background: var(--glass-bg);
    border-color: var(--glass-border);
}

.btn-icon svg {
    pointer-events: none;
    /* Prevent clicks on SVG from bubbling weirdly */
}

/* Smart Tooltip Section */
.tooltip-container {
    position: relative;
    display: flex;
    align-items: center;
    cursor: help;
}

.info-icon {
    font-size: 1.2rem;
    color: var(--dim-text);
    opacity: 0.7;
    transition: all 0.3s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
}

.tooltip-container:hover .info-icon {
    opacity: 1;
    color: #ffd60a;
    background: rgba(255, 214, 10, 0.1);
    border-color: rgba(255, 214, 10, 0.3);
    transform: scale(1.1);
}

.smart-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    right: -10px;
    width: 280px;
    background: var(--tooltip-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 1.2rem;
    border-radius: 16px;
    box-shadow: var(--tooltip-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    pointer-events: none;
}

.tooltip-container:hover .smart-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.smart-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 20px;
    border-width: 8px;
    border-style: solid;
    border-color: var(--tooltip-bg) transparent transparent transparent;
}

.smart-tooltip .warning-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #ffd60a;
    font-size: 0.95rem;
}

.smart-tooltip p {
    font-size: 0.85rem;
    color: var(--text-color);
    line-height: 1.5;
    margin: 0;
}

.footer-links-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.kofi-link-alt {
    opacity: 0.5;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s;
}

.kofi-link-alt:hover {
    opacity: 1;
    color: var(--primary-color);
}

/* Settings Modal Styles */
.settings-content {
    max-width: 500px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.settings-grid {
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dim-text);
    font-size: 0.9rem;
    font-weight: 600;
}

.segmented-control {
    display: flex;
    background: var(--glass-bg);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    gap: 4px;
}

.segmented-control.three-way .segment-btn {
    flex: 1;
}

.segment-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--dim-text);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    transition: all 0.2s ease;
}

.segment-btn:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.segment-btn.active {
    background: var(--secondary-color);
    color: var(--reader-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.segment-display {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text-color);
    font-size: 0.9rem;
}

.settings-select {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    font-family: var(--font-heading);
    font-size: 1rem;
    cursor: pointer;
    appearance: none;

    /* Using a simple encoded SVG chevron for the select arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23666%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 0.65em auto;
}

.full-width {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Premium Animations */
.btn-animate {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-animate:active {
    transform: scale(0.95);
}

/* Hover Glow Effect */
.btn-animate::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 59, 48, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
    z-index: 0;
    pointer-events: none;
}

.btn-animate:hover::after {
    width: 150%;
    height: 150%;
}

/* Ensure content is above the glow */
.btn-animate span,
.btn-animate svg,
.btn-animate path {
    position: relative;
    z-index: 1;
}

/* Improved Toggle Button inside Modal */
#themeToggle .icon-wrapper svg {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

#themeToggle:hover .icon-wrapper svg {
    transform: rotate(15deg);
}

/* Stats Dashboard Styles */
.stats-content {
    max-width: 650px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.stats-dashboard {
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Stats Cards */
.stats-cards-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary-color);
    font-family: var(--font-heading);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--dim-text);
    margin-top: 0.2rem;
}

/* Achievements */
.achievements-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: thin;
}

.achievement-badge {
    min-width: 140px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    opacity: 0.5;
    filter: grayscale(1);
    transition: all 0.3s;
}

.achievement-badge.unlocked {
    opacity: 1;
    filter: none;
    border-color: var(--primary-color);
    background: rgba(255, 59, 48, 0.05);
}

.badge-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.badge-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--secondary-color);
    display: block;
    margin-bottom: 0.2rem;
}

.badge-desc {
    font-size: 0.75rem;
    color: var(--dim-text);
}

/* History List */
.history-section {
    flex: 1;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.small-select {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    cursor: pointer;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 250px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    font-size: 0.9rem;
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.history-date {
    font-size: 0.75rem;
    color: var(--dim-text);
}

.history-source {
    font-weight: 600;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-source-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}

.tag-pdf {
    background: rgba(255, 59, 48, 0.2);
    color: #ff3b30;
}

.tag-url {
    background: rgba(0, 122, 255, 0.2);
    color: #007aff;
}

.tag-text {
    background: rgba(52, 199, 89, 0.2);
    color: #34c759;
}

.history-stat {
    font-family: var(--font-mono);
    color: var(--dim-text);
    text-align: right;
}

/* Warning Footer */
.warning-footer {
    background: rgba(255, 214, 10, 0.1);
    /* Yellow tint */
    padding: 1rem 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: #ffd60a;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-top: 1px solid rgba(255, 214, 10, 0.2);
}

/* Header right group */
.header-right {
    display: flex;
    gap: 0.5rem;
}

@media (max-width: 600px) {
    .stats-cards-row {
        grid-template-columns: 1fr;
    }
}

/* Collapsible Stats Section */
.collapsible-section {
    margin-top: 1.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 16px;
    /* Smooth corners */
}

.collapsible-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.collapsible-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.collapsible-content {
    padding: 0 1.5rem 1.5rem 1.5rem;
    border-top: 1px solid var(--glass-border);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-grid-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.stats-summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--glass-border);
}

@media (max-width: 600px) {
    .stats-summary-row {
        grid-template-columns: 1fr;
    }
}

/* --- Auth & Library Styles --- */

/* Auth Page Specifics */
/* --- Auth & Library Styles --- */

/* Auth Page Specifics */
body.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-color);
    margin: 0;
    font-family: 'Outfit', sans-serif;
    position: relative;
    overflow: hidden;
}

.auth-bg-glow {
    position: fixed;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(255, 59, 48, 0.12) 0%, rgba(255, 59, 48, 0.02) 40%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Keyframes for Authentication Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    padding: 4rem;
    background: rgba(12, 12, 12, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    text-align: center;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.brand img {
    border-radius: 24px;
    /* Rounded logo container if square, or just smooth edges */
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.2);
    /* Subtle glow matching brand */
    margin-bottom: 1.5rem !important;
    transition: transform 0.5s ease;
}

.brand img:hover {
    transform: scale(1.05) rotate(5deg);
}

.auth-title {
    font-size: 2rem;
    color: white;
    font-weight: 700;
    margin-top: 0.5rem;
    letter-spacing: -0.03em;
}

.auth-tagline {
    color: var(--dim-text);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Google Sign-in Button - Premium Style */
.btn-google-pro {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    padding: 1.1rem 1.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    color: white;
    font-size: 1.05rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
}

.btn-google-pro:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(255, 59, 48, 0.35);
    transform: translateY(-2px);
}

.btn-google-pro .btn-google-icon {
    flex-shrink: 0;
}

.flashes {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
}

.flash {
    padding: 1rem;
    border-radius: 16px;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    text-align: center;
    animation: fadeInUp 0.4s ease forwards;
}

.flash.error {
    background: rgba(255, 59, 48, 0.1);
    color: #ff453a;
    border: 1px solid rgba(255, 59, 48, 0.2);
}

.flash.success {
    background: rgba(50, 215, 75, 0.1);
    color: #32d74b;
    border: 1px solid rgba(50, 215, 75, 0.2);
}

/* Form Styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: left;
    /* Keep inputs left-aligned for readability */
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    color: #888;
    font-weight: 500;
    margin-left: 0.5rem;
    /* Align with rounded input */
}

.form-group input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.2rem;
    border-radius: 50px;
    /* Fully rounded inputs */
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.1);
}

.btn-primary.full-width {
    width: 100%;
    border-radius: 50px;
    /* Fully rounded button */
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--primary-color);
    border: none;
    color: white;
    box-shadow: 0 10px 20px rgba(255, 59, 48, 0.3);
    /* Glow effect */
    transition: all 0.3s ease;
}

.btn-primary.full-width:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(255, 59, 48, 0.4);
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #666;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

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

/* User Profile in Header */
.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50px;
    transition: 0.2s;
}

.user-profile-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: white;
}

.user-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Library Grid */
.library-content {
    max-width: 900px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.library-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.2rem;
    transition: 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 180px;
    position: relative;
    overflow: hidden;
}

.library-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
}

.lib-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.lib-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lib-meta {
    font-size: 0.8rem;
    color: var(--dim-text);
}

.lib-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: auto;
    overflow: hidden;
}

.lib-progress-fill {
    height: 100%;
    background: var(--primary-color);
}


.full-width {
    width: 100%;
}

/* Sidebar Layout */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100%;
    background-color: var(--bg-color);
    overflow: hidden;
}

.sidebar {
    width: 320px;
    background: linear-gradient(180deg, #09090d 0%, #10070a 45%, #1a0507 100%);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 1.8rem 1.2rem;
    height: 100%;
    z-index: 10;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 92px;
    padding-left: 0.8rem;
    padding-right: 0.8rem;
}

.sidebar-header {
    margin-bottom: 1.8rem;
    padding: 0 0.5rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header-top {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
}

.sidebar-header .logo {
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--text-color);
    display: inline-block;
}

.sidebar-header .logo .logo-short {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: radial-gradient(circle at 35% 30%, rgba(255, 59, 48, 0.2), rgba(9, 10, 16, 0.9));
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}

.sidebar-header .logo .logo-short img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sidebar-toggle {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #d8e0ed;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}

.sidebar-toggle:hover {
    border-color: rgba(255, 59, 48, 0.45);
    background: rgba(255, 59, 48, 0.12);
}

.sidebar-toggle i,
.sidebar-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.22s ease;
}

.sidebar-toggle:hover .sidebar-toggle-open,
.sidebar-toggle:hover .sidebar-toggle-open svg {
    transform: translateX(-1px) scale(1.08);
}

.sidebar-toggle:hover .sidebar-toggle-closed,
.sidebar-toggle:hover .sidebar-toggle-closed svg {
    transform: translateX(1px) scale(1.08);
}

.sidebar-toggle .sidebar-toggle-closed {
    display: none;
}

.sidebar-greeting {
    margin-top: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-greeting-label {
    display: block;
    font-size: 0.73rem;
    color: #93a1b4;
    line-height: 1.1;
}

.sidebar-greeting-name {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.87rem;
    color: #eef3fb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    flex: 1;
    overflow-y: auto;
    padding-top: 0.3rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.05rem;
    border-radius: 12px;
    color: var(--dim-text);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 1rem;
    border: 1px solid transparent;
    transform: translateX(0);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    transform: translateX(3px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(255, 59, 48, 0.22) 0%, rgba(255, 59, 48, 0.08) 100%);
    color: #ffffff;
    border-color: rgba(255, 59, 48, 0.45);
    box-shadow: inset 4px 0 0 var(--primary-color);
}

.nav-item i,
.nav-item svg {
    width: 19px;
    height: 19px;
    transition: transform 0.24s ease, color 0.24s ease, filter 0.24s ease;
    transform-origin: center;
}

.nav-item:hover i,
.nav-item:hover svg {
    transform: translateX(2px) scale(1.08);
    color: #f3f7ff;
    filter: drop-shadow(0 0 8px rgba(255, 89, 80, 0.28));
}

.nav-item.active i,
.nav-item.active svg {
    transform: scale(1.06);
    color: #ffffff;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding-top: 1.05rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: auto;
    position: relative;
}

.sidebar-collapse-row {
    position: absolute;
    top: -18px;
    right: -17px;
    padding: 0;
    display: block;
}

.nav-item-small {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.8rem;
    border-radius: 6px;
    color: var(--dim-text);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    transform: translateX(0);
}

.nav-item-small:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(3px);
}

.nav-item-small i,
.nav-item-small svg {
    width: 16px;
    height: 16px;
    transition: transform 0.24s ease, color 0.24s ease;
}

.nav-item-small:hover i,
.nav-item-small:hover svg {
    transform: translateX(2px) scale(1.08);
    color: #f3f7ff;
}

.sidebar.collapsed .sidebar-header {
    padding-left: 0;
    padding-right: 0;
}

.sidebar.collapsed .sidebar-header .logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-header .logo .logo-full,
.sidebar.collapsed .sidebar-greeting,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-item-small span {
    display: none;
}

.sidebar.collapsed .sidebar-header .logo .logo-short {
    display: inline-flex;
}

.sidebar.collapsed .sidebar-header-top {
    width: 100%;
    justify-content: center;
}

.sidebar.collapsed .sidebar-toggle .sidebar-toggle-open {
    display: none;
}

.sidebar.collapsed .sidebar-toggle .sidebar-toggle-closed {
    display: inline;
}

.sidebar.collapsed .sidebar-nav {
    align-items: center;
}

.sidebar.collapsed .nav-item {
    width: 100%;
    justify-content: center;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    transform: none;
}

.sidebar.collapsed .nav-item:hover {
    transform: none;
}

.sidebar.collapsed .nav-item:hover i,
.sidebar.collapsed .nav-item:hover svg {
    transform: translateY(-1px) scale(1.1);
}

.sidebar.collapsed .nav-item.active {
    box-shadow: none;
    border-color: rgba(255, 59, 48, 0.55);
}

.sidebar.collapsed .sidebar-footer {
    align-items: center;
    margin-top: auto;
}

.sidebar.collapsed .nav-item-small {
    width: 100%;
    justify-content: center;
    transform: none;
}

.sidebar.collapsed .nav-item-small:hover {
    transform: none;
}

.sidebar.collapsed .sidebar-collapse-row {
    right: -17px;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2.2rem 2.4rem;
    position: relative;
    max-width: 100%;
    margin: 0;
    width: 100%;
    transition: padding 0.3s ease;
}

.app-layout.sidebar-collapsed .main-content {
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Mobile Sidebar logic would go here if needed */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }

    .sidebar-toggle {
        display: none;
    }

    .sidebar-greeting {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        gap: 0.45rem;
        scrollbar-width: thin;
    }

    .nav-item {
        min-width: 54px;
        justify-content: center;
        padding: 0.65rem 0.6rem;
    }

    .nav-item span {
        display: none;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        padding: 0.95rem 0.9rem 1.2rem;
        overflow-x: clip;
    }
}

/* Library Page */
.library-container {
    max-width: 100%;
    margin: 0;
    padding-right: 0;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.45rem;
}

.header-content h1 {
    font-size: clamp(2.2rem, 3vw, 3.4rem);
    letter-spacing: -0.03em;
    line-height: 0.98;
    margin-bottom: 0.45rem;
}

.header-content .text-dim {
    font-size: 1.05rem;
}

.library-add-btn {
    min-width: 170px;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: linear-gradient(180deg, #ffffff 0%, #f2f5fa 100%);
    color: #0a0e15;
    font-weight: 700;
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.3),
        0 8px 18px rgba(255, 59, 48, 0.14),
        0 0 0 1px rgba(255, 255, 255, 0.45) inset;
    transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease, filter 0.24s ease;
    animation: addDocBtnPulse 3.2s ease-in-out infinite;
}

.library-add-btn::before {
    content: "";
    position: absolute;
    inset: -30% auto -30% -80%;
    width: 48%;
    transform: skewX(-18deg);
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.8) 48%,
            rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.library-add-btn::after {
    content: "";
    position: absolute;
    inset: auto -2px -2px -2px;
    height: 42%;
    border-radius: 0 0 12px 12px;
    background: linear-gradient(180deg, rgba(255, 75, 63, 0) 0%, rgba(255, 75, 63, 0.16) 100%);
    z-index: 0;
}

.library-add-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, #ffffff 0%, #f6f8fd 100%);
    border-color: rgba(255, 255, 255, 0.95);
    box-shadow:
        0 16px 32px rgba(0, 0, 0, 0.35),
        0 18px 38px rgba(255, 59, 48, 0.46),
        0 0 34px rgba(255, 59, 48, 0.42),
        0 0 0 3px rgba(255, 59, 48, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.58) inset,
        0 0 28px rgba(255, 90, 80, 0.26);
    filter: saturate(1.03);
    animation-duration: 2.1s;
}

.library-add-btn:hover::before {
    opacity: 1;
    animation: addDocBtnShimmer 0.85s ease;
}

.library-add-btn:active {
    transform: translateY(0);
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.26),
        0 0 0 1px rgba(255, 255, 255, 0.45) inset;
}

.library-add-btn:focus-visible {
    outline: none;
    box-shadow:
        0 12px 26px rgba(0, 0, 0, 0.33),
        0 0 0 3px rgba(255, 59, 48, 0.32),
        0 0 0 1px rgba(255, 255, 255, 0.55) inset;
}

.library-add-btn i {
    width: 17px;
    height: 17px;
    position: relative;
    z-index: 2;
    transition: transform 0.24s ease;
}

.library-add-btn:hover i {
    transform: rotate(90deg) scale(1.08);
}

.library-add-btn span,
.library-add-btn {
    position: relative;
    z-index: 2;
}

@keyframes addDocBtnShimmer {
    0% {
        transform: translateX(0) skewX(-18deg);
    }

    100% {
        transform: translateX(340%) skewX(-18deg);
    }
}

@keyframes addDocBtnPulse {
    0%,
    100% {
        box-shadow:
            0 10px 24px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.45) inset;
    }

    50% {
        box-shadow:
            0 14px 28px rgba(0, 0, 0, 0.34),
            0 0 0 1px rgba(255, 255, 255, 0.54) inset,
            0 0 18px rgba(255, 88, 77, 0.16);
    }
}

@media (prefers-reduced-motion: reduce) {
    .library-add-btn,
    .library-add-btn::before,
    .library-add-btn i {
        animation: none !important;
        transition: none !important;
    }
}

.search-container {
    background: #0b0f15;
    border: 1px solid #1f2732;
    border-radius: 12px;
    padding: 0.95rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.6rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-container:focus-within {
    border-color: rgba(255, 59, 48, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.13);
}

.search-icon {
    color: #747f8f;
    width: 21px;
    height: 21px;
}

.search-input {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.05rem;
    flex: 1;
    outline: none;
    font-family: var(--font-heading);
}

.search-input::placeholder {
    color: #7d8390;
}

.library-filter-row {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.library-filter-search {
    flex: 1 1 320px;
    min-width: 220px;
    height: 40px;
    background: #0b0f15;
    border: 1px solid #1f2732;
    border-radius: 10px;
    padding: 0.4rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.library-filter-select {
    flex: 0 0 190px;
    min-width: 170px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #2a3341;
    background: #0a1018;
    color: #d7deea;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    padding: 0 0.8rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.library-filter-select:focus {
    border-color: rgba(255, 59, 48, 0.45);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

.library-filter-clear {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border-radius: 10px;
    padding: 0 0.95rem;
    text-decoration: none;
    white-space: nowrap;
}

.library-date-custom {
    display: none;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 250px;
    min-width: 220px;
    position: relative;
}

.library-date-custom.visible {
    display: inline-flex;
}

.library-date-picker-btn {
    width: 100%;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #2a3341;
    background: #0a1018;
    color: #d7deea;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    padding: 0 0.8rem;
    outline: none;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.library-date-picker-btn:hover {
    border-color: #3b4758;
    background: #0e1520;
}

.library-date-picker-btn:focus,
.library-date-picker-btn.is-open {
    border-color: rgba(255, 59, 48, 0.45);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

.library-date-picker-proxy {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
}

.flatpickr-calendar.library-calendar-theme {
    background: linear-gradient(180deg, #0b1018 0%, #070b11 100%);
    border: 1px solid #2b3443;
    border-radius: 14px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.52);
    padding: 0.4rem;
}

.flatpickr-calendar.library-calendar-theme .flatpickr-months {
    margin-bottom: 0.2rem;
}

.flatpickr-calendar.library-calendar-theme .flatpickr-month {
    color: #eaf0fa;
    fill: #eaf0fa;
}

.flatpickr-calendar.library-calendar-theme .flatpickr-weekday {
    color: #8f9db3;
    font-weight: 600;
}

.flatpickr-calendar.library-calendar-theme .flatpickr-day {
    color: #d8e0ec;
    border-radius: 9px;
    border-color: transparent;
}

.flatpickr-calendar.library-calendar-theme .flatpickr-day:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: transparent;
}

.flatpickr-calendar.library-calendar-theme .flatpickr-day.today {
    border-color: rgba(255, 59, 48, 0.62);
    color: #ff7c75;
}

.flatpickr-calendar.library-calendar-theme .flatpickr-day.inRange {
    background: rgba(255, 59, 48, 0.2);
    border-color: transparent;
    box-shadow: none;
}

.flatpickr-calendar.library-calendar-theme .flatpickr-day.startRange,
.flatpickr-calendar.library-calendar-theme .flatpickr-day.endRange,
.flatpickr-calendar.library-calendar-theme .flatpickr-day.selected {
    background: linear-gradient(180deg, #ff4a40 0%, #ff3328 100%);
    border-color: #ff3b30;
    color: #ffffff;
}

.flatpickr-calendar.library-calendar-theme .flatpickr-prev-month,
.flatpickr-calendar.library-calendar-theme .flatpickr-next-month {
    fill: #9aa7ba;
}

.flatpickr-calendar.library-calendar-theme .flatpickr-prev-month:hover,
.flatpickr-calendar.library-calendar-theme .flatpickr-next-month:hover {
    fill: #ffffff;
}

.flatpickr-calendar.library-calendar-theme .numInputWrapper span {
    border-color: rgba(255, 255, 255, 0.12);
}

.flatpickr-calendar.library-calendar-theme .numInputWrapper span:hover {
    background: rgba(255, 255, 255, 0.12);
}

.library-date-input {
    height: 40px;
    border-radius: 10px;
    border: 1px solid #2a3341;
    background: #0a1018;
    color: #d7deea;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    padding: 0 0.7rem;
    outline: none;
}

.library-date-input:focus {
    border-color: rgba(255, 59, 48, 0.45);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

.library-date-sep {
    color: #8b93a2;
    font-size: 0.88rem;
}

.documents-shell {
    background: #080c12;
    border: 1px solid #222933;
    border-radius: 18px;
    min-height: 250px;
    padding: 1rem;
}

/* Document Grid - Switched to List/Horizontal Layout */
.document-grid {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

.doc-card {
    background: #05080f;
    border: 1px solid #252d39;
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.2s ease, background 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0.85rem 1rem;
    gap: 0.9rem;
    cursor: pointer;
}

.doc-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: #080d15;
}

.doc-preview {
    height: 76px;
    width: 76px;
    background:
        radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02) 48%, rgba(0, 0, 0, 0.5) 72%),
        linear-gradient(145deg, #151a22 0%, #0f141c 65%, #131923 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid #2b3443;
    flex-shrink: 0;
}

.doc-icon i {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.5);
}

.doc-info {
    flex: 1;
    min-width: 0;
    max-width: 55%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.28rem;
}

.doc-title {
    font-size: 0.97rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #f0f3f7;
    margin: 0;
}

.doc-side-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    margin-left: auto;
}

.doc-badges {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
}

.doc-delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: #525d6e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    flex-shrink: 0;
}

.doc-delete-btn i {
    width: 13px;
    height: 13px;
}

.doc-delete-btn:hover {
    border-color: rgba(255, 59, 48, 0.5);
    color: #ff6b63;
    background: rgba(255, 59, 48, 0.1);
}

.doc-delete-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.doc-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.58rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.doc-status-badge.completed {
    color: #073b1f;
    background: #24d97b;
}

.doc-status-badge.in-progress {
    color: #ffd6a8;
    background: linear-gradient(180deg, rgba(255, 159, 67, 0.28) 0%, rgba(255, 123, 47, 0.2) 100%);
    border: 1px solid rgba(255, 153, 74, 0.5);
    box-shadow: inset 0 0 0 1px rgba(255, 194, 128, 0.15);
}

.doc-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.58rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid rgba(106, 125, 153, 0.45);
    color: #b8c6dd;
    background: rgba(89, 102, 121, 0.2);
}

.doc-type-badge.url {
    border-color: rgba(68, 156, 255, 0.45);
    color: #87c8ff;
    background: rgba(40, 114, 194, 0.2);
}

.doc-type-badge.file {
    border-color: rgba(167, 126, 255, 0.48);
    color: #c2a8ff;
    background: rgba(99, 69, 173, 0.24);
}

.doc-type-badge.text {
    border-color: rgba(255, 173, 72, 0.42);
    color: #ffc98b;
    background: rgba(167, 103, 28, 0.24);
}

.doc-meta {
    font-size: 0.82rem;
    color: #6b7585;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.doc-dot {
    opacity: 0.4;
}

.empty-state {
    width: 100%;
    text-align: center;
    min-height: 210px;
    padding: 3.5rem 1.8rem;
    background: #0b1018;
    border-radius: 14px;
    border: 1px dashed #2a3340;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-icon {
    width: 48px;
    height: 48px;
    color: #727b89;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-state h3 {
    font-size: clamp(1.4rem, 1.8vw, 1.9rem);
    color: #e8ecf2;
}

.empty-state p {
    margin-top: 0.35rem;
    color: #8791a0;
    font-size: 1.05rem;
}

.library-pagination {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.55rem;
}

.page-btn,
.page-number {
    min-width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid #2a3443;
    background: #0a1018;
    color: #d2d9e5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0 0.8rem;
    transition: all 0.2s ease;
}

.page-btn:hover,
.page-number:hover {
    border-color: rgba(255, 59, 48, 0.55);
    color: #fff;
    background: rgba(255, 59, 48, 0.12);
}

.page-number.active {
    border-color: rgba(255, 59, 48, 0.55);
    background: rgba(255, 59, 48, 0.18);
    color: #fff;
}

.page-btn.disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.page-size-control {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: 0.25rem;
    padding: 0.2rem 0.25rem 0.2rem 0.5rem;
    border-radius: 10px;
    border: 1px solid #2a3443;
    background: #0a1018;
}

.page-size-control label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #9aa8bd;
    white-space: nowrap;
}

.page-size-select {
    height: 32px;
    border-radius: 8px;
    border: 1px solid #313b4b;
    background: #101825;
    color: #d7deea;
    font-family: var(--font-heading);
    font-size: 0.84rem;
    font-weight: 600;
    padding: 0 0.55rem;
    outline: none;
    cursor: pointer;
}

.page-size-select:focus {
    border-color: rgba(255, 59, 48, 0.45);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

@media (max-width: 1100px) {
    .sidebar {
        width: 280px;
    }

    .main-content {
        padding: 1.8rem;
    }
}

@media (max-width: 900px) {
    .library-header {
        flex-direction: column;
        gap: 1rem;
    }

    .library-add-btn {
        width: 100%;
    }

    .doc-card {
        padding: 0.75rem 0.85rem;
        gap: 0.7rem;
    }

    .doc-preview {
        width: 62px;
        height: 62px;
    }

    .doc-info {
        max-width: 45%;
    }

    .doc-meta {
        font-size: 0.75rem;
    }

    .doc-side-actions {
        gap: 0.35rem;
    }

    .library-filter-row {
        align-items: stretch;
    }

    .library-filter-search,
    .library-filter-select,
    .library-date-custom {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

    .library-pagination {
        justify-content: flex-start;
    }

    .page-size-control {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }

    .page-size-select {
        flex: 1;
        max-width: 120px;
    }

    .library-date-input {
        flex: 1;
        min-width: 0;
    }
}

/* Modal specific overrides/additions */
.add-doc-modal-content {
    width: min(92vw, 920px);
    max-width: 920px;
    padding: 2.2rem;
    border-radius: 28px;
    background: linear-gradient(180deg, #090b10 0%, #05070c 100%);
    border: 1px solid rgba(255, 255, 255, 0.09);
}

.add-doc-modal-content h2 {
    font-size: clamp(2rem, 2.6vw, 3rem);
    margin-bottom: 1.4rem;
    letter-spacing: -0.02em;
}

.add-doc-modal-content .close-modal {
    top: 1.2rem;
    right: 1.3rem;
    font-size: 2.2rem;
}

.add-doc-tabs {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    margin-bottom: 1.3rem;
}

/* Custom delete confirmation modal */
.delete-confirm-content {
    width: min(92vw, 460px);
    max-width: 460px;
    padding: 1.65rem 1.5rem 1.35rem;
    border-radius: 20px;
    background: linear-gradient(180deg, #0c0f15 0%, #090c11 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
}

.delete-confirm-close {
    position: absolute;
    top: 0.65rem;
    right: 0.85rem;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.03);
    color: #d2d8e2;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.delete-confirm-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(255, 59, 48, 0.35);
    background: rgba(255, 59, 48, 0.15);
    color: #ff7a73;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.95rem;
}

.delete-confirm-icon i {
    width: 19px;
    height: 19px;
}

.delete-confirm-content h3 {
    font-size: 1.25rem;
    letter-spacing: -0.015em;
    margin-bottom: 0.5rem;
}

.delete-confirm-content p {
    color: #9aa5b8;
    line-height: 1.55;
}

.delete-confirm-actions {
    margin-top: 1.2rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
}

.delete-confirm-actions .btn-secondary {
    min-width: 95px;
}

.delete-danger-btn {
    min-width: 165px;
    background: linear-gradient(180deg, #ff4f47 0%, #f33027 100%);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(255, 59, 48, 0.25);
}

.delete-danger-btn:hover {
    background: linear-gradient(180deg, #ff6159 0%, #ff3b30 100%);
}

.add-doc-tab-btn {
    border: none;
    background: transparent;
    color: #8b93a2;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.72rem 1.35rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.22s ease;
}

.add-doc-tab-btn:hover {
    color: #d9deea;
    background: rgba(255, 255, 255, 0.06);
}

.add-doc-tab-btn.active {
    color: #ffffff;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.07) 100%);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.add-doc-tab-content {
    display: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.25rem;
}

.add-doc-tab-content.active {
    display: block;
}

.add-doc-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.source-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--dim-text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pill i {
    width: 14px;
    height: 14px;
}

.add-doc-form .input-field,
.add-doc-form .textarea-field {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    padding: 1.05rem 1.1rem;
    border-radius: 14px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    transition: 0.2s;
}

.add-doc-form .input-field:focus,
.add-doc-form .textarea-field:focus {
    border-color: var(--primary-color);
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.12);
}

.add-doc-form .textarea-field {
    min-height: 220px;
    resize: vertical;
}

.add-doc-submit-btn,
.add-doc-save-btn {
    margin-top: 0.5rem;
}

.add-doc-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-top: 0.5rem;
}

.input-group {
    display: flex;
    gap: 0.7rem;
    align-items: center;
}

.input-icon {
    width: 18px;
    height: 18px;
    color: #8b93a2;
    margin-left: 0.2rem;
}

.input-group .input-field {
    flex: 1;
}

.add-doc-extraction-preview {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.55rem;
}

.add-doc-inline-status {
    margin-top: 0.7rem;
    border-radius: 11px;
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.add-doc-inline-status.is-error {
    color: #ffc7c4;
    background: rgba(255, 59, 48, 0.12);
    border-color: rgba(255, 59, 48, 0.38);
}

.add-doc-inline-status.is-success {
    color: #c2f6da;
    background: rgba(36, 217, 123, 0.1);
    border-color: rgba(36, 217, 123, 0.34);
}

.add-doc-inline-status.is-info {
    color: #d0dcff;
    background: rgba(79, 129, 255, 0.12);
    border-color: rgba(79, 129, 255, 0.36);
}

.spinner {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.add-doc-source-pills {
    margin-top: 0.45rem;
}

.preview-text-box {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    max-height: 100px;
    overflow-y: auto;
}

.add-doc-upload-zone {
    min-height: 250px;
    border-radius: 16px;
    border-color: rgba(255, 255, 255, 0.14);
}

@media (max-width: 760px) {
    .add-doc-modal-content {
        padding: 1.25rem;
        border-radius: 22px;
    }

    .add-doc-tabs {
        width: 100%;
        justify-content: space-between;
    }

    .add-doc-tab-btn {
        flex: 1;
        padding: 0.66rem 0.8rem;
        font-size: 0.95rem;
        text-align: center;
    }

    .add-doc-form .textarea-field {
        min-height: 170px;
    }

    .add-doc-actions {
        grid-template-columns: 1fr;
    }
}

/* Reader focus mode for /read/<doc_id> sessions */
body.document-reading-mode .input-section {
    display: none;
}

.exit-reading-btn {
    position: fixed;
    top: 18px;
    right: 20px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(10, 10, 10, 0.72);
    color: #f2f2f2;
    text-decoration: none;
    font-size: 1.7rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.exit-reading-btn:hover {
    background: rgba(255, 59, 48, 0.16);
    border-color: rgba(255, 59, 48, 0.6);
    color: #ffffff;
}

body.document-reading-mode header {
    display: none;
}

body.document-reading-mode main {
    min-height: 100vh;
    justify-content: center;
    align-items: center;
    gap: 2.1rem;
    padding: 2rem 1rem 2.2rem;
}

body.document-reading-mode .reader-display {
    flex: 0 0 auto;
    width: min(980px, 92vw);
    height: min(56vh, 620px);
    min-height: 320px;
    border: none;
    box-shadow: none;
    background:
        radial-gradient(120% 90% at 50% 50%, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0) 60%),
        transparent;
}

body.document-reading-mode .reader-display::before {
    top: calc(50% - 92px);
    height: 30px;
    opacity: 0.9;
}

body.document-reading-mode .reader-display::after {
    bottom: calc(50% - 92px);
    height: 30px;
    opacity: 0.9;
}

body.document-reading-mode .word-container {
    max-width: min(900px, 92vw);
    position: relative;
}

body.document-reading-mode .word-container::before,
body.document-reading-mode .word-container::after {
    display: none;
}

body.document-reading-mode .word-container::before {
    display: none;
}

body.document-reading-mode .word-container::after {
    display: none;
}

body.document-reading-mode .controls-container {
    width: min(660px, 92vw);
    min-height: auto;
    padding: 0.2rem 0;
    background: transparent;
    border: none;
    backdrop-filter: none;
}

body.document-reading-mode .settings-group.full-width {
    width: 100%;
    justify-content: center;
}

body.document-reading-mode .main-controls-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(620px, 92vw);
    margin: 0 auto;
    gap: 0.72rem;
    padding: 0;
    transition: opacity 0.42s ease, transform 0.42s ease, filter 0.42s ease;
}

body.document-reading-mode .main-controls-row>div:first-child {
    display: none;
}

body.document-reading-mode .playback-controls {
    position: static;
    transform: none;
    order: 1;
    min-width: min(420px, 92vw);
    justify-content: center;
    gap: 0.88rem;
}

body.document-reading-mode .playback-controls .control-btn {
    width: 54px;
    height: 54px;
    background: radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f3f6ff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 26px rgba(0, 0, 0, 0.28);
}

body.document-reading-mode .playback-controls .control-btn:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.24);
    background: radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03));
}

body.document-reading-mode .playback-controls .control-btn.big-play {
    width: 82px;
    height: 82px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(7, 9, 13, 0.7);
    color: #ffffff;
    animation: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 14px 36px rgba(0, 0, 0, 0.45);
}

body.document-reading-mode .playback-controls .control-btn.big-play:hover {
    border-color: rgba(255, 59, 48, 0.72);
    box-shadow: 0 14px 36px rgba(255, 59, 48, 0.2);
    transform: translateY(-2px) scale(1.04);
}

body.document-reading-mode .focus-settings-btn svg {
    transition: transform 0.35s ease;
}

body.document-reading-mode .focus-settings-btn:hover svg {
    transform: rotate(30deg);
}

body.document-reading-mode .wpm-control-container {
    order: 2;
    margin-left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
}

body.document-reading-mode .wpm-control-group {
    min-width: 320px;
    justify-content: space-between;
    padding: 0.66rem 0.95rem;
    border-radius: 16px;
    border-color: rgba(255, 255, 255, 0.16);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
        rgba(9, 11, 16, 0.6);
}

body.document-reading-mode .wpm-step-btn {
    width: 34px;
    height: 34px;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #f3f6ff;
}

body.document-reading-mode .wpm-label {
    min-width: 42px;
    color: rgba(228, 233, 245, 0.54);
    letter-spacing: 0.1em;
}

body.document-reading-mode #wpmDisplay {
    min-width: 3.8ch;
    color: #ffffff;
    font-size: 1.12rem;
}

body.document-reading-mode.reading-active .main-controls-row {
    opacity: 0.26;
    transform: translateY(10px) scale(0.98);
    filter: saturate(0.82);
}

body.document-reading-mode.reading-active .main-controls-row:hover {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: none;
}

body.document-reading-mode .progress-control {
    width: min(620px, 92vw);
    margin: 0 auto;
    gap: 0.35rem;
    padding-bottom: 0.38rem;
}

body.document-reading-mode .progress-control input[type="range"] {
    order: 2;
}

body.document-reading-mode .progress-stats {
    order: 1;
    margin-top: 0;
    margin-bottom: 0.28rem;
    font-size: 1.03rem;
    color: rgba(231, 236, 248, 0.72);
}

body.document-reading-mode .progress-stats .stat-item:first-child {
    color: rgba(231, 236, 248, 0.6);
}

body.document-reading-mode .time-stat {
    font-weight: 600;
}

@media (max-width: 700px) {
    .reader-display::before {
        top: calc(50% - 96px);
    }

    .reader-display::after {
        bottom: calc(50% - 96px);
    }

    body.document-reading-mode .reader-display {
        min-height: 250px;
    }

    body.document-reading-mode .controls-container {
        width: 94vw;
    }

    body.document-reading-mode .word-container::before,
    body.document-reading-mode .word-container::after {
        display: none;
    }

    body.document-reading-mode .word-container::before {
        display: none;
    }

    body.document-reading-mode .word-container::after {
        display: none;
    }
}

/* Billing Page */
.billing-container {
    max-width: 900px;
    margin: 0 auto;
}

.billing-header {
    margin-bottom: 2rem;
}

.billing-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.billing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.billing-card {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.current-plan {
    border-top: 4px solid var(--dim-text);
}

.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 1rem;
}

.badge-free {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.badge-premium {
    background: rgba(255, 59, 48, 0.15);
    color: var(--primary-color);
}

.upgrade-card {
    border-color: rgba(255, 59, 48, 0.3);
    background: linear-gradient(180deg, rgba(255, 59, 48, 0.05) 0%, rgba(20, 20, 20, 0) 100%);
}

.upgrade-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.price {
    display: flex;
    align-items: baseline;
}

.currency {
    font-size: 1.2rem;
    font-weight: 600;
}

.amount {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.period {
    color: var(--dim-text);
    margin-left: 0.2rem;
}

.feature-list {
    list-style: none;
    margin-bottom: 2rem;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
    color: var(--text-color);
}

.feature-list li i {
    color: var(--primary-color);
    width: 18px;
    height: 18px;
}

.billing-history h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.history-list {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

/* FAQ Page */
.faq-page {
    width: min(1220px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-layout.sidebar-collapsed .faq-page {
    width: 100%;
    max-width: none;
}

.faq-hero-card {
    background:
        radial-gradient(circle at 86% -20%, rgba(255, 59, 48, 0.14), rgba(255, 59, 48, 0) 42%),
        linear-gradient(180deg, #0d1118 0%, #080c12 100%);
    border: 1px solid #273140;
    border-radius: 18px;
    padding: 1.28rem 1.32rem 1.2rem;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.9fr);
    align-items: end;
    gap: 1rem;
}

.faq-hero-card h1 {
    font-size: clamp(1.8rem, 3vw, 2.55rem);
    letter-spacing: -0.02em;
    margin-bottom: 0.45rem;
}

.faq-pill-row {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    justify-content: flex-end;
    align-content: flex-start;
}

.faq-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.35rem 0.7rem;
    color: #d8e1ee;
    font-size: 0.82rem;
    font-weight: 600;
}

.faq-pill i {
    width: 14px;
    height: 14px;
    color: #ff6b62;
}

.faq-insight-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.95rem;
}

.faq-insight-card {
    background: linear-gradient(180deg, #09101a 0%, #070d16 100%);
    border: 1px solid #243041;
    border-radius: 14px;
    padding: 1rem 1rem 1.08rem;
    min-height: 182px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.faq-insight-card:hover {
    transform: translateY(-1px);
    border-color: #34465f;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.26);
}

.faq-insight-card h3 {
    font-size: 1rem;
    margin-bottom: 0.45rem;
    letter-spacing: -0.01em;
}

.faq-insight-card p {
    color: #9ea9bc;
    line-height: 1.55;
    font-size: 0.92rem;
}

.faq-accordion-panel {
    background: linear-gradient(180deg, #080c13 0%, #060b11 100%);
    border: 1px solid #222e3c;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.faq-item {
    border-bottom: 1px solid #1d2530;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item summary {
    list-style: none;
    cursor: pointer;
    padding: 1rem 1.1rem;
    color: #edf2fb;
    font-weight: 600;
    font-size: 0.98rem;
    position: relative;
    padding-right: 2.3rem;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 1.05rem;
    top: 50%;
    transform: translateY(-50%);
    color: #ff7f77;
    font-size: 1.15rem;
    line-height: 1;
}

.faq-item[open] summary {
    background: rgba(255, 59, 48, 0.08);
}

.faq-item[open] summary::after {
    content: "−";
}

.faq-answer {
    padding: 0.05rem 1.1rem 1rem;
}

.faq-answer p,
.faq-answer li {
    color: #a0acbe;
    line-height: 1.6;
    font-size: 0.93rem;
}

.faq-answer ul {
    padding-left: 1rem;
}

.faq-note-card {
    border-radius: 14px;
    border: 1px solid #2f2832;
    background: linear-gradient(180deg, rgba(255, 59, 48, 0.08) 0%, rgba(255, 59, 48, 0.03) 100%);
    padding: 1rem 1.1rem;
}

.faq-note-card h3 {
    margin-bottom: 0.35rem;
    letter-spacing: -0.01em;
}

@media (max-width: 950px) {
    .faq-hero-card {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .faq-pill-row {
        justify-content: flex-start;
    }

    .faq-insight-grid {
        grid-template-columns: 1fr;
    }

    .faq-insight-card {
        min-height: 0;
    }
}

/* Profile V2 */
.profile-v2-page {
    width: min(1180px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.app-layout.sidebar-collapsed .profile-v2-page {
    width: 100%;
    max-width: none;
}

.profile-v2-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid #243244;
    border-radius: 16px;
    background: linear-gradient(180deg, #0a1019 0%, #070d16 100%);
}

.profile-v2-hero h1 {
    font-size: clamp(2rem, 2.8vw, 3rem);
    line-height: 0.98;
    letter-spacing: -0.03em;
    margin-bottom: 0.3rem;
}

.profile-v2-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 1px solid rgba(255, 59, 48, 0.45);
    background: radial-gradient(circle at 30% 25%, rgba(255, 59, 48, 0.3), rgba(255, 59, 48, 0.08) 65%, rgba(255, 59, 48, 0.02));
    box-shadow: 0 10px 26px rgba(255, 59, 48, 0.24);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-v2-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 0.8rem;
}

.profile-v2-panel {
    border: 1px solid #223042;
    border-radius: 16px;
    padding: 1rem;
    background: linear-gradient(180deg, #0a1019 0%, #070d16 100%);
}

.profile-v2-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.profile-v2-form {
    margin-top: 0.75rem;
    display: grid;
    gap: 0.55rem;
}

.profile-v2-form label {
    color: #99a8be;
    font-size: 0.84rem;
    font-weight: 600;
}

.profile-v2-form input {
    height: 44px;
    border-radius: 11px;
    border: 1px solid #2a3544;
    background: #0b1220;
    color: #e8eef8;
    font-family: var(--font-heading);
    font-size: 0.94rem;
    padding: 0 0.85rem;
    outline: none;
}

.profile-v2-form input:focus {
    border-color: rgba(255, 59, 48, 0.45);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

.profile-v2-form input[readonly] {
    background: #0b1018;
    color: #9aa7bb;
    border-color: #223041;
    cursor: not-allowed;
}

.profile-v2-form small {
    margin-top: -0.12rem;
    color: #8796ab;
    font-size: 0.78rem;
}

.profile-v2-save-btn {
    margin-top: 0.4rem;
    height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(255, 84, 74, 0.42);
    background: linear-gradient(90deg, rgba(255, 84, 74, 0.86) 0%, rgba(255, 59, 48, 0.96) 100%);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.96rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    box-shadow: 0 14px 28px rgba(255, 59, 48, 0.24);
}

.profile-v2-save-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 18px 30px rgba(255, 59, 48, 0.3);
}

.profile-v2-meta-list {
    margin-top: 0.75rem;
    display: grid;
    gap: 0.55rem;
}

.profile-v2-meta-item {
    border: 1px solid #1f2b3a;
    border-radius: 12px;
    background: #070d15;
    padding: 0.72rem 0.78rem;
    display: grid;
    gap: 0.22rem;
}

.profile-v2-meta-item span {
    font-size: 0.78rem;
    color: #8f9db1;
}

.profile-v2-meta-item strong {
    color: #ecf1f9;
    font-size: 0.92rem;
}

.profile-v2-meta-item strong.mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    word-break: break-all;
}

@media (max-width: 980px) {
    .profile-v2-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .profile-v2-hero {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Stats V2 */
.stats-v2-page {
    width: min(1320px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    min-width: 0;
    overflow-x: clip;
}

.app-layout.sidebar-collapsed .stats-v2-page {
    width: 100%;
    max-width: none;
}

.stats-v2-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stats-v2-header h1 {
    font-size: clamp(2rem, 3vw, 3.2rem);
    line-height: 0.98;
    letter-spacing: -0.03em;
    margin-bottom: 0.35rem;
}

.stats-v2-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    background: #080d14;
    border: 1px solid #222d3b;
    border-radius: 14px;
    padding: 0.62rem;
    min-width: 0;
}

.stats-v2-filter-bar>* {
    min-width: 0;
}

.stats-v2-select,
.stats-v2-date-input {
    height: 40px;
    border-radius: 10px;
    border: 1px solid #2a3544;
    background: #0b1220;
    color: #d9e1ee;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    padding: 0 0.8rem;
    outline: none;
}

.stats-v2-select:focus,
.stats-v2-date-input:focus {
    border-color: rgba(255, 59, 48, 0.45);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

.stats-v2-custom-dates {
    display: none;
    align-items: center;
    gap: 0.45rem;
}

.stats-v2-custom-dates.visible {
    display: inline-flex;
}

.stats-v2-custom-dates span {
    color: #8c98aa;
    font-size: 0.9rem;
}

.stats-v2-compare-note {
    font-size: 0.9rem;
    color: #8e9cb1;
    margin-left: 0.15rem;
}

.stats-v2-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.7rem;
    min-width: 0;
    align-items: stretch;
}

.stats-v2-kpi-card {
    background: linear-gradient(180deg, #0a1019 0%, #070d16 100%);
    border: 1px solid #233041;
    border-radius: 14px;
    padding: 0.9rem 0.92rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    min-height: 132px;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.stats-v2-kpi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    color: #95a2b8;
    font-size: 0.78rem;
    font-weight: 600;
    min-height: 20px;
}

.stats-v2-kpi-head span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-v2-kpi-head i {
    width: 15px;
    height: 15px;
    color: #ff7f77;
}

.stats-v2-kpi-value {
    margin-top: 0.55rem;
    font-size: clamp(1.22rem, 1.8vw, 1.56rem);
    line-height: 1;
    font-weight: 700;
    color: #f2f6fd;
    display: flex;
    align-items: flex-end;
    min-height: 44px;
}

.stats-v2-kpi-delta {
    margin-top: 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.stats-v2-kpi-delta.up {
    color: #3fe087;
}

.stats-v2-kpi-delta.down {
    color: #ff7b73;
}

.stats-v2-kpi-delta.neutral {
    color: #95a2b8;
}

.stats-v2-secondary-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.7rem;
    min-width: 0;
    align-items: stretch;
}

.stats-v2-secondary-card {
    background: linear-gradient(180deg, #0a1019 0%, #070d16 100%);
    border: 1px solid #233041;
    border-radius: 14px;
    padding: 0.9rem 0.92rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    min-height: 132px;
    display: grid;
    grid-template-rows: auto 1fr;
}

.stats-v2-secondary-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    color: #95a2b8;
    font-size: 0.78rem;
    font-weight: 600;
    min-height: 20px;
}

.stats-v2-secondary-label span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-v2-secondary-label i {
    width: 15px;
    height: 15px;
    color: #ff7f77;
}

.stats-v2-secondary-card strong {
    margin-top: 0.55rem;
    font-size: clamp(1.22rem, 1.8vw, 1.56rem);
    line-height: 1;
    font-weight: 700;
    color: #f2f6fd;
    display: flex;
    align-items: flex-end;
    min-height: 44px;
}

.stats-v2-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    gap: 0.7rem;
    min-width: 0;
}

.stats-v2-panel {
    background: linear-gradient(180deg, #0a1019 0%, #070d16 100%);
    border: 1px solid #223042;
    border-radius: 16px;
    padding: 0.95rem;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.stats-v2-panel-head {
    margin-bottom: 0.75rem;
}

.stats-v2-panel-head h3 {
    font-size: 1.08rem;
    letter-spacing: -0.01em;
    margin-bottom: 0.2rem;
}

.stats-v2-chart-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.stats-v2-chart-wrap-lg {
    height: 300px;
}

.stats-v2-chart-wrap-md {
    height: 260px;
}

.stats-v2-chart-wrap canvas {
    width: 100%;
    height: 100%;
    max-width: 100%;
    display: block;
}

.stats-v2-chart-empty {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #93a2b6;
    font-size: 0.9rem;
    background: radial-gradient(circle at center, rgba(8, 16, 26, 0.55) 0%, rgba(8, 16, 26, 0.9) 72%);
    border: 1px dashed #2a3748;
    border-radius: 12px;
    padding: 0.9rem;
}

.stats-v2-top-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.stats-v2-top-item {
    border: 1px solid #202c3a;
    border-radius: 12px;
    background: #070d15;
    padding: 0.75rem;
}

.stats-v2-top-main h4 {
    color: #f1f5fc;
    font-size: 0.98rem;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-v2-top-meta {
    margin-top: 0.3rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    color: #93a1b6;
    font-size: 0.82rem;
}

.stats-v2-top-meta .source {
    border-radius: 999px;
    padding: 0.14rem 0.46rem;
    border: 1px solid rgba(122, 138, 160, 0.45);
    background: rgba(108, 124, 147, 0.18);
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    font-weight: 700;
}

.stats-v2-top-meta .source.text {
    border-color: rgba(255, 173, 72, 0.42);
    color: #ffc98b;
    background: rgba(167, 103, 28, 0.24);
}

.stats-v2-top-meta .source.url {
    border-color: rgba(68, 156, 255, 0.45);
    color: #87c8ff;
    background: rgba(40, 114, 194, 0.2);
}

.stats-v2-top-meta .source.file {
    border-color: rgba(167, 126, 255, 0.48);
    color: #c2a8ff;
    background: rgba(99, 69, 173, 0.24);
}

.stats-v2-mini-progress {
    margin-top: 0.5rem;
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.stats-v2-mini-progress span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff3b30 0%, #ff726b 100%);
}

.stats-v2-empty {
    min-height: 230px;
    border-radius: 12px;
    border: 1px dashed #293648;
    background: #080f17;
    color: #91a0b5;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
}

.stats-v2-export-btn,
.stats-v2-clear-btn {
    height: 40px;
    border-radius: 10px;
    border: 1px solid #343f50;
    color: #dde4f0;
    background: #151d2a;
    padding: 0 0.9rem;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
}

.stats-v2-clear-btn:hover {
    border-color: rgba(255, 59, 48, 0.45);
    background: rgba(255, 59, 48, 0.12);
}

.stats-v2-export-btn {
    margin-left: auto;
    border-color: rgba(255, 95, 86, 0.42);
    background: linear-gradient(180deg, rgba(255, 90, 80, 0.2) 0%, rgba(255, 70, 60, 0.12) 100%);
}

.stats-v2-export-btn:hover {
    border-color: rgba(255, 95, 86, 0.64);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

@media (max-width: 1280px) {
    .stats-v2-kpi-grid,
    .stats-v2-secondary-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .stats-v2-chart-wrap-lg {
        height: 270px;
    }

    .stats-v2-chart-wrap-md {
        height: 235px;
    }
}

@media (max-width: 980px) {
    .stats-v2-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stats-v2-secondary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stats-v2-chart-grid {
        grid-template-columns: 1fr;
    }

    .stats-v2-chart-wrap-lg,
    .stats-v2-chart-wrap-md {
        height: 240px;
    }
}

@media (max-width: 720px) {
    .stats-v2-kpi-grid,
    .stats-v2-secondary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-v2-filter-bar {
        align-items: stretch;
    }

    .stats-v2-select,
    .stats-v2-custom-dates,
    .stats-v2-export-btn,
    .stats-v2-clear-btn {
        width: 100%;
    }

    .stats-v2-custom-dates {
        flex-wrap: wrap;
    }

    .stats-v2-date-input {
        flex: 1;
        min-width: 150px;
    }

    .stats-v2-clear-btn {
        justify-content: center;
        margin-left: 0;
    }

    .stats-v2-export-btn {
        justify-content: center;
        margin-left: 0;
    }

    .stats-v2-chart-wrap-lg,
    .stats-v2-chart-wrap-md {
        height: 220px;
    }
}

@media (max-width: 520px) {
    .stats-v2-kpi-grid,
    .stats-v2-secondary-grid {
        grid-template-columns: 1fr;
    }

    .stats-v2-kpi-card,
    .stats-v2-secondary-card {
        min-height: 118px;
    }
}
