@import url(https://cdn-uicons.flaticon.com/2.6.0/uicons-solid-rounded/css/uicons-solid-rounded.css);
@import url(https://cdn-uicons.flaticon.com/2.6.0/uicons-bold-rounded/css/uicons-bold-rounded.css);
:root {
    --bg-color: #1e1e2e;
    --panel-color: #292a3f;
    --panel-light: #313244;
    --text-color: #f8f8f2;
    --accent-blue: #7aa2f7;
    --accent-green: #9ece6a;
    --accent-red: #f47067;
    --accent-orange: #ff9800;
    --dark-blue: #292a3f;
    --border-color: #313244;
}

/* Main Sections */

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    min-width: 320px; /* Minimum width to prevent layout breaking */
}

header {
    width: 100%;
    background-color: var(--panel-color);
    padding: 15px 0;
    text-align: center;
    margin-bottom: 20px;
}

footer {
    width: 100%;
    background-color: var(--panel-color);
    padding: 15px 0;
    text-align: center;
    margin-top: auto;
    font-size: 12px;
}
/* links */
a:link {
    color: var(--accent-orange);
}

a:visited {
    color: var(--accent-orange);
}

/* Container */
.container {
    width: 95%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
}

/* Panels */
.panel {
    background-color: var(--panel-light);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
}

/* Current Chord */
#current-chord {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 20px;
    padding-top: 40px;
}

/* Key Section */
.key-section {
    position: absolute;
    top: 10px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 2; /* Ensure it stays above other elements */
}

.key-label-text {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-color);
    opacity: 0.8;
}

.key-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background-color: var(--accent-red);
    border-radius: 50%;
    font-size: 20px;
    font-weight: bold;
}

/* Current Chord Name */
.chord-name {
    font-size: 28px;
    margin-top: 20px;
    text-align: center;
    background-color: var(--accent-green);
    border-radius: 10px;
    padding: 10px;
}

/* Fretboard */
.fretboard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
    height: auto;
    background-color: var(--panel-color);
    border-radius: 10px;
    position: relative;
    margin-top: 20px;
    padding: 20px;
    padding-bottom: 68px;
    box-sizing: border-box;
}

.fretboard {
    position: relative;
    width: 100%;
    max-width: 300px;
    height: auto;
    aspect-ratio: 5/3;
    background-color: var(--bg-color);
    border-radius: 10px;
    margin-bottom: 0;
}

.fret-label {
    position: absolute;
    bottom: 0;
    left: 0;
    font-weight: normal;
    font-size: 18px;
    color: #222;
    background: rgba(255,255,255,0.8);
    padding: 8px;
    border-radius: 8px;
    width: min-content;
    height: min-content;
    text-align: center;
}

.string {
    position: absolute;
    width: 100%;
    height: 1px;
    background-color: var(--text-color);
}

.fret {
    position: absolute;
    height: 100%;
    width: 1px;
    background-color: var(--text-color);
}

.finger {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: var(--accent-red);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.open-string {
    width: 20px;
    height: 20px;
}

/* Settings */
.settings {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

.settings-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
    gap: 20px;
}

.setting-group {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 200px; /* Minimum width for setting groups */
}

.setting-group:first-child {
    margin-left: 0;
}

.setting-group:last-child {
    margin-right: 0;
}

.setting-label {
    min-width: 120px;
    text-align: right;
    font-size: 14px;
    color: var(--text-color);
    padding-right: 8px;
    white-space: nowrap;
}

.instrument-select {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--accent-blue);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    max-width: 150px;
}

/* Switch Styles */
.cc-switch {
    position: relative;
    width: 60px;
    height: 25px;
    background-color: var(--bg-color);
    border-radius: 12.5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.cc-switch:hover {
    opacity: 0.9;
}

.cc-switch:active {
    opacity: 0.8;
}

.volume-slider {
    width: 100px;
    height: 6px;
    background-color: var(--bg-color);
    border-radius: 3px;
    position: relative;
}

.volume-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: var(--accent-red);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
}

/* Next Chords Module*/
.next-chords {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: relative;
    padding-top: 30px;
}

.next-chords-label {
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 20px;
    font-weight: bold;
    color: var(--text-color);
    opacity: 1.0;
    z-index: 1;
}

.next-chords-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 100px;
    width: 100%;
    padding: 20px 10px;
    overflow-x: hidden;
}

.next-chord {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background-color: var(--bg-color);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform-origin: center;
}

.next-chord.current {
    font-weight: bold;
    font-size: 2.0em;
    width: 100px;
    height: 100px;
    background-color: var(--accent-green);
    color: var(--text-color);
    z-index: 2;
}

.next-chord.next {
    font-weight: bold;
    font-size: 1.5em;
    width: 80px;
    height: 80px;
    background-color: var(--accent-blue);
    color: var(--text-color);
    z-index: 1;
}

.next-chord.last {
    font-size: 1.0em;
    width: 60px;
    height: 60px;
    background-color: var(--bg-color);
    opacity: 0.5;
    z-index: 1;
}

.next-chord.entering {
    opacity: 0;
    transform: translateX(50px);
}

.next-chord.entered {
    opacity: 1;
    transform: translateX(0);
}

.next-chord.exiting {
    opacity: 0;
    transform: translateX(-50px);
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    gap: 20px;
}

.main-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    width: 100%;
}

.control-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    background-color: var(--accent-blue);
    margin-bottom: 30px;
    flex-shrink: 0;
}

.control-button::after {
    content: attr(data-label);
    position: absolute;
    bottom: -25px;
    font-size: 12px;
    color: var(--text-color);
    white-space: nowrap;
    padding-bottom: 5px;
}

#play-button {
    background-color: var(--accent-blue);
}

#regenerate-button {
    background-color: var(--accent-green);
}

.play-icon, .pause-icon, .refresh-icon {
    font-size: 24px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.pause-icon {
    display: none;
}

.refresh-icon {
    transform: rotate(0deg);
    transition: transform 0.3s ease;
}

.refresh-icon:hover {
    transform: rotate(180deg);
}

.bpm-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
}

.bpm-slider {
    width: 200px;
    height: 6px;
    background-color: transparent;
    position: relative;
}

/* noUiSlider styles */

.noUi-handle {
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    background: var(--accent-red) !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
    right: -8px !important;
    top: -5px !important;
}

.noUi-handle:before,
.noUi-handle:after {
    display: none !important;
}

.noUi-handle:hover {
    background: var(--accent-red) !important;
    opacity: 0.8;
}

.noUi-base {
    background: var(--bg-color) !important;
    height: 6px !important;
    border-radius: 3px !important;
}

.noUi-connects {
    background: transparent !important;
    height: 6px !important;
}

.noUi-origin {
    background: var(--accent-red) !important;
}

.noUi-target {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    height: 6px !important;
}

.bpm-display {
    min-width: 40px;
    text-align: center;
    font-weight: bold;
}

/* Logo */
.header-logo {
    font-size: 2.5rem;
    font-family: 'Luckiest Guy', 'Comic Sans MS', cursive, sans-serif;
    display: flex;
    align-items: center;
    margin-left: 25px; /* leave space for SVG logo */
    margin-top: 10px;
    letter-spacing: 2px;
}

.chord-logo-text {
    color: var(--accent-orange);
    text-shadow: 2px 2px 0 #fffbe6, 4px 4px 0 #e65100;
    font-family: 'Luckiest Guy', cursive, sans-serif;
    font-weight: bold;
    margin-right: 0.5rem;
}
.cat-logo-text {
    color: #222;
    background: linear-gradient(90deg, #ffe082 60%, #ff9800 100%);
    border-radius: 8px;
    padding: 0 1.5rem 0 0.5rem;
    font-family: 'Pacifico', cursive, sans-serif;
    font-style: italic;
    font-weight: normal;
    box-shadow: 2px 2px 0 #fffbe6;
}

/* Chord Progression Module */
.current-chord-label {
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 20px;
    font-weight: bold;
    color: var(--text-color);
    opacity: 1.0;
    z-index: 1;
}

.chord-progression-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
}

.progression-label {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-color);
    opacity: 1.0;
    z-index: 1;
}

.chord-progression {
    display: flex;
    gap: 12px;
    background-color: var(--panel-color);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 16px;
    justify-content: center;
}

.chord-progression .chord {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.chord-progression .chord-name {
    color: var(--text-color);
    background-color: var(--accent-red);
}

.chord-progression .chord-degree {
    color: var(--accent-blue);
    font-size: 14px;
    opacity: 0.8;
}

.chord-progression .chord.current {
    color: var(--accent-green);
}

.chord-progression .chord.current .chord-name {
    background-color: var(--accent-green);
}

.chord-progression .chord.current .chord-degree {
    color: var(--accent-green);
}

.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 10px;
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 1000;
}

.loading-indicator.visible {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #d32f2f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.loading-text {
    color: white;
    font-size: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Media Queries */
@media screen and (max-width: 768px) {
    .header-logo {
        font-size: 2rem;
        margin-left: 25px;
    }

    .logo img {
        width: 80px;
        height: 80px;
    }

    .settings-row {
        flex-direction: column;
        gap: 15px;
    }

    .setting-group {
        width: 100%;
        justify-content: space-between;
    }

    .setting-label {
        min-width: 100px;
    }

    .controls {
        flex-direction: column;
        flex-wrap: wrap;
        gap: 15px;
        padding: 20px;
    }

    .main-controls {
        flex-direction: column;
        gap: 25px;
    }

    .control-button + .control-button {
        margin-left: 0;
    }

    .bpm-control {
        width: 100%;
        margin: 0;
        padding: 0 10px;
    }

    .controls .setting-group {
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    .bpm-slider {
        width: 150px;
    }

    .fretboard-container {
        padding: 20px;
        padding-bottom: 68px;
        max-width: 320px; /* Add max-width for tablet */
    }

    .fretboard {
        max-width: 250px;
    }

    .finger {
        width: 18px;
        height: 18px;
    }

    .open-string {
        width: 18px;
        height: 18px;
    }

    .chord-name {
        font-size: 24px;
    }

    .key-section {
        top: 5px;
        right: 10px;
    }

    .key-label {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .key-label-text {
        font-size: 12px;
    }

    .secondary-controls {
        width: 100%;
        justify-content: space-between;
    }

    .setting-label {
        min-width: 100px;
    }
}

@media screen and (max-width: 480px) {
    .header-logo {
        font-size: 1.8rem;
        margin-left: 25px;
    }

    .logo img {
        width: 60px;
        height: 60px;
    }

    .container {
        width: 100%;
        padding: 0 5px;
    }

    .panel {
        padding: 15px;
    }

    .fretboard-container {
        padding: 20px;
        padding-bottom: 68px;
        max-width: 280px; /* Add max-width for mobile */
    }

    .fretboard {
        max-width: 200px;
    }
    
    .finger {
        width: 14px;
        height: 14px;
    }

    .open-string {
        width: 14px;
        height: 14px;
    }

    .chord-name {
        font-size: 20px;
    }

    .key-section {
        position: relative; /* Change to relative positioning on mobile */
        top: 0;
        right: 0;
        margin-bottom: 10px;
        width: 100%;
        flex-direction: row; /* Change to row layout on mobile */
        justify-content: center;
        gap: 10px;
    }

    .key-label {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .key-label-text {
        font-size: 12px;
    }

    .control-button {
        width: 50px;
        height: 50px;
    }
    
    .bpm-control {
        width: 100%;
        margin: 0;
        padding: 0 5px;
    }

    .bpm-slider {
        width: 120px;
        flex: 1;
        max-width: 120px;
    }

    .bpm-display {
        min-width: 35px;
    }

    .controls {
        padding-bottom: 15px;
    }

    .next-chords-container {
        padding: 20px 5px;
        min-height: 80px;
    }

    .next-chord {
        width: 40px;
        height: 40px;
        font-size: 0.9em;
    }

    .next-chord.current {
        font-size: 1.5em;
        width: 70px;
        height: 70px;
    }

    .next-chord.next {
        font-size: 1.2em;
        width: 55px;
        height: 55px;
    }

    .next-chord.last {
        font-size: 0.9em;
        width: 40px;
        height: 40px;
    }

    .next-chords-label {
        font-size: 16px;
        top: 5px;
        left: 10px;
    }

    .main-controls {
        gap: 20px;
    }

    .secondary-controls {
        width: 100%;
        justify-content: space-between;
    }

    .setting-label {
        min-width: 100px;
    }
}

/*
    Component Styles
*/
.progression-select {
    background-color: var(--bg-color);
    color: white;
    border-radius: 5px;
    border: 1px solid var(--accent-blue);
    padding: 5px 10px;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box;
}

.progression-select option {
    background-color: var(--dark-blue);
    color: white;
}

.progression-select option[value="random"] {
    color: var(--accent-green);
}

.instrument-select:focus,
.progression-select:focus {
    border-color: var(--accent-blue);
    outline: none;
}

.secondary-controls {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 200px;
}

