/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f7fafc;
    line-height: 1.5;
}

/* Main Container Layout */
.main-container {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Controls Panel Styling */
.controls-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
    padding: 32px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 32px;
    align-items: start;
}

/* Instrument, Key, Tuning Preset, and Scale Type Selector Sections */
.instrument-section,
.key-section,
.tuning-preset-section,
.scale-type-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.instrument-section h3,
.key-section h3,
.tuning-preset-section h3,
.scale-type-section h3 {
    font-weight: 600;
    font-size: 14px;
    color: #2d3748;
    margin: 0;
}

.pattern-select {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.pattern-select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.pattern-select:disabled {
    background-color: #f7fafc;
    color: #a0aec0;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

.pattern-select optgroup {
    font-weight: 600;
    color: #4a5568;
}

.pattern-select option {
    font-weight: 400;
    color: #2d3748;
}

.tuning-dropdown {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.tuning-dropdown:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

/* Fretboard Container */
.fretboard-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
    padding: 24px;
}

/* Fret Position Header */
.fret-numbers {
    display: grid;
    grid-template-columns: 80px repeat(12, 1fr);
    gap: 0;
    margin-bottom: 16px;
}

.fret-spacer {
    grid-column: 1;
}

.fret-num {
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #4a5568;
    padding: 8px 0;
}

/* Fretboard Display Grid */
.fretboard-display {
    position: relative;
    display: grid;
    grid-template-columns: 80px 1fr;
    background: #fefefe;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

/* Tuning Controls Column */
.tuning-controls-column {
    grid-column: 1;
    display: grid;
    grid-template-rows: repeat(6, 44px); /* Default for guitar - will be dynamically updated */
    background: #f8f9fa;
    border-right: 2px solid #e2e8f0;
    padding: 0 8px;
}

.string-tuning-control {
    display: flex;
    align-items: center;
    justify-content: center;
}

.string-tuning-control .tuning-dropdown {
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
    width: 100%;
    max-width: 64px;
}

.string-tuning-control .tuning-dropdown:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

/* Fretboard Grid Container */
.fretboard-grid {
    grid-column: 2;
    position: relative;
    display: grid;
    grid-template-rows: repeat(6, 44px); /* Default for guitar - will be dynamically updated */
}

/* String Lines Layer */
.string-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-rows: repeat(6, 44px); /* Default for guitar - will be dynamically updated */
    pointer-events: none;
    z-index: 1;
}

.string-line {
    position: relative;
    display: flex;
    align-items: center;
}

.string-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #cbd5e0;
}

/* All strings have uniform weight/thickness for consistent appearance */
.string-line.string-1::after,
.string-line.string-2::after,
.string-line.string-3::after,
.string-line.string-4::after,
.string-line.string-5::after,
.string-line.string-6::after {
    height: 2px;
    background: #cbd5e0;
}

/* Fret Lines Layer */
.fret-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    pointer-events: none;
    z-index: 2;
}

.fret-line {
    border-right: 3px solid #718096;
    height: 100%;
}

.fret-line.fret-12 {
    border-right-color: #2d3748;
    border-right-width: 4px;
}

/* Note Positions Layer */
.note-positions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(6, 44px); /* Default for guitar - will be dynamically updated */
    z-index: 10;
}

.note-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    justify-self: center;
    align-self: center;
    z-index: 15;
}

.note-dot:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Note Color Coding */
.note-dot.root {
    background-color: #e53e3e;
}

.note-dot.primary {
    background-color: #38a169;
}

.note-dot.alternate {
    background-color: #dd6b20;
}

/* Position Markers Layer */
.fret-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    pointer-events: none;
    z-index: 3;
}

/* Fret Markers (positioned between fret numbers and fretboard) */
.fret-markers {
    display: grid;
    grid-template-columns: 80px repeat(12, 1fr);
    height: 16px;
    align-items: center;
    margin-bottom: 8px;
}

/* Position Markers */
.fret-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
}

.position-marker {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    height: 100%;
}

.position-marker.marker-5 {
    grid-column: 5;
}

.position-marker.marker-7 {
    grid-column: 7;
}

.position-marker.marker-9 {
    grid-column: 9;
}

.position-marker.marker-12 {
    grid-column: 12;
}

/* Single dot markers (5th and 9th frets) */
.position-marker.single-dot {
    display: flex;
    align-items: center;
    justify-content: center;
}

.position-marker.single-dot::after {
    content: '';
    width: 12px;
    height: 12px;
    background: #4a5568;
    border-radius: 50%;
}

/* Double dot markers (7th and 12th frets) */
.position-marker.double-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.position-marker.double-dot::before,
.position-marker.double-dot::after {
    content: '';
    width: 12px;
    height: 12px;
    background: #4a5568;
    border-radius: 50%;
    position: absolute;
}

.position-marker.double-dot::before {
    left: 33.33%;
    transform: translateX(-50%);
}

.position-marker.double-dot::after {
    left: 66.67%;
    transform: translateX(-50%);
}

.position-marker.marker-7,
.position-marker.marker-12 {
    position: relative;
}

/* Display Mode Controls */
.display-mode-controls {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.radio-group {
    display: flex;
    gap: 24px;
    background: #ffffff;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.10);
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: #4a5568;
    transition: color 0.2s ease;
}

.radio-option input[type="radio"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    accent-color: #3182ce;
}

.radio-option:hover {
    color: #2d3748;
}

.radio-option input[type="radio"]:checked + .radio-label {
    color: #3182ce;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-container {
        padding: 16px;
    }
    
    .controls-panel {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .fretboard-display {
        grid-template-columns: 60px 1fr;
    }
    
    .fret-numbers {
        grid-template-columns: 60px repeat(12, 1fr);
    }
    
    .tuning-controls-column {
        grid-template-rows: repeat(6, 36px);
        padding: 0 4px;
    }
    
    .string-tuning-control .tuning-dropdown {
        font-size: 11px;
        padding: 4px 6px;
        max-width: 52px;
    }
    
    .fretboard-grid {
        grid-template-rows: repeat(6, 36px);
    }
    
    .string-lines {
        grid-template-rows: repeat(6, 36px);
    }
    
    .note-positions {
        grid-template-rows: repeat(6, 36px);
    }
    
    .note-dot {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}