/* ==========================================================================
   FretMemo App Styles
   Extracted from inline styles in index.html
   ========================================================================== */

/* --- Side Panel --- */
#side-panel {
    flex-shrink: 0;
    width: 320px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

#side-panel h2 {
    font-size: 1.25rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

#side-panel h3 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    color: var(--text-light);
}

#side-panel label,
#side-panel .label-text {
    font-size: 0.875rem;
    color: var(--text-dark);
}

.setting-group {
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.setting-group:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* --- Main Content --- */
#main-content {
    width: 100%;
    padding-top: var(--appbar-space);
    justify-content: flex-start;
    transition: margin-left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (min-width: 1024px) {
    #main-content {
        justify-content: center;
    }
}

body.panel-visible #side-panel {
    transform: translateX(0);
}

body.panel-visible #main-content {
    margin-left: 320px;
    width: calc(100% - 320px);
}

#floating-controls .controls-left {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body.panel-visible #floating-controls .controls-left {
    transform: translateX(320px);
}

/* Side panel behaves like an overlay on small screens */
@media (max-width: 768px) {
    body.panel-visible #main-content {
        margin-left: 0;
        width: 100%;
    }

    #side-panel {
        width: min(320px, 92vw);
    }

    body.panel-visible #floating-controls .controls-left {
        transform: none;
    }
}

/* Backdrop behind the settings panel */
#side-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

@media (max-width: 520px) {
    #stats-display {
        flex-wrap: wrap;
        row-gap: 0.5rem;
        max-width: 100%;
    }

    #stats-display .border-l {
        display: none;
    }

    .practice-note-container,
    #practice-tab-view {
        min-height: 220px;
    }
}

body.panel-visible #side-panel-overlay {
    opacity: 1;
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    #side-panel,
    #main-content,
    #floating-controls .controls-left,
    #side-panel-overlay {
        transition: none !important;
    }
}

/* --- Fretboard --- */
#fretboard {
    background: var(--bg-light);
    border: 2px solid var(--text-dark);
    display: grid;
}

/* Lefty Mode */
body.lefty #fretboard-container {
    transform: scaleX(-1);
}

body.lefty .fret,
body.lefty #fret-numbers > div > div {
    transform: scaleX(-1);
}

.fret {
    border-right: 2px solid #a0a0a0;
}

.fret[data-fret="0"] {
    border-right-width: 6px;
    border-right-color: var(--text-dark);
}

.fret[data-fret="12"] {
    border-right: none;
}

.string-line {
    background-color: #525252;
}

.marker-dot {
    background-color: #d4d4d4;
}

html.dark .marker-dot,
body.dark .marker-dot {
    background-color: #4b5563;
}

/* --- Note Highlight --- */
#highlight-dot,
.spider-dot {
    background-color: transparent;
    border: 4px solid var(--accent-color);
    box-shadow: 0 0 12px var(--accent-color-translucent);
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    z-index: 10;
    position: absolute;
    pointer-events: none;
}

/* --- Modern UI Elements in Panel --- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 9999px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-color);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid var(--bg-panel);
    margin-top: -7px;
    transition: transform 0.1s ease-in-out;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="number"],
select {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    font-size: 0.875rem;
    border-radius: 0.375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    padding: 0.5rem 0.75rem;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-color-translucent);
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--bg-light);
    margin: 0;
    font: inherit;
    color: var(--text-dark);
    width: 1.25em;
    height: 1.25em;
    border: 1px solid var(--border-color);
    border-radius: 0.25em;
    transform: translateY(-0.075em);
    display: grid;
    place-content: center;
    cursor: pointer;
}

input[type="checkbox"]::before {
    content: "";
    width: 0.75em;
    height: 0.75em;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em var(--accent-color);
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="checkbox"]:checked::before {
    transform: scale(1);
}

input[type="checkbox"]:focus {
    outline: none;
}

input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px var(--accent-color-translucent);
}

/* --- Switcher Buttons --- */
.switcher-btn {
    color: var(--text-light);
}

.switcher-btn.active {
    background-color: var(--accent-color);
    color: var(--bg-light);
    font-weight: bold;
}

.switcher-btn:focus {
    outline: none;
}

.switcher-btn:focus-visible {
    box-shadow: 0 0 0 3px var(--accent-color-translucent);
    z-index: 1;
}

/* --- Practice Note Display --- */
.practice-note-container,
#practice-tab-view {
    min-height: 288px;
}

.current-practice-note {
    font-size: clamp(5.25rem, 18vw, 10rem);
    line-height: 1;
    color: var(--text-dark);
}

.beat-dot {
    transition: all 0.2s ease-in-out;
}

.beat-dot.active {
    background-color: var(--accent-color);
    transform: scale(1.25);
}

/* --- Tablature View --- */
.tab-string {
    height: 2.5rem;
    border-bottom: 2px solid #a0a0a0;
    display: flex;
    align-items: center;
}

.tab-fret-number {
    color: var(--accent-color);
    font-weight: bold;
}

#practice-tab-view .tab-fret-number {
    width: 2em;
    height: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-weight: normal;
}

#practice-tab-view .tab-fret-number.current {
    color: var(--accent-color);
    font-weight: bold;
    background-color: var(--accent-color-translucent);
    border-radius: 9999px;
}

/* --- Tuner Display --- */
#tuner-display.correct {
    background-color: #dcfce7;
    border-color: #4ade80;
    color: #166534;
}

html.dark #tuner-display.correct,
body.dark #tuner-display.correct {
    background-color: #166534;
    border-color: #4ade80;
    color: #dcfce7;
}

/* --- Utility classes (replacing Tailwind) --- */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-grow {
    flex-grow: 1;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.space-x-6 > * + * {
    margin-left: 1.5rem;
}

.space-y-3 > * + * {
    margin-top: 0.75rem;
}

.space-y-4 > * + * {
    margin-top: 1rem;
}

.w-full {
    width: 100%;
}

.w-1\/3 {
    width: 33.333333%;
}

.w-1\/2 {
    width: 50%;
}

.w-3 {
    width: 0.75rem;
}

.w-4 {
    width: 1rem;
}

.w-5 {
    width: 1.25rem;
}

.w-16 {
    width: 4rem;
}

.h-3 {
    height: 0.75rem;
}

.h-5 {
    height: 1.25rem;
}

.h-6 {
    height: 1.5rem;
}

.h-10 {
    height: 2.5rem;
}

.h-12 {
    height: 3rem;
}

.h-16 {
    height: 4rem;
}

.min-h-screen {
    min-height: 100vh;
}

.max-w-xs {
    max-width: 20rem;
}

.max-w-sm {
    max-width: 24rem;
}

.max-w-md {
    max-width: 28rem;
}

.max-w-2xl {
    max-width: 42rem;
}

.max-w-3xl {
    max-width: 48rem;
}

.max-w-6xl {
    max-width: 72rem;
}

.max-w-xl {
    max-width: 36rem;
}

.max-h-0 {
    max-height: 0;
}

.max-h-40 {
    max-height: 10rem;
}

.max-h-80 {
    max-height: 20rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.p-1 {
    padding: 0.25rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.px-8 {
    padding-left: 2rem;
    padding-right: 2rem;
}

.py-1 {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.pb-8 {
    padding-bottom: 2rem;
}

.pt-4 {
    padding-top: 1rem;
}

.pr-2 {
    padding-right: 0.5rem;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-x-auto {
    overflow-x: auto;
}

.overflow-y-auto {
    overflow-y: auto;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.top-0 {
    top: 0;
}

.left-0 {
    left: 0;
}

.left-1\/2 {
    left: 50%;
}

.z-0 {
    z-index: 0;
}

.z-10 {
    z-index: 10;
}

.z-50 {
    z-index: 50;
}

.rounded-md {
    border-radius: 0.375rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-full {
    border-radius: 9999px;
}

.border {
    border-width: 1px;
}

.border-t {
    border-top-width: 1px;
}

.border-l {
    border-left-width: 1px;
}

.shadow-md {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1),
        0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.shadow-2xl {
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

.bg-gray-100 {
    background-color: #f3f4f6;
}

.bg-gray-300 {
    background-color: #d1d5db;
}

.bg-gray-700 {
    background-color: #374151;
}

.bg-green-100 {
    background-color: #dcfce7;
}

.bg-red-100 {
    background-color: #fee2e2;
}

.text-white {
    color: #fff;
}

.text-gray-500 {
    color: #6b7280;
}

.text-green-600 {
    color: #16a34a;
}

.text-red-600 {
    color: #dc2626;
}

.text-yellow-600 {
    color: #ca8a04;
}

.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.text-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.text-4xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
}

.text-center {
    text-align: center;
}

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

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.font-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
}

.uppercase {
    text-transform: uppercase;
}

.tracking-widest {
    letter-spacing: 0.1em;
}

.underline {
    text-decoration-line: underline;
}

.italic {
    font-style: italic;
}

.opacity-0 {
    opacity: 0;
}

.opacity-50 {
    opacity: 0.5;
}

.opacity-100 {
    opacity: 1;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-colors {
    transition-property: color, background-color, border-color,
        text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.transition-opacity {
    transition-property: opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.duration-200 {
    transition-duration: 200ms;
}

.duration-300 {
    transition-duration: 300ms;
}

.hover\:bg-gray-100:hover {
    background-color: #f3f4f6;
}

.hover\:bg-gray-800:hover {
    background-color: #1f2937;
}

.hover\:text-white:hover {
    color: #fff;
}

.hover\:text-accent-color:hover {
    color: var(--accent-color);
}

.focus\:outline-none:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.focus\:ring-4:focus {
    box-shadow: 0 0 0 4px var(--accent-color-translucent);
}

.focus\:ring-gray-300:focus {
    --ring-color: #d1d5db;
    box-shadow: 0 0 0 4px var(--ring-color);
}

/* Grid utilities */
.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .sm\:w-auto {
        width: auto;
    }

    .sm\:flex-row {
        flex-direction: row;
    }

    .sm\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Border colors */
.border-green-400 {
    border-color: #4ade80;
}

.border-red-400 {
    border-color: #f87171;
}

/* Block display  */
.block {
    display: block;
}
