/* Main CSS file - imports all other CSS modules */
@import 'variables.css';
@import 'base.css';
@import 'grid.css';
@import 'panels.css';
@import 'responsive.css';

/* Utility classes */
.button-container {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}


/* Main Controls Panel */
.main-controls-panel {
    display: flex;
    gap: var(--spacing-medium);
    margin-bottom: var(--spacing-medium);
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}

/* Live Play Button - Compact Version */
.live-play-button-compact {
    flex: 0 0 auto;
    min-width: 140px;
    max-width: 200px;
    height: 60px;
    background: var(--live-play-gradient);
    border: none;
    border-radius: var(--border-radius-medium);
    color: white;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--live-play-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.live-play-button-compact:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--live-play-shadow-hover);
    background: var(--live-play-gradient-hover);
}

.live-play-button-compact:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px var(--live-play-shadow-active);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .main-controls-panel {
        flex-direction: column;
        gap: var(--spacing-sm);
        width: 100%;
    }

    .live-play-button-compact {
        min-width: 100%;
        max-width: none;
        font-size: 1em;
        height: 50px;
    }
}

@media (min-width: 769px) and (max-width: 959px) {
    .live-play-button-compact {
        min-width: 160px;
        max-width: 180px;
        font-size: 0.95em;
    }
}

@media (min-width: 960px) {
    .live-play-button-compact {
        min-width: 180px;
        max-width: 220px;
        font-size: 1em;
    }
}

/* Drum Pads Modal Styles */
.drum-pads-overlay {
    background: rgba(0, 0, 0, 0.9);
}

.drum-pads-modal {
    width: 95vw;
    max-width: 1200px;
    height: 90vh;
    max-height: 800px;
}

.drum-pads-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-medium);
    background: var(--color-input-bg);
    border-radius: var(--border-radius-medium);
    border: 1px solid var(--color-border);
    gap: var(--spacing-medium);
    flex-wrap: wrap;
}

.drum-pads-controls .control-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.drum-pads-controls label {
    font-weight: 600;
    color: var(--color-text-accent);
    white-space: nowrap;
}

.drum-pads-controls input[type="range"] {
    width: 80px;
}

.drum-pads-controls select {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-small);
    background: var(--color-input-bg);
    color: var(--color-text);
}

.practice-btn,
.record-btn {
    padding: var(--spacing-sm) var(--spacing-medium);
    border: none;
    border-radius: var(--border-radius-small);
    background: var(--color-secondary-accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.practice-btn:hover,
.record-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.practice-btn.active {
    background: var(--color-success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.record-btn.active {
    background: var(--color-error);
    animation: pulseRecord 1.5s ease-in-out infinite;
}

@keyframes pulseRecord {
    0%, 100% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 25px rgba(239, 68, 68, 0.7); }
}

/* Drum Kit Layout */
.drum-kit-layout {
    display: grid;
    grid-template-areas:
        "crash . . ride"
        "tom1 tom2 . ."
        "hihat hihat-open kick snare"
        "floor-tom . . ."
        ". hihat-foot . .";
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 80px);
    gap: var(--spacing-medium);
    margin: var(--spacing-lg) 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.drum-pad {
    background: var(--glass-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-medium);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
    backdrop-filter: var(--glass-backdrop);
}

.drum-pad:hover {
    border-color: var(--color-primary-accent);
    background: var(--color-grid-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.drum-pad.active {
    background: var(--color-primary-accent);
    color: white;
    transform: scale(0.95);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
    border-color: var(--color-primary-accent);
}

.drum-pad.hard-hit {
    animation: hardHit 0.2s ease-out;
}

@keyframes hardHit {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
    100% { transform: scale(0.95); }
}

/* Drum pad positioning */
.drum-pad.cymbal.crash { grid-area: crash; }
.drum-pad.cymbal.ride { grid-area: ride; }
.drum-pad.tom.high-tom { grid-area: tom1; }
.drum-pad.tom.mid-tom { grid-area: tom2; }
.drum-pad.tom.floor-tom { grid-area: floor-tom; }
.drum-pad.hihat.closed { grid-area: hihat; }
.drum-pad.hihat.open { grid-area: hihat-open; }
.drum-pad.kick { grid-area: kick; }
.drum-pad.snare { grid-area: snare; }
.drum-pad.foot-control { grid-area: hihat-foot; }

.pad-label {
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: var(--spacing-xs);
    text-align: center;
    color: var(--color-text-accent);
}

.key-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: var(--border-radius-small);
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: var(--spacing-xs);
    min-width: 30px;
    text-align: center;
}

.finger-hint {
    font-size: 0.7rem;
    opacity: 0.7;
    font-style: italic;
}

.drum-pad.active .pad-label,
.drum-pad.active .key-display,
.drum-pad.active .finger-hint {
    color: white;
}

/* Pattern feedback animations */
.drum-kit-layout.pattern-rock-beat {
    animation: rockBeatFeedback 0.3s ease-out;
}

.drum-kit-layout.pattern-tom-fill {
    animation: tomFillFeedback 0.3s ease-out;
}

.drum-kit-layout.pattern-crash-accent {
    animation: crashAccentFeedback 0.3s ease-out;
}

@keyframes rockBeatFeedback {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.2) hue-rotate(10deg); }
    100% { filter: brightness(1); }
}

@keyframes tomFillFeedback {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.3) hue-rotate(30deg); }
    100% { filter: brightness(1); }
}

@keyframes crashAccentFeedback {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.4) hue-rotate(-20deg); }
    100% { filter: brightness(1); }
}

/* Drum Pads Help Section */
.drum-pads-help {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-medium);
    background: var(--color-input-bg);
    border-radius: var(--border-radius-medium);
    border: 1px solid var(--color-border);
}

.help-section {
    margin-bottom: var(--spacing-medium);
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-accent);
}

.key-mappings {
    font-size: 0.85rem;
    color: var(--color-text-grey);
    line-height: 1.4;
}

.key-hint {
    background: var(--color-primary-accent);
    color: white;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.8rem;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .drum-pads-modal {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .drum-kit-layout {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(6, 70px);
        grid-template-areas:
            "crash ride ."
            "tom1 tom2 floor-tom"
            "hihat hihat-open kick"
            "snare . ."
            ". hihat-foot ."
            ". . .";
        gap: var(--spacing-sm);
        max-width: 100%;
    }

    .drum-pad {
        font-size: 0.85rem;
    }

    .pad-label {
        font-size: 0.8rem;
    }

    .key-display {
        font-size: 0.7rem;
        padding: 1px 4px;
    }

    .finger-hint {
        font-size: 0.6rem;
    }

    .drum-pads-controls {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .drum-pads-controls .control-group {
        width: 100%;
        justify-content: space-between;
    }
}

/* Disable main app shortcuts when drum pads active */
body.drum-pads-active {
    overflow: hidden;
}

/* El Malacara Logo Footer */
.donate-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo-modern-footer {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #1f2937;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: var(--spacing-medium) var(--spacing-xl);
    border-radius: var(--border-radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-medium);
    transition: all var(--transition-fast);
    gap: 0.4rem;
}

.logo-modern-footer:hover {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.logo-img-footer {
    height: 24px;
    width: auto;
    border-radius: 3px;
}

.logo-modern-footer span {
    color: #1f2937;
    font-weight: 600;
}

@media (max-width: 768px) {
    .donate-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .logo-modern-footer {
        font-size: 0.85rem;
    }
    
    .logo-img-footer {
        height: 20px;
    }
}

/* Playback Manager - Disabled States */
.grid-container.disabled,
.song-mode-panels.disabled,
.pattern-panels.disabled {
    pointer-events: none;
    opacity: 0.5;
    position: relative;
    user-select: none;
    transition: opacity 0.3s ease;
}

.grid-container.disabled::before,
.song-mode-panels.disabled::before,
.pattern-panels.disabled::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 10;
    pointer-events: none;
}

/* Disabled buttons styling */
button:disabled,
button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Disabled form elements */
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Song flow disabled state */
.song-builder.disabled,
.song-flow-control.disabled {
    pointer-events: none;
    opacity: 0.5;
    position: relative;
    transition: opacity 0.3s ease;
}

.song-builder.disabled::before,
.song-flow-control.disabled::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 10;
    pointer-events: none;
}

/* Pattern cells disabled state */
.pattern-cell.disabled {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

/* Grid playback disabled state - pattern editing still works */
.grid-container.playback-disabled {
    position: relative;
}

.grid-container.playback-disabled::after {
    content: '⚠️ Grid playback disabled during song mode';
    position: absolute;
    top: 5px;
    right: 10px;
    background: rgba(255, 140, 0, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    z-index: 15;
    pointer-events: none;
}

/* Playback mode indicator */
.playback-mode-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.playback-mode-indicator.active {
    opacity: 1;
}

.playback-mode-indicator.grid-mode {
    background: rgba(34, 139, 34, 0.9);
}

.playback-mode-indicator.song-mode {
    background: rgba(255, 140, 0, 0.9);
}

/* Metronome Visual Feedback */
.metronome-beat {
    animation: metronome-pulse 0.1s ease-out;
}

@keyframes metronome-pulse {
    0% { transform: scale(1); box-shadow: none; }
    50% { transform: scale(1.02); box-shadow: inset 0 0 0 2px var(--color-accent, #00ff41); }
    100% { transform: scale(1); box-shadow: none; }
}

/* Recording Unit Toggle */
.recording-unit-toggle {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.recording-unit-toggle label {
    font-weight: normal;
    color: var(--color-text-secondary, #ccc);
}

.recording-unit-toggle select {
    background: var(--color-input-background, #333);
    color: var(--color-text, #fff);
    border: 1px solid var(--color-border, #555);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.9em;
}

/* Help Icon Styles */
#helpIcon {
    cursor: pointer;
    font-size: 1.2em; /* Match inline style */
    margin-left: 10px; /* Match inline style */
    user-select: none; /* Match inline style */
    color: var(--color-secondary-accent, #FFA500); /* Use accent color, fallback if var not defined */
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

#helpIcon:hover {
    background-color: var(--color-input-background, #333); /* Subtle hover effect */
}

/* Tutorial Modal Styles */
#tutorialModal {
    display: none; /* Hidden by default, shown by JS */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75); /* Darker overlay */
    z-index: 1000; /* Ensure it's on top */
    display: flex; /* Using flex to center content */
    align-items: center;
    justify-content: center;
    padding: 20px; /* Padding for smaller screens */
    box-sizing: border-box;
}

.modal-content {
    background-color: var(--color-panel-background, #282828); /* Slightly different from main panel for depth */
    color: var(--color-text-light, #f0f0f0);
    padding: 25px 30px;
    border-radius: var(--border-radius-large, 10px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    width: 90%;
    max-width: 650px; /* Slightly wider max */
    max-height: 85vh; /* Max height */
    overflow-y: auto; /* Scroll for content overflow */
    position: relative; /* For potential absolute positioned elements inside */
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--color-primary-accent, #00BFFF); /* Primary accent for title */
    font-size: 1.6em;
    text-align: center;
}

.modal-content #tutorialContentLoading {
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.modal-content #tutorialContent {
    /* Styles for actual tutorial text will be based on its content (p, ul, etc.) */
    line-height: 1.6;
}

.modal-content #tutorialContent h4 {
    color: var(--color-secondary-accent, #FFA500);
    margin-top: 15px;
    margin-bottom: 5px;
}

.modal-content #tutorialContent p {
    margin-bottom: 10px;
}

.modal-content #tutorialContent ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

.modal-content #closeTutorial {
    display: block;
    margin: 25px auto 0 auto; /* Centered button */
    padding: 12px 20px;
    background-color: #0056b3; /* Darker blue for better contrast with white text */
    border: none;
    color: white;
    font-weight: bold;
    border-radius: var(--border-radius-medium, 6px);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.modal-content #closeTutorial:hover {
    background-color: #004085; /* A slightly darker shade of the new blue for hover */
}

/* Tutorial Section Styles */
.tutorial-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--color-panel-background, #1a1a1a);
    border-radius: var(--border-radius-medium, 8px);
    border: 1px solid var(--color-border, #444);
}

.tutorial-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--color-primary-accent, #00BFFF);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tutorial-section .icon {
    font-size: 1.2rem;
}

.tutorial-subsection {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--color-background, #121212);
    border-radius: 6px;
    border-left: 3px solid var(--color-primary-accent, #00BFFF);
}

.tutorial-subsection h4 {
    margin: 0 0 0.8rem 0;
    color: var(--color-text-light, #f0f0f0);
    font-size: 1.1rem;
    font-weight: 600;
}

.key-layout {
    background: var(--color-panel-background, #1a1a1a);
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.key-row {
    display: flex;
    justify-content: space-between;
    margin: 0.5rem 0;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--color-border, #444);
}

.key-row:last-child {
    border-bottom: none;
}

.key {
    background: var(--color-primary-accent, #00BFFF);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-weight: bold;
    min-width: 2rem;
    text-align: center;
}

.instrument {
    color: var(--color-text-light, #f0f0f0);
    font-weight: 500;
}

.feature-highlight {
    background: linear-gradient(90deg, rgba(0, 191, 255, 0.2), transparent);
    border-left: 3px solid var(--color-primary-accent, #00BFFF);
    padding: 0.8rem 1rem;
    margin: 1rem 0;
    border-radius: 0 6px 6px 0;
}

.pro-tip {
    background: linear-gradient(90deg, rgba(40, 167, 69, 0.2), transparent);
    border-left: 3px solid var(--color-success, #28a745);
    padding: 0.8rem 1rem;
    margin: 1rem 0;
    border-radius: 0 6px 6px 0;
}

.pro-tip .icon {
    color: var(--color-success, #28a745);
}

@media (max-width: 768px) {
    .tutorial-section {
        padding: 1rem;
        margin: 1rem 0;
    }

    .tutorial-subsection {
        padding: 0.8rem;
    }

    .key-layout {
        font-size: 0.8rem;
        padding: 0.8rem;
    }

    .key-row {
        flex-direction: column;
        gap: 0.3rem;
    }

    .key {
        display: inline-block;
        margin-right: 0.5rem;
    }
}

/* Visual feedback for long press */
.pattern-cell.long-press-active {
    background-color: rgba(255, 255, 255, 0.1) !important; /* Subtle overlay */
    transform: scale(2.5) !important; /* Very large enlargement */
    transition: none !important; /* Instant visual change */
    z-index: 100; /* Ensure it's on top */
    will-change: transform;
}

/* Modal Overlay for Reconciliation and other dialogs */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-header {
    padding: 10px 20px;
    border-bottom: 1px solid #444;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
    padding: 10px 20px;
    border-top: 1px solid #444;
}

.modal-footer button {
    padding: 12px 20px;
    font-weight: bold;
    border-radius: var(--border-radius-medium, 6px);
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.modal-footer button:active {
    transform: scale(0.98);
}

.button-primary {
    background-color: #0056b3;
    color: white;
}

.button-primary:hover {
    background-color: #004085;
}

.button-secondary {
    background-color: #555;
    color: white;
}

.button-secondary:hover {
    background-color: #444;
}
