/**
 * MODE SELECTOR CSS
 * =================
 * Styles for the navigation-based mode selector in the Bible header.
 * 
 * Modes:
 * - Notes Mode (default, pen icon) - green
 * - Reader Mode (book icon) - purple
 * - Biblia AI Mode (sparkles icon) - orange
 */

/* ==========================================
   HIDE OLD FLOATING BUTTON (replaced by nav selector)
   ========================================== */

.mode-toggle-btn-standalone,
.mode-options-radial,
.mode-selector-overlay {
    display: none !important;
}

/* ==========================================
   SEGMENTED CONTROL MODE SWITCHER
   ========================================== */

.mode-switcher {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 12px;
}

/* Hide on mobile — mobile has its own mode handling */
@media (max-width: 768px) {
    .mode-switcher {
        display: none !important;
    }
}

.mode-switcher-track {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 999px;
    padding: 3px;
}

/* Sliding indicator — left & width set dynamically by JS */
.mode-switcher-indicator {
    position: absolute;
    top: 3px;
    height: calc(100% - 6px);
    background: #dcfce7;
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), 0 0.5px 1.5px rgba(0, 0, 0, 0.06);
    transition: left 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
        width 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
        background-color 0.3s ease;
    z-index: 0;
    will-change: left, width;
}

/* Indicator colors per active mode */
.mode-switcher-indicator[data-active-mode="notes"] {
    background: #dcfce7;
}
.mode-switcher-indicator[data-active-mode="reader"] {
    background: #e2e8f0;
}
.mode-switcher-indicator[data-active-mode="ai"] {
    background: #ede9fe;
}
.mode-switcher-indicator[data-active-mode="fathers"] {
    background: #fef3c7;
}

/* Segment buttons */
.mode-switcher-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 14px;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 12.5px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.15s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* Label text: smooth collapse/expand — inactive hides, active shows */
.mode-switcher-btn span {
    display: inline-block;
    max-width: 0;
    overflow: hidden;
    transition: max-width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.25s ease,
                margin-left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    margin-left: -5px;
}

.mode-switcher-btn.active span {
    max-width: 60px;
    opacity: 1;
    margin-left: 0;
}

/* Remove focus outline (black box) on click */
.mode-switcher-btn:focus,
.mode-switcher-btn:focus-visible {
    outline: none;
    box-shadow: none;
}

.mode-switcher-btn:hover {
    color: #6b7280;
}

.mode-switcher-btn:active {
    transform: scale(0.97);
}

.mode-switcher-btn.active {
    color: #111827;
    font-weight: 600;
}

.mode-switcher-btn svg {
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.mode-switcher-btn.active svg {
    opacity: 1;
}

/* Active state accent colors */
.mode-switcher-btn.active[data-mode="notes"] {
    color: #059669;
}

.mode-switcher-btn.active[data-mode="notes"] svg {
    stroke: #059669;
}

.mode-switcher-btn.active[data-mode="reader"] {
    color: #475569;
}

.mode-switcher-btn.active[data-mode="reader"] svg {
    stroke: #475569;
}

.mode-switcher-btn.active[data-mode="ai"] {
    color: #7c3aed;
}

.mode-switcher-btn.active[data-mode="ai"] svg {
    stroke: #7c3aed;
}

.mode-switcher-btn.active[data-mode="fathers"] {
    color: #b8860b;
}

.mode-switcher-btn.active[data-mode="fathers"] svg {
    stroke: #b8860b;
}

/* Dark mode */
[data-theme="dark"] .mode-switcher-track {
    background: rgba(255, 255, 255, 0.07);
}

[data-theme="dark"] .mode-switcher-indicator {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .mode-switcher-indicator[data-active-mode="notes"] {
    background: rgba(5, 150, 105, 0.2);
}
[data-theme="dark"] .mode-switcher-indicator[data-active-mode="reader"] {
    background: rgba(148, 163, 184, 0.15);
}
[data-theme="dark"] .mode-switcher-indicator[data-active-mode="ai"] {
    background: rgba(124, 58, 237, 0.2);
}
[data-theme="dark"] .mode-switcher-indicator[data-active-mode="fathers"] {
    background: rgba(184, 134, 11, 0.2);
}

[data-theme="dark"] .mode-switcher-btn {
    color: #6b7280;
}

[data-theme="dark"] .mode-switcher-btn:hover {
    color: #9ca3af;
}

[data-theme="dark"] .mode-switcher-btn.active {
    color: #f3f4f6;
}

[data-theme="dark"] .mode-switcher-btn.active[data-mode="notes"] {
    color: #34d399;
}

[data-theme="dark"] .mode-switcher-btn.active[data-mode="notes"] svg {
    stroke: #34d399;
}

[data-theme="dark"] .mode-switcher-btn.active[data-mode="reader"] {
    color: #94a3b8;
}

[data-theme="dark"] .mode-switcher-btn.active[data-mode="reader"] svg {
    stroke: #94a3b8;
}

[data-theme="dark"] .mode-switcher-btn.active[data-mode="ai"] {
    color: #a78bfa;
}

[data-theme="dark"] .mode-switcher-btn.active[data-mode="ai"] svg {
    stroke: #a78bfa;
}

[data-theme="dark"] .mode-switcher-btn.active[data-mode="fathers"] {
    color: #e6c343;
}

[data-theme="dark"] .mode-switcher-btn.active[data-mode="fathers"] svg {
    stroke: #e6c343;
}

/* Tablet responsive — icon only */
@media (max-width: 1080px) {
    .mode-switcher {
        margin-left: 6px;
    }

    .mode-switcher-btn {
        padding: 4px 10px;
        font-size: 11px;
        gap: 3px;
    }

    .mode-switcher-btn span {
        display: none;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .mode-switcher-indicator {
        transition: none;
    }

    .mode-switcher-btn {
        transition: none;
    }
}

/* ==========================================
   MODE ACTIONS PILL (Graph, Notes, Clear)
   ========================================== */

/* ==========================================
   MODE ACTIONS PILL (Graph, Notes, Clear)
   ========================================== */

.mode-actions-pill {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    background: transparent;
    /* Transparent background as requested */
    padding: 3px;
    margin-left: 12px;
}

[data-theme="dark"] .mode-actions-pill {
    background: transparent;
}

.mode-action-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 14px;
    border: none;
    background: white;
    /* White background */
    color: #4b5563;
    font-size: 13px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* Subtle shadow like Bible buttons */
}

.mode-action-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.mode-action-btn:active {
    transform: scale(0.97);
}

.mode-action-btn svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.mode-action-btn:hover svg {
    opacity: 1;
}

/* Specific button styles */
.mode-action-clear {
    /* Auto width for pill shape with text */
    width: auto;
    height: auto;
    padding: 5px 14px;

    background: rgba(139, 92, 246, 0.1);
    /* Faint purple default */
    color: #7c3aed;
    opacity: 0.5;
    /* Faint when inactive */
    pointer-events: none;
    /* Non-interactive when no selections */
    transform: scale(0.9);
}

.mode-action-clear.has-selections {
    background: #7c3aed !important;
    background-image: none !important;
    /* Strong purple when active */
    color: white !important;
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    box-shadow: 0 2px 4px rgba(124, 58, 237, 0.3);
}

.mode-action-clear svg {
    width: 14px;
    height: 14px;
    opacity: 1;
    /* Always visible */
}

/* Ensure text is visible in clear button */
.mode-action-clear span {
    display: inline-block;
}



.mode-action-clear:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #6d28d9;
}

.mode-action-clear.has-selections:hover {
    background: #6d28d9;
    /* Darker purple on hover */
    color: white;
    transform: scale(1.05);
}

.mode-action-clear:hover svg {
    stroke: currentColor;
}

/* Dark mode */
[data-theme="dark"] .mode-action-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    box-shadow: none;
}

[data-theme="dark"] .mode-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #f3f4f6;
}

[data-theme="dark"] .mode-action-clear {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

[data-theme="dark"] .mode-action-clear.has-selections {
    background: #7c3aed;
    color: white;
}

[data-theme="dark"] .mode-action-clear:hover {
    background: rgba(139, 92, 246, 0.3);
    color: #c4b5fd;
}

[data-theme="dark"] .mode-action-clear.has-selections:hover {
    background: #8b5cf6;
    color: white;
}

/* Divider */
.mode-action-divider {
    width: 1px;
    height: 16px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0 2px;
}

[data-theme="dark"] .mode-action-divider {
    background: rgba(255, 255, 255, 0.15);
}

/* Mobile responsive */
@media (max-width: 1080px) {
    .mode-actions-pill {
        margin-left: 6px;
    }

    .mode-action-btn {
        padding: 5px 10px;
        gap: 4px;
    }

    /* Hide text on smaller tablets */
    .mode-action-btn span {
        display: none;
    }
}

@media (max-width: 768px) {
    .mode-actions-pill {
        display: none !important;
    }
}

/* ==========================================
   READER MODE — Distraction-free Reading
   ========================================== */

/* Hide AI and Commentaries tabs in Reader Mode */
body.reader-mode-active .ai-toggle-tab,
body.reader-mode-active .commentaries-toggle-tab {
    display: none !important;
}

/* Disable verse interaction in Reader Mode */
body.reader-mode-active #chapter-content .v {
    pointer-events: none;
    cursor: default;
}

body.reader-mode-active #chapter-content .verse-text,
body.reader-mode-active #chapter-content .verse-text-wrapper {
    pointer-events: none;
    cursor: default;
}

/* Allow native text selection in Reader Mode (for copy) */
body.reader-mode-active #chapter-content {
    user-select: text;
    -webkit-user-select: text;
}

/* Hide the mode switcher's clear button in Reader Mode */
body.reader-mode-active .compact-clear-btn {
    opacity: 0.3;
    pointer-events: none;
}

/* Reading time badge */
.reader-mode-reading-time {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    z-index: 10000;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    animation: readerBadgeIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.reader-mode-reading-time .reading-icon {
    margin-right: 6px;
    opacity: 0.8;
}

@keyframes readerBadgeIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(16px) scale(0.92);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes readerBadgeOut {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(16px) scale(0.92);
    }
}

[data-theme="dark"] .reader-mode-reading-time {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ==========================================
   READER MODE - Disable verse clicking
   ========================================== */

body.reader-mode-no-select #chapter-content .v,
body.reader-mode-no-select #chapter-content .verse-text,
body.reader-mode-no-select #chapter-content .verse-text-wrapper {
    cursor: default !important;
    pointer-events: none !important;
}

body.reader-mode-no-select #chapter-content {
    pointer-events: auto;
    user-select: text;
}

body.reader-mode-no-select .v:hover,
body.reader-mode-no-select .verse-text:hover,
body.reader-mode-no-select .verse-text-wrapper:hover {
    background: transparent !important;
    opacity: 1 !important;
}

/* ==========================================
   NOTES BUTTONS - Hidden by default, shown in Notes mode
   ========================================== */

.view-all-notes-btn,
.create-note-btn {
    display: none !important;
}

body.notes-mode-active .view-all-notes-btn,
body.notes-mode-active .create-note-btn {
    display: flex !important;
}

/* ==========================================
   READER MODE - Hide notes elements
   ========================================== */

body.reader-mode-active .view-all-notes-btn,
body.reader-mode-active .create-note-btn,
body.reader-mode-active .notes-graph-btn,
body.reader-mode-active .study-graph-toggle,
body.reader-mode-active .note-indicator,
body.reader-mode-active .note-popup,
body.reader-mode-active .popup-note-line,
body.reader-mode-active .faint-note-indicator,
body.reader-mode-active .notes-panel,
body.reader-mode-active .note-creation-bubble,
body.reader-mode-active .create-note-popup {
    display: none !important;
}

/* ==========================================
   AI MODE - Hide notes elements
   ========================================== */

body.ai-mode-active .view-all-notes-btn,
body.ai-mode-active .create-note-btn,
body.ai-mode-active .note-indicator,
body.ai-mode-active .note-popup,
body.ai-mode-active .popup-note-line,
body.ai-mode-active .faint-note-indicator,
body.ai-mode-active .notes-panel,
body.ai-mode-active .note-creation-bubble,
body.ai-mode-active .create-note-popup {
    display: none !important;
}

/* ==========================================
   AI MODE - Use user's highlight color preference
   ========================================== */

body.ai-mode-active .ai-verse-selected {
    background: var(--user-highlight-color, rgba(124, 58, 237, 0.2)) !important;
    border-bottom: 2px solid var(--user-highlight-color, rgba(124, 58, 237, 0.6));
}

body.ai-mode-active .v.selected,
body.ai-mode-active .verse-text.underline,
body.ai-mode-active .verse-text-wrapper.underline {
    background: var(--user-highlight-color, rgba(124, 58, 237, 0.2)) !important;
}

/* ==========================================
   BIBLIA AI TAB BUTTON (Right Side - Higher Up)
   ========================================== */

.ai-toggle-tab {
    position: fixed;
    top: 12px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 12px 12px 12px;
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.15) 0%, rgba(167, 139, 250, 0.2) 100%);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: #7c3aed;
    border-radius: 12px 0 0 12px;
    cursor: pointer;
    z-index: 1052;
    box-shadow: -2px 2px 12px rgba(124, 58, 237, 0.15);
    transition: all 0.3s ease;
    overflow: hidden;
}

.ai-tab-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.ai-tab-text {
    font-size: 9px;
    font-weight: 600;
    color: #7c3aed;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* Sparkle particles container */
.sparkle-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.sparkle-particles::before,
.sparkle-particles::after {
    content: '✦';
    position: absolute;
    font-size: 8px;
    opacity: 0;
    color: #7c3aed;
    text-shadow: 0 0 4px rgba(124, 58, 237, 0.6);
}

.ai-toggle-tab:hover {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.25) 0%, rgba(167, 139, 250, 0.3) 100%);
    box-shadow: -4px 4px 16px rgba(124, 58, 237, 0.25);
    padding-left: 16px;
}

.ai-toggle-tab:hover .ai-tab-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 6px rgba(124, 58, 237, 0.5));
    animation: iconGlow 0.6s ease-in-out infinite alternate;
}

/* Sparkle animation on hover */
.ai-toggle-tab:hover .sparkle-particles::before {
    animation: sparkle1 0.8s ease-in-out infinite;
}

.ai-toggle-tab:hover .sparkle-particles::after {
    animation: sparkle2 0.8s ease-in-out 0.4s infinite;
}

@keyframes iconGlow {
    0% {
        filter: drop-shadow(0 0 4px rgba(124, 58, 237, 0.4));
    }

    100% {
        filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.7));
    }
}

@keyframes sparkle1 {
    0% {
        opacity: 0;
        transform: translate(5px, 10px) scale(0);
    }

    50% {
        opacity: 1;
        transform: translate(15px, 5px) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(25px, 0px) scale(0);
    }
}

@keyframes sparkle2 {
    0% {
        opacity: 0;
        transform: translate(20px, 30px) scale(0);
    }

    50% {
        opacity: 1;
        transform: translate(10px, 20px) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(0px, 10px) scale(0);
    }
}

/* Additional floating sparkles */
.ai-toggle-tab:hover::before,
.ai-toggle-tab:hover::after {
    content: '✧';
    position: absolute;
    font-size: 10px;
    color: rgba(124, 58, 237, 0.8);
    text-shadow: 0 0 6px rgba(124, 58, 237, 0.5);
    pointer-events: none;
}

.ai-toggle-tab:hover::before {
    animation: floatSparkle1 1s ease-in-out infinite;
}

.ai-toggle-tab:hover::after {
    animation: floatSparkle2 1s ease-in-out 0.5s infinite;
}

@keyframes floatSparkle1 {

    0%,
    100% {
        opacity: 0;
        top: 30%;
        left: 20%;
        transform: scale(0);
    }

    50% {
        opacity: 1;
        top: 20%;
        left: 30%;
        transform: scale(1.3);
    }
}

@keyframes floatSparkle2 {

    0%,
    100% {
        opacity: 0;
        top: 60%;
        left: 25%;
        transform: scale(0);
    }

    50% {
        opacity: 1;
        top: 70%;
        left: 15%;
        transform: scale(1);
    }
}

.ai-toggle-tab.active {
    display: none;
}

/* Dark theme */
[data-theme="dark"] .ai-toggle-tab {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.2) 0%, rgba(167, 139, 250, 0.25) 100%);
    border-color: rgba(167, 139, 250, 0.4);
    box-shadow: -2px 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ai-toggle-tab:hover {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.3) 0%, rgba(167, 139, 250, 0.35) 100%);
}

[data-theme="dark"] .ai-tab-text {
    color: #a78bfa;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .ai-toggle-tab {
        top: 60px;
        padding: 8px 10px 10px 10px;
    }

    .ai-tab-icon {
        width: 26px;
        height: 26px;
    }

    .ai-tab-text {
        font-size: 8px;
    }
}

@media (max-width: 480px) {
    .ai-toggle-tab {
        top: 70px;
        padding: 8px;
        border-radius: 10px 0 0 10px;
    }

    .ai-tab-icon {
        width: 24px;
        height: 24px;
    }

    .ai-tab-text {
        display: none;
    }
}

/* ==========================================
   COMMENTARIES TAB BUTTON (Right Side - Below AI Tab)
   ========================================== */

.commentaries-toggle-tab {
    position: fixed;
    top: 90px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 10px 10px 10px;
    background: linear-gradient(180deg, rgba(157, 143, 201, 0.15) 0%, rgba(180, 168, 212, 0.2) 100%);
    border: 1px solid rgba(157, 143, 201, 0.3);
    color: #9d8fc9;
    border-radius: 12px 0 0 12px;
    cursor: pointer;
    z-index: 1051;
    box-shadow: -2px 2px 12px rgba(157, 143, 201, 0.15);
    transition: all 0.3s ease;
}

.commentaries-tab-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.commentaries-tab-text {
    font-size: 8px;
    font-weight: 600;
    color: #9d8fc9;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.commentaries-toggle-tab:hover {
    background: linear-gradient(180deg, rgba(157, 143, 201, 0.25) 0%, rgba(180, 168, 212, 0.3) 100%);
    box-shadow: -4px 4px 16px rgba(157, 143, 201, 0.25);
    padding-left: 14px;
}

.commentaries-toggle-tab:hover .commentaries-tab-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 6px rgba(157, 143, 201, 0.5));
}

.commentaries-toggle-tab.active {
    background: linear-gradient(180deg, rgba(157, 143, 201, 0.3) 0%, rgba(180, 168, 212, 0.35) 100%);
    border-color: rgba(157, 143, 201, 0.5);
}

[data-theme="dark"] .commentaries-toggle-tab {
    background: linear-gradient(180deg, rgba(180, 168, 212, 0.15) 0%, rgba(157, 143, 201, 0.2) 100%);
    border-color: rgba(180, 168, 212, 0.25);
    color: #b4a8d4;
}

[data-theme="dark"] .commentaries-toggle-tab:hover {
    background: linear-gradient(180deg, rgba(180, 168, 212, 0.25) 0%, rgba(157, 143, 201, 0.3) 100%);
}

[data-theme="dark"] .commentaries-tab-text {
    color: #b4a8d4;
}

/* Hide Commentaries tab when Work Reader is open */
body.work-reader-open .commentaries-toggle-tab {
    display: none !important;
}

@media (max-width: 768px) {
    .commentaries-toggle-tab {
        top: 80px;
        padding: 6px 8px 8px 8px;
    }

    .commentaries-tab-icon {
        width: 22px;
        height: 22px;
    }

    .commentaries-tab-text {
        font-size: 7px;
    }
}

@media (max-width: 480px) {
    .commentaries-toggle-tab {
        top: 130px;
        padding: 6px;
        border-radius: 10px 0 0 10px;
    }

    .commentaries-tab-icon {
        width: 20px;
        height: 20px;
    }

    .commentaries-tab-text {
        display: none;
    }
}

/* ==========================================
   AI PANEL CLOSE BUTTON (Better Contrast)
   ========================================== */

.ai-panel-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-panel-close-btn:hover {
    background: rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.ai-panel-close-btn svg {
    stroke-width: 2.5;
}

[data-theme="dark"] .ai-panel-close-btn {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .ai-panel-close-btn:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: rgba(239, 68, 68, 1);
}

/* AI Header Icon styling - theme aware */
.ai-header-icon {
    width: 28px;
    height: 28px;
    margin-right: 10px;
    vertical-align: middle;
}

.ai-header-icon-light {
    display: inline-block;
}

.ai-header-icon-dark {
    display: none;
}

[data-theme="dark"] .ai-header-icon-light {
    display: none;
}

[data-theme="dark"] .ai-header-icon-dark {
    display: inline-block;
}

/* Make header relative for close button positioning */
.ai-chat-header {
    position: relative;
}

/* ==========================================
   HIDDEN SIDEBAR ITEMS
   ========================================== */

.sidebar-hidden-item {
    display: none !important;
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

.nav-mode-btn:focus-visible,
.nav-mode-option:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}