/* Mobile-First Responsive Design for Melody Chord Generator */

/* Base styles (mobile first) */
.chord-sequence {
    line-height: 1.8;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.card {
    transition: transform 0.2s ease-in-out;
    margin-bottom: 1rem;
}

.card:hover {
    transform: translateY(-1px);
}

.badge {
    font-size: 0.85em;
    padding: 0.5em 0.75em;
    margin: 0.125rem;
    display: inline-block;
}

/* Audio player styling */
audio {
    border-radius: 0.375rem;
    width: 100%;
    max-width: 100%;
}

/* File input styling */
.form-control {
    font-size: 1rem;
    padding: 0.75rem;
}

.form-control:focus {
    border-color: var(--bs-info);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-info-rgb), 0.25);
}

/* Button styling for mobile */
.btn-primary {
    padding: 0.875rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Loading animation */
.spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Main heading responsive */
.display-4 {
    font-size: 1.75rem;
    line-height: 1.2;
}

.lead {
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Card body padding for mobile */
.card-body {
    padding: 1rem;
}

.card-header {
    padding: 0.75rem 1rem;
}

/* Form text smaller on mobile */
.form-text {
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Responsive container adjustments */
.container {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Custom scrollbar for better aesthetics */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-info);
}

/* Guitar chord chart styles - Mobile First */
.chord-chart {
    max-width: 280px;
    margin: 0 auto;
    width: 100%;
}

.fretboard {
    background: #2c3e50;
    border-radius: 8px;
    padding: 12px;
    position: relative;
    overflow-x: auto;
}

.strings {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    min-width: 240px;
}

.string {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 35px;
    flex-shrink: 0;
}

.string-name {
    color: #ecf0f1;
    font-weight: bold;
    font-size: 0.8em;
    margin-bottom: 6px;
}

.fret {
    width: 28px;
    height: 28px;
    border: 2px solid #34495e;
    background: #34495e;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    position: relative;
}

.fret.pressed {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}

.fret.open {
    background: transparent;
    border-color: #27ae60;
}

.fret.muted {
    background: transparent;
    border-color: #e74c3c;
}

.finger {
    color: white;
    font-weight: bold;
    font-size: 0.75em;
}

.open-marker {
    color: #27ae60;
    font-size: 1.1em;
    font-weight: bold;
}

.muted-marker {
    color: #e74c3c;
    font-size: 1.1em;
    font-weight: bold;
}

.fret-numbers {
    display: flex;
    justify-content: space-between;
    color: #bdc3c7;
    font-size: 0.75em;
    text-align: center;
    min-width: 240px;
}

.fret-numbers > div {
    width: 35px;
    flex-shrink: 0;
}

.fret-position {
    text-align: right;
    margin-bottom: 5px;
}

.position-indicator {
    background: var(--bs-dark);
    color: var(--bs-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: bold;
}

.chord-instructions {
    margin-top: 15px;
}

/* Hover effect for clickable chords */
.chord-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.chord-clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Touch-friendly tap effects for mobile */
@media (hover: none) and (pointer: coarse) {
    .chord-clickable:active {
        transform: scale(0.95);
        background-color: var(--bs-primary);
    }
}

/* Piano keyboard styles - Dark Synthesizer Theme */
.piano-chart {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.piano-keyboard {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 20px;
    position: relative;
    overflow-x: auto;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

.piano-keys {
    position: relative;
    height: 120px;
    min-width: 350px;
}

.white-keys {
    display: flex;
    height: 100%;
    position: absolute;
    width: 100%;
}

.white-key {
    flex: 1;
    background: #404040;
    border: 1px solid #1a1a1a;
    border-radius: 0 0 4px 4px;
    margin: 0 1px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.white-key:hover:not(.pressed) {
    background: #4a4a4a;
}

.white-key.pressed {
    background: #00ff88;
    color: #000;
    box-shadow: 0 0 15px #00ff88;
}

.key-label {
    font-size: 0.7em;
    font-weight: bold;
    color: #999;
}

.white-key.pressed .key-label {
    color: #000;
}

.black-keys {
    display: flex;
    position: absolute;
    height: 60%;
    width: calc(100% - 10px);
    left: 5px;
    pointer-events: none;
}

.black-key {
    width: calc(100% / 14 - 2px);
    background: #222;
    margin: 0 1px;
    border-radius: 0 0 3px 3px;
    pointer-events: auto;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.black-key:hover:not(.pressed) {
    background: #2a2a2a;
}

.black-key.pressed {
    background: #00ff88;
    box-shadow: 0 0 15px #00ff88;
}

.black-key-spacer {
    width: calc(100% / 14 - 2px);
    margin: 0 1px;
}

/* Position black keys correctly */
.black-keys > .black-key:nth-child(1) { margin-left: calc(100% / 14 * 0.7); }
.black-keys > .black-key:nth-child(2) { margin-left: calc(100% / 14 * 0.4); }
.black-keys > .black-key-spacer:nth-child(3) { width: calc(100% / 14 * 0.9); }
.black-keys > .black-key:nth-child(4) { margin-left: calc(100% / 14 * 0.4); }
.black-keys > .black-key:nth-child(5) { margin-left: calc(100% / 14 * 0.4); }
.black-keys > .black-key:nth-child(6) { margin-left: calc(100% / 14 * 0.4); }
.black-keys > .black-key-spacer:nth-child(7) { width: calc(100% / 14 * 0.9); }
.black-keys > .black-key:nth-child(8) { margin-left: calc(100% / 14 * 0.7); }
.black-keys > .black-key:nth-child(9) { margin-left: calc(100% / 14 * 0.4); }
.black-keys > .black-key-spacer:nth-child(10) { width: calc(100% / 14 * 0.9); }
.black-keys > .black-key:nth-child(11) { margin-left: calc(100% / 14 * 0.4); }
.black-keys > .black-key:nth-child(12) { margin-left: calc(100% / 14 * 0.4); }
.black-keys > .black-key:nth-child(13) { margin-left: calc(100% / 14 * 0.4); }

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

/* Instrument toggle styles */
.instrument-toggle-container {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

/* Tablet styles (768px and up) */
@media (min-width: 768px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .lead {
        font-size: 1.25rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .card-header {
        padding: 1rem 1.5rem;
    }
    
    .btn-primary {
        padding: 1rem 2rem;
        font-size: 1.125rem;
    }
    
    .chord-chart {
        max-width: 320px;
    }
    
    .string {
        width: 40px;
    }
    
    .fret {
        width: 32px;
        height: 32px;
    }
    
    .fret-numbers > div {
        width: 40px;
    }
    
    .strings {
        min-width: 280px;
    }
    
    .fret-numbers {
        min-width: 280px;
    }
}

/* Desktop styles (992px and up) */
@media (min-width: 992px) {
    .display-4 {
        font-size: 3rem;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card-body {
        padding: 2rem;
    }
    
    .card-header {
        padding: 1.25rem 2rem;
    }
    
    .chord-chart {
        max-width: 350px;
    }
    
    .fretboard {
        padding: 16px;
    }
}

/* Large desktop styles (1200px and up) */
@media (min-width: 1200px) {
    .display-4 {
        font-size: 3.5rem;
    }
    
    .card:hover {
        transform: translateY(-3px);
    }
}

/* Recording-specific styles */
.recording-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recording-indicator {
    width: 12px;
    height: 12px;
    background-color: #dc3545;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Button group responsive styling */
.btn-group {
    width: 100%;
    max-width: 300px;
}

.btn-group .btn {
    flex: 1;
}

/* Recording button states */
#recordBtn.recording {
    background-color: #dc3545;
    border-color: #dc3545;
    animation: pulse-btn 1s infinite;
}

@keyframes pulse-btn {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Mobile adjustments for recording */
@media (max-width: 576px) {
    .recording-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .recording-controls .btn {
        width: 100%;
        max-width: 200px;
    }
}

/* Theme System Styles */

/* Video Background Theme */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
}

.video-background video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: -1;
}

/* Theme-specific body styles */
body.video-theme {
    background: transparent !important;
}

body.video-theme .container {
    position: relative;
    z-index: 1;
}

body.video-theme .card {
    background: rgba(33, 37, 41, 0.9) !important;
    backdrop-filter: blur(10px);
    border: 1px rgba(255, 255, 255, 0.2) solid;
}

body.video-theme .btn {
    backdrop-filter: blur(10px);
}

/* Light theme styles with guitar background */
body.light-theme {
    background: linear-gradient(rgba(248, 249, 250, 0.8), rgba(248, 249, 250, 0.8)), 
                url('../images/guitar-background.png') center/cover no-repeat fixed !important;
    color: #212529 !important;
}

body.light-theme .card {
    background: rgba(255, 248, 240, 0.85) !important;
    border: 1px solid rgba(210, 180, 140, 0.6);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.15);
}

body.light-theme .text-muted {
    color: #8B4513 !important;
}

body.light-theme .btn-outline-secondary {
    color: #8B4513;
    border-color: #D2B48C;
    background: rgba(255, 248, 240, 0.8);
}

body.light-theme .btn-outline-primary {
    color: #B8860B;
    border-color: #DAA520;
    background: rgba(255, 248, 240, 0.8);
}

body.light-theme .dropdown-menu {
    background: rgba(255, 248, 240, 0.95) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(210, 180, 140, 0.6);
}

body.light-theme .btn {
    backdrop-filter: blur(5px);
}

body.light-theme .card-header {
    background: rgba(218, 165, 32, 0.9) !important;
    border-bottom: 1px solid rgba(184, 134, 11, 0.8);
    color: #654321 !important;
    font-weight: 600;
}

body.light-theme .form-control {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(210, 180, 140, 0.8);
    color: #654321;
}

body.light-theme .form-control:focus {
    border-color: #DAA520;
    box-shadow: 0 0 0 0.25rem rgba(218, 165, 32, 0.25);
}

body.light-theme .display-4 {
    color: #8B4513 !important;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
    font-weight: 700;
}

body.light-theme .text-info {
    color: #DAA520 !important;
}

body.light-theme .form-label {
    color: #654321 !important;
    font-weight: 600;
}

body.light-theme .form-text {
    color: #8B4513 !important;
}
