/* ========================================
   CSS RESET & BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-accent: #e5e7eb;
    --border-color: #d1d5db;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   LAYOUT & CONTAINERS
   ======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main {
    min-height: calc(100vh - 180px);
    padding: 2rem 0;
}

/* ========================================
   HEADER
   ======================================== */

.header {
    background: var(--bg-primary);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav {
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* ========================================
   HERO SECTION
   ======================================== */

.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   METRONOME CONTAINER
   ======================================== */

.metronome-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* BPM Display */
.bpm-display {
    text-align: center;
    margin-bottom: 1.5rem;
}

.bpm-value {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
}

.bpm-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

/* Beat Indicator */
.beat-indicator {
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 4px solid var(--border-color);
    transition: all 0.05s ease;
}

.beat-indicator.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.5);
}

.beat-indicator.accent {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

/* Play Button */
.btn-play {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1.25rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.btn-play:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-play:active {
    transform: translateY(0);
}

.btn-play.playing {
    background: var(--danger-color);
}

.play-icon {
    font-size: 1.5rem;
}

/* BPM Controls */
.bpm-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.btn-control {
    width: 50px;
    height: 50px;
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-control:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.bpm-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    outline: none;
}

.bpm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.bpm-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.bpm-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.bpm-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

/* Tap Tempo */
.tap-tempo-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.btn-tap {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--secondary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-tap:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-tap:active {
    transform: scale(0.95);
}

.btn-reset {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-reset:hover {
    background: var(--bg-accent);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Preset Buttons */
.preset-section {
    margin-bottom: 1.5rem;
}

.preset-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.btn-preset {
    padding: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-preset:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-preset.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Time Signature & Volume */
.time-signature-section,
.volume-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.control-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 100px;
}

.time-signature-select {
    flex: 1;
    padding: 0.625rem 1rem;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.time-signature-select:hover,
.time-signature-select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--secondary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* ========================================
   CONTENT SECTIONS
   ======================================== */

.features-section,
.how-to-section,
.perfect-for-section,
.faq-section,
.related-tools-section {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.features-section h2,
.how-to-section h2,
.perfect-for-section h2,
.faq-section h2,
.related-tools-section h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.feature h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.feature p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Instructions & Benefits Lists */
.instructions-list,
.benefits-list {
    margin-left: 1.5rem;
    color: var(--text-secondary);
}

.instructions-list li,
.benefits-list li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.instructions-list strong {
    color: var(--text-primary);
}

/* FAQ Items */
.faq-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.faq-item h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Related Tools */
.related-tools {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.tool-card {
    display: block;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: var(--transition);
}

.tool-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.tool-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.tool-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    text-align: center;
    color: var(--text-secondary);
}

.footer-nav {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.footer-nav a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.footer-nav a:hover {
    text-decoration: underline;
}

.separator {
    color: var(--border-color);
}

/* ========================================
   RESPONSIVE DESIGN - TABLET
   ======================================== */

@media (min-width: 640px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .preset-buttons {
        grid-template-columns: repeat(8, 1fr);
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   RESPONSIVE DESIGN - DESKTOP
   ======================================== */

@media (min-width: 1024px) {
    .hero-title {
        font-size: 3rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .metronome-container {
        padding: 3rem;
    }

    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .related-tools {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .header,
    .footer,
    .metronome-container {
        display: none;
    }
}
