/* EasyToolio Keyboard Tester - Glassmorphic Design System & Keycap Styling */

.apple-glass {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.35);
}

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

html:not(.dark) .keyboard-tester-page .apple-glass {
    background: #ffffff !important;
    border-color: rgba(226, 232, 240, 0.95) !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02) !important;
}

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

html:not(.dark) .keyboard-tester-page .text-white {
    color: #0f172a !important;
}

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

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

/* Scroll Container for Mobile / Tablets */
.keyboard-scroll-wrapper {
    overflow-x: auto;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: rgba(6, 182, 212, 0.3) transparent;
    -webkit-overflow-scrolling: touch;
}

.keyboard-scroll-wrapper::-webkit-scrollbar {
    height: 6px;
}

.keyboard-scroll-wrapper::-webkit-scrollbar-thumb {
    background: rgba(6, 182, 212, 0.35);
    border-radius: 9999px;
}

/* Keyboard Chassis / Bed */
.keyboard-board-bed {
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
    background: rgba(9, 13, 22, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6), 0 12px 36px rgba(0, 0, 0, 0.4);
    user-select: none;
    touch-action: manipulation;
    min-width: fit-content;
}

html:not(.dark) .keyboard-board-bed {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.06), 0 10px 25px -5px rgba(0, 0, 0, 0.05) !important;
}

/* Matrix Rows */
.kb-row {
    display: flex;
    gap: 5px;
    align-items: stretch;
}

/* Base Keycap Styling (Dark Default) */
.key-cap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 44px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    font-size: 11px;
    font-weight: 700;
    color: #e2e8f0;
    transition: all 0.06s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
    text-align: center;
    padding: 2px 4px;
    flex-shrink: 0;
}

/* Base Keycap Styling (Light Mode) */
html:not(.dark) .key-cap {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 3px 0 #94a3b8, 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    color: #0f172a !important;
}

.key-cap .key-label-main {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    display: block;
}

.key-cap .key-label-sub {
    font-size: 8.5px;
    font-weight: 500;
    color: #94a3b8;
    line-height: 1;
    display: block;
    margin-top: 1px;
}

html:not(.dark) .key-cap .key-label-sub {
    color: #64748b !important;
}

/* Keycap Active / Pressed State */
.key-cap.pressed-active {
    transform: translateY(3px) scale(0.97) !important;
    box-shadow: 0 0 0 transparent, 0 0 20px rgba(6, 182, 212, 0.7) !important;
    border-color: #06b6d4 !important;
    color: #ffffff !important;
    background: #06b6d4 !important;
}

.key-cap.pressed-active .key-label-main,
.key-cap.pressed-active .key-label-sub {
    color: #ffffff !important;
}

/* Keycap Tested Working / Passed State */
.key-cap.tested-working {
    border-color: #10b981 !important;
    color: #10b981 !important;
    background: rgba(16, 185, 129, 0.14) !important;
    box-shadow: 0 2px 0 rgba(16, 185, 129, 0.35) !important;
}

html:not(.dark) .key-cap.tested-working {
    border-color: #10b981 !important;
    color: #047857 !important;
    background: rgba(16, 185, 129, 0.16) !important;
    box-shadow: 0 2px 0 #059669 !important;
}

.key-cap.tested-working .key-label-sub {
    color: #10b981 !important;
}

html:not(.dark) .key-cap.tested-working .key-label-sub {
    color: #047857 !important;
}

/* Keycap Warning / Issue / Chatter State */
.key-cap.possible-issue {
    border-color: #f59e0b !important;
    color: #d97706 !important;
    background: rgba(245, 158, 11, 0.2) !important;
    box-shadow: 0 2px 0 #f59e0b !important;
}

/* Multi-Hit Chatter Badge */
.key-hit-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 8px;
    font-weight: 800;
    font-family: monospace;
    background: #06b6d4;
    color: #ffffff;
    padding: 1px 4px;
    border-radius: 9999px;
    box-shadow: 0 2px 4px rgba(6, 182, 212, 0.4);
    animation: pop-hit-badge 0.12s ease-out;
    z-index: 10;
}

@keyframes pop-hit-badge {
    0% { transform: scale(0.4); }
    100% { transform: scale(1); }
}

/* Accurate Keycap Width Proportions */
.key-w-1 { width: 44px; }
.key-w-backspace { width: 90px; }
.key-w-tab { width: 68px; }
.key-w-backslash { width: 68px; }
.key-w-caps { width: 78px; }
.key-w-enter { width: 100px; }
.key-w-shift-l { width: 100px; }
.key-w-shift-r { width: 122px; }
.key-w-mod { width: 56px; }
.key-w-mod-mac { width: 66px; }
.key-w-1-75 { width: 78px; }
.key-w-space { width: 280px; }
.key-w-space-75 { width: 235px; }
.key-w-space-mac { width: 225px; }
.key-w-numpad-0 { width: 93px; }

/* 2u Vertical Keycaps */
.key-h-2 {
    height: 94px;
    align-self: stretch;
}

/* Physical Spacers */
.key-spacer {
    display: block;
    flex-shrink: 0;
}

.key-spacer.f-gap { width: 16px; }
.key-spacer.nav-gap { width: 14px; }
.key-spacer.numpad-gap { width: 14px; }
.key-spacer.arrow-spacer-1 { width: 44px; }
.key-spacer.nav-cluster-empty { width: 142px; }
.key-spacer.numpad-empty-f { width: 190px; }
.key-spacer.numpad-add-empty { display: none; }
.key-spacer.numpad-enter-empty { display: none; }

/* History Chips */
.history-chip {
    animation: fade-chip-in 0.12s ease-out;
}

@keyframes fade-chip-in {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Accordion Smooth Transitions */
details summary::-webkit-details-marker {
    display: none;
}
