/* Glassmorphism containers */
.apple-glass {
    background: rgba(255, 255, 255, 0.015);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Light Theme Overrides */
html:not(.dark) .spacebar-counter-page {
    color: #0f172a;
    background-color: #ffffff !important;
}

html:not(.dark) body {
    background-color: #ffffff !important;
}

html:not(.dark) .spacebar-counter-page .apple-glass {
    background: #ffffff !important;
    border-color: rgba(226, 232, 240, 0.9) !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.03) !important;
}

html:not(.dark) .spacebar-counter-page .text-zinc-400,
html:not(.dark) .spacebar-counter-page .text-zinc-500,
html:not(.dark) .spacebar-counter-page .text-zinc-300,
html:not(.dark) .spacebar-counter-page .text-zinc-200 {
    color: #475569 !important;
}

html:not(.dark) .spacebar-counter-page .bg-zinc-950\/40,
html:not(.dark) .spacebar-counter-page .bg-zinc-950\/60 {
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

html:not(.dark) .spacebar-counter-page .border-white\/5,
html:not(.dark) .spacebar-counter-page .border-white\/10 {
    border-color: #e2e8f0 !important;
}

/* Spacebar Click Container */
#spacebar-wrapper {
    outline: none;
    transition: all 0.2s ease;
}

/* Premium 3D Mechanical Spacebar Keycap (Dark Theme) */
.spacebar-key {
    cursor: pointer;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 2px solid rgba(14, 165, 233, 0.3);
    border-bottom: 6px solid #0284c7;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.08s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.08s ease, border-color 0.15s ease;
    transform: translateY(0);
    position: relative;
    user-select: none;
}

.spacebar-key:hover {
    border-color: rgba(56, 189, 248, 0.6);
    border-bottom-color: #0ea5e9;
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Premium 3D Mechanical Spacebar Keycap (Light Theme Override) */
html:not(.dark) .spacebar-key {
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%) !important;
    border: 2px solid #cbd5e1 !important;
    border-bottom: 6px solid #94a3b8 !important;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.12), 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
}

html:not(.dark) .spacebar-key:hover {
    border-color: #0ea5e9 !important;
    border-bottom-color: #0284c7 !important;
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.2) !important;
}

/* Key Depressed State (Pressed/Tapped) */
.spacebar-key.pressed {
    transform: translateY(5px) !important;
    border-bottom-width: 2px !important;
    border-color: #0ea5e9 !important;
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.4), inset 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.15) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
}

html:not(.dark) .spacebar-key.pressed {
    background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%) !important;
    border-color: #0284c7 !important;
    border-bottom-width: 2px !important;
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.3) !important;
}

/* Floating speed indicator (+1 clicks) */
.click-indicator {
    position: absolute;
    color: #38bdf8;
    font-weight: 900;
    font-size: 1.25rem;
    font-family: monospace;
    pointer-events: none;
    animation: float-up 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    text-shadow: 0 0 12px rgba(14, 165, 233, 0.8);
    z-index: 50;
}

html:not(.dark) .click-indicator {
    color: #0284c7;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Neon Glow Text */
.neon-text-sky {
    color: #38bdf8;
    text-shadow: 0 0 15px rgba(14, 165, 233, 0.6);
}

html:not(.dark) .neon-text-sky {
    color: #0284c7;
    text-shadow: none;
}

/* Animations */
@keyframes float-up {
    0% {
        transform: translate(-50%, -50%) scale(0.8) translateY(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.3) translateY(-70px);
        opacity: 0;
    }
}

/* Custom progress bar transition */
.progress-bar-fill {
    transition: width 0.08s linear;
}

/* Duration selection pills */
.duration-btn {
    transition: all 0.2s ease-in-out;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

html:not(.dark) .duration-btn {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

.duration-btn:hover {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.4);
    color: #38bdf8;
}

html:not(.dark) .duration-btn:hover {
    background: #e0f2fe;
    border-color: #0ea5e9;
    color: #0284c7;
}

.duration-btn.active {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.25) 0%, rgba(2, 132, 199, 0.35) 100%) !important;
    border-color: #0ea5e9 !important;
    color: #38bdf8 !important;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.3) !important;
}

html:not(.dark) .duration-btn.active {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3) !important;
}

/* Graph Empty State Light Mode Override */
html:not(.dark) #graph-empty-state {
    background-color: rgba(248, 250, 252, 0.95) !important;
    border-color: #e2e8f0 !important;
    color: #64748b !important;
}

/* Custom horizontal scrollbar for graph timeline */
.graph-scroll-container::-webkit-scrollbar {
    height: 6px;
}
.graph-scroll-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 9999px;
}
html.dark .graph-scroll-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}
.graph-scroll-container::-webkit-scrollbar-thumb {
    background: #0ea5e9;
    border-radius: 9999px;
}
.graph-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #0284c7;
}

/* History filter buttons */
.history-filter-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-filter-btn.active {
    background: rgba(14, 165, 233, 0.15) !important;
    color: #0ea5e9 !important;
    border-color: rgba(14, 165, 233, 0.4) !important;
    font-weight: 700;
}

html:not(.dark) .history-filter-btn.active {
    background: rgba(14, 165, 233, 0.1) !important;
    color: #0284c7 !important;
    border-color: rgba(14, 165, 233, 0.5) !important;
}

/* Rhythm Timeline Strip Click Bars */
.rhythm-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    width: 3px;
    border-radius: 9999px;
    transform: translateX(-50%);
    transition: transform 0.15s ease, filter 0.15s ease;
    cursor: pointer;
}

.rhythm-bar:hover {
    transform: translateX(-50%) scaleY(1.4);
    z-index: 20;
    filter: brightness(1.3);
}

.rhythm-bar.burst-fast {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.rhythm-bar.burst-steady {
    background: #0ea5e9;
    box-shadow: 0 0 5px rgba(14, 165, 233, 0.4);
}

.rhythm-bar.burst-slow {
    background: #f59e0b;
    box-shadow: 0 0 5px rgba(245, 158, 11, 0.4);
}

/* Session History Items */
.history-session-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-session-item:hover {
    border-color: rgba(14, 165, 233, 0.3) !important;
    background: rgba(14, 165, 233, 0.03) !important;
}

/* Custom graph and history scroll */
.custom-graph-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(14, 165, 233, 0.4) transparent;
}

.custom-graph-scroll::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.custom-graph-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 9999px;
}

html.dark .custom-graph-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.custom-graph-scroll::-webkit-scrollbar-thumb {
    background: rgba(14, 165, 233, 0.4);
    border-radius: 9999px;
    transition: background 0.2s ease;
}

.custom-graph-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(14, 165, 233, 0.8);
}

/* Modal Pop In Animation & Overlay Styles */
@keyframes modalPopIn {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.animate-modal-pop {
    animation: modalPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#spacebar-result-modal.hidden {
    display: none !important;
}

#spacebar-result-modal:not(.hidden) {
    display: flex !important;
}

/* Hide scrollbar for modal */
.no-scrollbar::-webkit-scrollbar {
    display: none !important;
}
.no-scrollbar {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

/* Personal Best Badge Display Behavior */
#pb-badge.hidden,
#pb-badge[style*="display: none"] {
    display: none !important;
}

#pb-badge:not(.hidden) {
    display: inline-flex !important;
}

/* Responsive adjustments */
@media (max-width: 430px) {
    #spacebar-wrapper {
        height: 250px !important;
    }
    .click-instruction {
        font-size: 0.7rem !important;
    }
}
