/* dRS Style Studio - Dark Glassmorphism CSS Design System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --bg-main: #060913;
    --bg-card: rgba(13, 20, 38, 0.55);
    --bg-card-hover: rgba(18, 27, 51, 0.7);
    --border-color: rgba(255, 255, 255, 0.05);
    --border-glow: rgba(0, 242, 254, 0.35);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Neon Glow Accent Colors */
    --accent-cyan: #00f2fe;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    
    /* Section specific colors */
    --color-intro: #f59e0b;
    --color-main: #10b981;
    --color-fill: #3b82f6;
    --color-break: #8b5cf6;
    --color-ending: #ef4444;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
}

h1, h2, h3, h4, .title-font {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Glassmorphism layouts */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.08);
}

.glow-border-active {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px var(--border-glow);
}

/* Main Layout Grid */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px;
    gap: 16px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    height: 72px;
}

.app-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* dRS Invent. Logo — ESP32 style typography */
.drs-logo-mark {
    display: flex;
    align-items: baseline;
    gap: 0;
    line-height: 1;
    letter-spacing: 0;
    /* Subtle glow matching ESP32 COL_CYAN */
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.35));
}

.drs-logo-drs {
    font-family: 'Outfit', 'D-DIN', sans-serif;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--accent-cyan);       /* COL_CYAN — #00f2fe */
    letter-spacing: 2px;
    text-transform: uppercase;
}

.drs-logo-invent {
    font-family: 'Outfit', 'D-DIN', sans-serif;
    font-size: 1.55rem;
    font-weight: 600;
    color: #ffffff;                  /* COL_WHITE */
    letter-spacing: 1px;
    margin-left: 6px;                /* pad_column: 6 */
}

.drs-logo-divider {
    width: 1px;
    height: 32px;
    background: var(--border-color);
    margin: 0 14px;
    opacity: 0.6;
}

.drs-app-name-block {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.1;
}

.drs-app-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.drs-app-sub {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.style-name-badge {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.2);
    color: var(--accent-cyan);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: 12px;
}

.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    transition: var(--transition-smooth);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    color: #060913;
    border: none;
    font-weight: 600;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 0 18px rgba(0, 242, 254, 0.45);
    transform: translateY(-1px);
}

.btn-accent {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.1);
    color: #c084fc;
}

.btn-accent:hover {
    background: rgba(139, 92, 246, 0.2);
}

.btn-icon-only {
    padding: 8px;
    justify-content: center;
}

/* Workspace Panels */
.workspace-grid {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    gap: 16px;
    flex: 1;
    min-height: 0; /* Important for flex child scrollability */
}

.panel-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Sections Panel styling */
.section-card {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.section-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--text-muted);
}

.section-card.active::before {
    width: 6px;
}

/* Dynamic colors depending on section kind */
.section-kind-0::before { background-color: var(--color-intro); }
.section-kind-1::before { background-color: var(--color-main); }
.section-kind-2::before { background-color: var(--color-fill); }
.section-kind-3::before { background-color: var(--color-break); }
.section-kind-4::before { background-color: var(--color-ending); }

.section-card.active {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
}

.section-row-1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.section-bars-badge {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.section-row-2 {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.section-details-form {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--border-color);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-smooth);
}

select {
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-smooth);
}

select option {
    background-color: #0d1324;
    color: #f1f5f9;
}

input:focus {
    border-color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.06);
}

select:focus {
    border-color: var(--accent-cyan);
    background: #1e293b;
}

/* Playback Control Bar */
.playback-bar {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

.playback-controls {
    display: flex;
    gap: 8px;
}

.play-badge {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* MIDI Mixer Grid */
.mixer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    padding: 16px;
}

.channel-strip {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    position: relative;
}

.channel-strip.active {
    border-color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.02);
}

.channel-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.channel-num {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.channel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: var(--transition-smooth);
}

.channel-indicator.active {
    background-color: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
}

.channel-role-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
}

.role-drum { border: 1px solid var(--accent-pink); color: var(--accent-pink); }
.role-bass { border: 1px solid var(--accent-blue); color: var(--accent-blue); }
.role-chord { border: 1px solid var(--accent-cyan); color: var(--accent-cyan); }
.role-phrase { border: 1px solid var(--accent-purple); color: var(--accent-purple); }
.role-pad { border: 1px solid var(--color-intro); color: var(--color-intro); }
.role-bypass { border: 1px solid var(--text-muted); color: var(--text-muted); }

.channel-note-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* CASM Settings Editor styling */
.casm-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.casm-toggle-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 3px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.toggle-option {
    text-align: center;
    padding: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.toggle-option.active {
    background: var(--accent-cyan);
    color: #060913;
}

.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    user-select: none;
}

.checkbox-item input {
    cursor: pointer;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #0d1324;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: 440px;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: var(--transition-smooth);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Drag & Drop Overlay style */
.drag-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 242, 254, 0.1);
    border: 3px dashed var(--accent-cyan);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.drag-overlay.active {
    display: flex;
}

/* Visual piano-roll or note activity grid in Mixer area */
.midi-visualizer-container {
    height: 120px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.midi-visualizer-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Dual Range input styling or fallback simple inputs */
.limit-sliders {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.limit-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-family: var(--font-body);
    font-weight: 500;
}

/* Mute / Solo active button styles */
.btn-mute.active {
    background: #ef4444 !important;
    color: #fff !important;
    border-color: #ef4444 !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.btn-solo.active {
    background: #f59e0b !important;
    color: #fff !important;
    border-color: #f59e0b !important;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}
