@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

:root {
    --color-dark: #2B2D42;
    --color-light: #8D99AE;
    --color-white: #EDF2F4;
    --color-accent: #EF233C;
    --color-accent-dark: #D90429;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--color-white);
    color: var(--color-dark);
    line-height: 1.6;
    /* Ensure the body doesn't scroll */
    margin: 0;
    overflow: hidden;
    height: 100vh;
    /* Ensure the body doesn't scroll */
}

#chord-table {
    flex: 6;
    padding: 20px;
    width: 90%;
}

/* Resizing Columns*/
#main-container {
    display: flex;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    width: 100%; /* Fill viewport width */
    height: 100vh; /* Make container full viewport height */
    overflow: hidden; /* Prevent container from scrolling */
}

/* Default desktop layout */
#main-container {
    display: flex;
    flex-direction: row;
}

#left-column {
    flex: 1 1 150px;
    min-width: 150px;
    overflow-y: auto;
    height: calc(100vh - 40px);
}

#right-column {
    flex: 1 1 440px;
    min-width: 440px;
    overflow-y: auto;
    height: calc(100vh - 40px);
}

#sidebar {
    flex: 1 1 150px;
    min-width: 150px;
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: visible;
    height: calc(100vh - 40px); /* Full height minus padding */
}

.column-resizer {
    width: 8px;
    background-color: #ddd;
    cursor: col-resize;
    transition: background-color 0.3s;
    /* Add these properties to keep resizer visible */
    position: relative;
    z-index: 100;
    flex-shrink: 0; /* Prevent resizer from shrinking */
}

.column-resizer:hover {
    background-color: #bbb;
}



#diatonic-chord-table {
    display: flex;
}

#diatonic-chord-table table {
    border-collapse: collapse;
}

#diatonic-chord-table th,
#diatonic-chord-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

#diatonic-chord-table th {
    background-color: #f2f2f2;
}

#diatonic-chord-table td {
    padding-top: 0px;
    padding-bottom: 0px;
}

/**/
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

th,
td {
    border: 1px solid var(--color-light);
    padding: 2px;
    text-align: center;
    vertical-align: top;
}

th {
    background-color: var(--color-dark);
    color: var(--color-white);
    font-weight: bold;
}

/* chord table, styling multiple chords per cell*/
.chord-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    align-items: center;
    padding: 2px;
}

.chord-symbol {
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.chord-separator {
    opacity: 0.6;
    margin: 0 2px;
}

.chord-symbol:hover {
    filter: brightness(1.1);
}



.side-bar {
    background-color: var(--color-white);
    font-weight: bold;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
}

button {
    background-color: var(--color-dark);
    color: var(--color-white);
    border: none;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: var(--color-accent);
}

#diatonicTable {
    margin-top: 20px;
}

#diatonicChords>td {
    width: 50px;
}

#chordDiagramContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    background-color: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
}

.chordDiagram {
    flex: 1 1 33%;
    margin: 10px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
}

.chordDiagram .chord-wrapper {
    flex: 1 1 100%; 
    max-width: 100%; 
    box-sizing: border-box; 
    padding: 5px; 
}

.chord-wrapper {
    position: relative; /* Ensure the wrapper can position child elements absolutely */
}

.select-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: color 0.3s ease;
}

.select-icon.fa-check {
    color: green;
}

.clickable {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.clickable:hover {
    background-color: rgba(239, 35, 60, 0.1);
}


.switch {
    position: relative;
    display: inline-block;
    width: 41px;
    height: 15px;
    margin-right: 10px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 13px;
    width: 13px;
    left: 1px;
    bottom: 1px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #2196F3;
}

input:focus+.slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 15px;
}

.slider.round:before {
    border-radius: 50%;
}

.label-text {
    position: absolute;
    left: 46px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
}

/* animation keyframes and classes */
@keyframes wiggle-string-vertical {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(calc(var(--amplitude, 1) * 1px));
    }

    50% {
        transform: translateX(0);
    }

    75% {
        transform: translateX(calc(var(--amplitude, 1) * -1px));
    }
}

@keyframes wiggle-string-horizontal {

    0%,
    100% {
        transform: translateY(0);
    }

    25% {
        transform: translateY(calc(var(--amplitude, 1) * 1px));
    }

    50% {
        transform: translateY(0);
    }

    75% {
        transform: translateY(calc(var(--amplitude, 1) * -1px));
    }
}

.string-wiggle-6,
.string-wiggle-5,
.string-wiggle-4,
.string-wiggle-3,
.string-wiggle-2,
.string-wiggle-1,
.string-wiggle-muted {
    animation: var(--wiggle-animation, wiggle-string-vertical) var(--duration) ease-out infinite;
    --amplitude: var(--wiggle-amplitude, 6);
}

.string-wiggle-6 {
    --duration: 0.05s;
}

.string-wiggle-5 {
    --duration: 0.045s;
}

.string-wiggle-4 {
    --duration: 0.04s;
}

.string-wiggle-3 {
    --duration: 0.035s;
}

.string-wiggle-2 {
    --duration: 0.03s;
}

.string-wiggle-1 {
    --duration: 0.025s;
}

.string-wiggle-muted {
    --duration: 0.02s;
    --wiggle-amplitude: 2;
}

.string-glow {
    filter: drop-shadow(0 0 5px #ffff00) drop-shadow(0 0 10px #ff8800);
    transition: filter 1.5s ease-out, stroke 0.2s ease-out;
}

.string-color-change {
    stroke: #ff8800 !important;
}

.key-title {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px;
}

/* Transpose Button */
.transpose-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: bold;
}

.material-icons {
    font-size: 18px;
}

#sharpFlatToggle .label-text {
    width: 30px;
    text-align: center;
}

/* Modify the existing .switch class */
#sharpFlatToggle .switch {
    width: 90px;
}

/* Modify the existing .slider:before class */
#sharpFlatToggle .slider:before {
    content: "Gb";
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

/* Add a new style for the checked state */
#sharpFlatToggle input:checked+.slider:before {
    content: "F#";
}

.chord-name-display {
    text-align: center;
    margin-bottom: 5px;
    font-weight: bold;
}

.sounding-chord {
    font-size: 0.8em;
    color: #666;
}


/* Chord Navigation */
.chord-navigation {
    display: flex;
    justify-content: center;
}

.nav-button {
    font-size: 12px;
    padding: 3px 5px;
    border: 2px solid #4a90e2;
    background-color: white;
    color: #4a90e2;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-button:hover {
    background-color: #4a90e2;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.nav-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


/* Highlight cells on hover */
.prominent-chord,
.chord-option {
    transition: all 0.2s ease-in-out;
}

.prominent-chord.chord-highlight,
.chord-option.chord-highlight {
    outline: 3px solid rgba(147, 0, 0, 0.772);
    outline-offset: -3px;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease-in-out;
}

[style*="color: white"].chord-highlight,
[style*="color: #fff"].chord-highlight,
[style*="color: #ffffff"].chord-highlight {
    background-color: rgba(255, 255, 255, 0.772) !important;
    color: black !important;
}

/* Update the diminished highlight styles */
td.dim-highlight .cell-container {
    outline: 3px solid rgba(255, 215, 0, 0.7) !important;
    outline-offset: -3px;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    transition: all 0.2s ease-in-out;
}

.temp-text-overlay {
    font-size: 0.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    pointer-events: none;
    z-index: 1000;
    animation: fadeIn 0.2s ease-in-out;
    text-align: center;
    min-height: 70%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.dim-diagram-highlight {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.7));
    outline: 3px solid rgba(255, 215, 0, 0.7);
    outline-offset: 2px;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
}


/* Chord Table controls */
.controls {
    margin-bottom: 3px;
}

.controls select {
    margin-right: 10px;
    min-width: 150px;
    width: 30%;
    padding: 5px;
}

.controls label {
    cursor: pointer;
}


/* Chord Table Cell Redesign */
.cell-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.prominent-chord {
    /* flex: 1; */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1em;
    border-radius: 4px;
}

.chord-options {
    display: flex;
    gap: 2px;
    justify-content: center;
    flex-wrap: wrap;
}

.chord-option {
    font-size: 0.5em;
    padding: 2px 4px;
    border-radius: 2px;
    cursor: pointer;
    border: 1px solid transparent;
}

.chord-option.selected {
    border-color: #000;
}


table {
    border-collapse: collapse;
}

/* Highlighting table cells based on scale degree */
/* Bold border for whole number scale degrees */
.whole-number-scale {
    /* border: 3px solid gray !important; */
    box-shadow: inset 0 0 0 3px #000000; 
    padding: 4px;
}

/* Double border for scale degree 5 */
.scale-five, .scale-one {
    /* border: 3px solid gray !important; */
    box-shadow: inset 0 0 0 3px #cc007e; 
    padding: 4px;
}

/*TOUCH for MOBILE*/

/* Add touch interaction improvements */
.guitarChordDiagram {
    touch-action: none; /* Prevent default touch behaviors like scrolling */
    -webkit-touch-callout: none; /* Prevent callout on long-press */
    -webkit-user-select: none; /* Prevent text selection on iOS */
    user-select: none; /* Prevent text selection */
}


.mobile-hidden, #mobile-view {
    display: none;
}

@media (max-width: 768px) {
    .chord-name-display {
        text-align: center;
        margin-bottom: 5px;
        font-weight: bold;
        font-size: 0.5em;
    }

    .transpose-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font-weight: bold;
    }
    
    .mobile-hidden {
        display: flex;
    }

    #main-container {
        flex-direction: column;
    }
    #left-column,
    #right-column,
    #sidebar {
        height: auto; 
    }
    .column-resizer {
        width: 100%;
        height: 10px;
        cursor: row-resize;
    }
    
    #mobile-view {
        display: block;
    }

    .mobile-column {
        display: none;
    }

    .mobile-column.active {
        display: block;
    }

    /* Adjust the chord table for mobile */
    #chord-table {
        width: 85%;
        padding: 0px;
    }

    #chord-table table {
        position: relative;
        overflow: visible;
    }
    .controls {
        width: 85%;
    }

    #chord-table .capo-position {
        display: none;
    }

    #chord-table td[data-column-index="0"] {
        position: relative; /* Ensure the parent element is positioned */
    }
    
    #chord-table td[data-column-index="0"]::before {
        content: attr(data-row-index); 
        visibility: visible;
        position: absolute;
        color: #333; 
        background: rgba(0,0,0, 57%); 
        backdrop-filter: blur(2px); 
        padding: 0px 3px; 
        border-radius: 2px; 
        font-family: monospace;
        font-weight: bold;
        margin-left: -34px;
        margin-top: -3px;
        top: 0;
        color: white;
    }

    /* Ensure right column and sidebar stack */
    #right-column.active,
    #sidebar.active, #left-column.active {
        display: block;
        width: 100%;
    }

    .chordDiagram {
        flex: 1 1 33%;
        margin: 10px;
        background-color: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        padding: 10px;
        display: flex;
        flex-wrap: wrap; /* Allows wrapping of child elements */
    }
    
    .chordDiagram .chord-wrapper {
        flex: 1 1 33%; 
        min-width: 50%; 
        max-width: 50%;
        box-sizing: border-box; 
        padding: 5px; 

        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }

    #right-column {
        flex: 1 1 60%; /* Adjust width for right column */
    }

    #sidebar {
        flex: 1 1 40%; /* Adjust width for sidebar */
    }
}
#sidebar #chordDiagramContainer:empty::before {
    content: "Click in the chord table to see the chord diagram(s) here";
    font-style: italic;
    color: #888;
    display: block;
    padding: 10px;
}

/* switch for the sustain options */

.three-way-switch {
    display: flex;
    justify-content: left;
    margin-bottom: 1em;
}

.three-way-switch label {
    display: flex;
    align-items: center;
    margin-right: 0.4em;
}

.three-way-switch input[type="radio"] {
    margin-right: 0.5em;
}


