@charset "UTF-8";

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --font-color: #495057;
    --background-color: #ffffff;
    
    /* These will be overridden by header.php */
    --bg-color: #f4f4f4;
    --content-bg-color: #FFFFFF;
    --border-color: #AAAAAA;
    --font-color: #000000;
    --alt-content-bg-color: #EEEEEE;
    --alt-font-color: #000000;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--font-color);
    line-height: 1.6;
    min-height: 100vh;
}

.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0 20px 20px 20px;
    overflow-x: auto;
}

.metronome-container {
    width: 700px;
    min-width: 700px;
    margin: 40px auto;
    padding: 10px 30px 30px 30px;
    background: var(--content-bg-color);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    flex: 1;
    box-sizing: border-box;
}

/* Header Section */
.metronome-header {
    text-align: center;
    margin-bottom: 40px;
}

.metronome-header h1 {
    color: var(--font-color);
    margin-bottom: 10px;
    font-size: 28px;
}

.metronome-header p {
    font-size: 16px;
    color: var(--font-color);
    opacity: 0.8;
}

/* BPM Section */
.bpm-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    background: var(--alt-content-bg-color);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    width: 100%;
}

.bpm-display {
    margin-bottom: 20px;
}

.bpm-value {
    font-size: 4rem;
    font-weight: 300;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 5px;
}

.bpm-label {
    font-size: 1.2rem;
    color: var(--font-color);
    opacity: 0.7;
    font-weight: 600;
}

/* BPM Controls */
.bpm-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: nowrap; /* Never wrap to new lines */
    min-width: 0; /* Allow flex items to shrink */
}

.bpm-btn {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    background: var(--content-bg-color);
    color: var(--font-color);
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

.bpm-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.bpm-slider {
    flex: 1;
    max-width: 300px;
    min-width: 100px; /* Minimum width to prevent over-shrinking */
    height: 8px;
    background: var(--alt-content-bg-color);
    border-radius: 5px;
    outline: none;
    border: 1px solid var(--border-color);
    -webkit-appearance: none;
}

.bpm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bpm-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.bpm-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

/* BPM Presets */
.bpm-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 100%;
}

.preset-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: var(--content-bg-color);
    color: var(--font-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

/* Beat Indicator */
.beat-indicator {
    text-align: center;
    margin: 40px 0;
}

.beat-circle {
    width: 250px;
    height: 250px;
    border: 6px solid var(--border-color);
    border-radius: 50%;
    background: var(--content-bg-color);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    flex-shrink: 0; /* Prevent circle from shrinking */
}

.beat-circle.active {
    animation: beatPulse 0.2s ease-out;
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.beat-count {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--font-color);
    margin: 0;
    z-index: 1;
    transition: color 0.2s ease;
}

.beat-circle.active .beat-count {
    color: white;
}

@keyframes beatPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--primary-color);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(0, 123, 255, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

/* Control Section */
.control-section {
    text-align: center;
    margin: 30px 0;
}

.control-btn {
    padding: 15px 30px;
    margin: 0 10px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

.control-btn.start {
    background: var(--success-color);
    color: white;
}

.control-btn.start:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
}

.control-btn.stop {
    background: var(--danger-color);
    color: white;
}

.control-btn.stop:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-2px);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Time Signature Section */
.time-signature-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin: 10px 0;
    padding: 20px;
    background: var(--alt-content-bg-color);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    box-sizing: border-box;
    width: 100%;
}

.time-signature-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-signature-group label {
    font-weight: 600;
    color: var(--font-color);
    font-size: 1.1rem;
}

.time-signature-group select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    background: var(--content-bg-color);
    color: var(--font-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-signature-group select:hover {
    border-color: var(--primary-color);
}

.time-signature-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.accent-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.accent-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
    color: var(--font-color);
    font-size: 1rem;
}

.accent-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Remove the old accent-control styles since we're combining them */
.accent-control {
    display: none;
}

/* Sound Section */
.sound-section {
    padding-top: 0px;
    margin-top: 0px;
}

.sound-section h3 {
    text-align: center;
    margin-bottom: 25px;
    color: var(--font-color);
    font-size: 1.5rem;
    font-weight: 600;
}

/* Combine sound selector and volume control in one row */
.sound-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
    padding: 15px;
    background: var(--alt-content-bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    box-sizing: border-box;
    width: 100%;
}

.sound-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sound-selector label {
    font-weight: 600;
    color: var(--font-color);
    font-size: 1rem;
}

.sound-selector select {
    padding: 8px 15px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    background: var(--content-bg-color);
    color: var(--font-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.sound-selector select:hover {
    border-color: var(--primary-color);
}

.sound-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Volume Control - now inline */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-control label {
    font-weight: 600;
    color: var(--font-color);
    font-size: 1rem;
}

.volume-slider {
    width: 150px;
    min-width: 120px;
    height: 6px;
    background: var(--alt-content-bg-color);
    border-radius: 3px;
    outline: none;
    border: 1px solid var(--border-color);
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

#volumeValue {
    font-weight: 600;
    color: var(--font-color);
    min-width: 40px;
}

/* Settings Section */
.settings-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    box-sizing: border-box;
    width: 100%;
}

.settings-section h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--font-color);
    font-size: 1.3rem;
    font-weight: 600;
}

.settings-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    box-sizing: border-box;
}

.settings-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: var(--content-bg-color);
    color: var(--font-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.file-input-label {
    position: relative;
    cursor: pointer;
}

@media (max-width: 768px) {
    .main-container {
        padding: 10px 5px;
    }
    
    .metronome-container {
        width: 100%;
        min-width: 320px;
        max-width: 600px;
        margin: 10px auto;
        padding: 15px 20px 20px 20px;
    }
    
    /* Header adjustments */
    .metronome-header h1 {
        font-size: 2rem;
        margin-bottom: 8px;
    }
    
    .metronome-header p {
        font-size: 0.9rem;
    }
    
    /* BPM Section - mobile layout */
    .bpm-section {
        padding: 15px;
        margin-bottom: 25px;
    }
    
    .bpm-value {
        font-size: 3rem;
        margin-bottom: 5px;
    }
    
    .bpm-label {
        font-size: 1rem;
    }
    
    /* BPM Controls - keep on same line for mobile */
    .bpm-controls {
        gap: 10px; /* Reduce gap slightly */
        margin-bottom: 15px;
        flex-wrap: nowrap; /* Never wrap */
    }
    
    .bpm-btn {
        width: 45px; /* Slightly smaller on mobile */
        height: 45px;
        font-size: 1.4rem;
        flex-shrink: 0; /* Don't shrink */
    }
    
    .bpm-slider {
        flex: 1;
        min-width: 80px; /* Smaller minimum for mobile */
        max-width: none; /* Allow full flex growth */
    }
    
    /* Remove the old button container styles */
    .bpm-buttons {
        display: none; /* Remove separate button container */
    }
    
    /* Rest of mobile styles remain the same... */
    .metronome-header h1 {
        font-size: 2rem;
        margin-bottom: 8px;
    }
    
    .metronome-header p {
        font-size: 0.9rem;
    }
    
    .bpm-section {
        padding: 15px;
        margin-bottom: 25px;
    }
    
    .bpm-value {
        font-size: 3rem;
        margin-bottom: 5px;
    }
    
    .bpm-label {
        font-size: 1rem;
    }
    
    .bpm-presets {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-top: 15px;
    }
    
    .preset-btn {
        padding: 12px 8px;
        font-size: 0.8rem;
        text-align: center;
        white-space: nowrap;
    }
    
    .beat-circle {
        width: 180px;
        height: 180px;
        border-width: 4px;
        margin-bottom: 15px;
    }
    
    .beat-count {
        font-size: 2rem;
    }
    
    .control-section {
        margin: 20px 0;
    }
    
    .control-btn {
        padding: 12px 20px;
        margin: 0 5px;
        font-size: 1rem;
    }
    
    .time-signature-section {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        margin: 20px 0;
    }
    
    .time-signature-group,
    .accent-group {
        width: 100%;
        justify-content: center;
    }
    
    .time-signature-group select {
        padding: 10px;
        font-size: 1rem;
    }
    
    .sound-section {
        margin-top: 20px;
    }
    
    .sound-section h3 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .sound-controls {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .sound-selector,
    .volume-control {
        width: 100%;
        justify-content: space-between;
    }
    
    .sound-selector select {
        flex: 1;
        margin-left: 10px;
        padding: 10px;
    }
    
    .volume-slider {
        flex: 1;
        margin: 0 10px;
        width: auto;
        min-width: 0;
    }
    
    .settings-section {
        margin-top: 15px;
        padding-top: 15px;
    }
    
    .settings-section h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .settings-controls {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .settings-btn {
        width: 200px;
        justify-content: center;
        padding: 12px 15px;
        font-size: 0.9rem;
    }
}

/* Small mobile phones - maintain single line */
@media (max-width: 480px) {
    .main-container {
        padding: 5px;
    }
    
    .metronome-container {
        margin: 5px auto;
        padding: 10px 15px 15px 15px;
        border-radius: 10px;
    }
    
    /* BPM Controls - even more compact for small screens */
    .bpm-controls {
        gap: 8px; /* Smaller gap */
    }
    
    .bpm-btn {
        width: 40px; /* Smaller buttons */
        height: 40px;
        font-size: 1.2rem;
        flex-shrink: 0; /* Still don't shrink */
    }
    
    .bpm-slider {
        flex: 1;
        min-width: 60px; /* Very small minimum */
        max-width: none;
    }
    
    .metronome-header h1 {
        font-size: 1.8rem;
    }
    
    .metronome-header p {
        font-size: 0.8rem;
    }
    
    .bpm-value {
        font-size: 2.5rem;
    }
    
    .beat-circle {
        width: 150px;
        height: 150px;
    }
    
    .beat-count {
        font-size: 1.8rem;
    }
    
    .control-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
        margin: 0 3px;
    }
    
    .preset-btn {
        padding: 10px 6px;
        font-size: 0.7rem;
    }
    
    .sound-selector label,
    .volume-control label {
        font-size: 0.9rem;
    }
    
    .settings-btn {
        width: 180px;
        padding: 10px 12px;
        font-size: 0.8rem;
    }
}

/* Very small screens - ultra compact */
@media (max-width: 360px) {
    .metronome-container {
        padding: 8px 12px 12px 12px;
    }
    
    /* BPM Controls - ultra compact */
    .bpm-controls {
        gap: 6px; /* Very small gap */
    }
    
    .bpm-btn {
        width: 35px; /* Very small buttons */
        height: 35px;
        font-size: 1rem;
        flex-shrink: 0; /* Still don't shrink */
    }
    
    .bpm-slider {
        flex: 1;
        min-width: 50px; /* Tiny minimum */
        max-width: none;
    }
    
    .metronome-header h1 {
        font-size: 1.6rem;
    }
    
    .bpm-value {
        font-size: 2.2rem;
    }
    
    .beat-circle {
        width: 130px;
        height: 130px;
    }
    
    .beat-count {
        font-size: 1.6rem;
    }
    
    .control-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .bpm-presets {
        grid-template-columns: 1fr;
    }
    
    .preset-btn {
        padding: 8px 4px;
        font-size: 0.6rem;
    }
}

/* Ensure minimum container width to accommodate BPM controls */
@media (max-width: 320px) {
    .metronome-container {
        min-width: 300px; /* Ensure minimum width for BPM controls */
        padding: 6px 10px 10px 10px;
    }
    
    .bpm-controls {
        gap: 5px; /* Minimal gap */
    }
    
    .bpm-btn {
        width: 32px; /* Absolute minimum */
        height: 32px;
        font-size: 0.9rem;
    }
    
    .bpm-slider {
        min-width: 40px; /* Absolute minimum */
    }
}