:root {
    --primary: #00f2fe;
    --secondary: #4facfe;
    --accent: #ff2a5f;
    --bg-dark: #09121b;
    --panel-bg: rgba(20, 30, 48, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    
    --step-off: #1b2838;
    --step-on: #00f2fe;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    color: var(--text-main);
    overflow-x: hidden;
}

.main-split {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    align-items: stretch;
}

/* === SOL PANEL (KONTROLLER) === */
.left-panel {
    flex: 6;
    background: linear-gradient(135deg, var(--bg-dark), #1b2838, #2a405a);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.drum-app {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.app-header { text-align: center; }
.app-header h1 {
    font-size: 2.8rem;
    font-weight: 900;
    margin-bottom: 0.3rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}
.app-header p { color: var(--text-muted); font-size: 1rem; }

.keys {
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
}

.key {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.8rem 0.6rem;
    min-width: 70px;
    flex: 0 0 auto;
    text-align: center;
    cursor: pointer;
    transition: all 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.key.playing {
    transform: scale(1.1) translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
    background: rgba(0, 242, 254, 0.1);
}
.key kbd { display: block; font-size: 1.5rem; font-weight: 700; margin-bottom: 0.3rem; }
.key .sound { font-size: 0.65rem; letter-spacing: 1px; color: var(--primary); text-transform: uppercase; }

/* SEQUENCER NOTEBOOK */
.notebook-container {
    background: var(--panel-bg);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    backdrop-filter: blur(15px);
}

.controls {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.transport, .db-controls, .settings-controls { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }

input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
}
input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -6px;
}
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.bpm-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0,0,0,0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.85rem;
}
.btn:hover { background: rgba(255,255,255,0.1); border-color: white; }
.play-btn { background: rgba(0, 242, 254, 0.1); border-color: var(--primary); color: var(--primary); }
.play-btn:hover { background: var(--primary); color: var(--bg-dark); }
.stop-btn { background: rgba(255, 42, 95, 0.1); border-color: var(--accent); color: var(--accent); }
.stop-btn:hover { background: var(--accent); color: white; }
.save-btn { background: rgba(79, 172, 254, 0.1); border-color: var(--secondary); color: var(--secondary); }
.save-btn:hover { background: var(--secondary); color: white; }

input[type="number"], input[type="text"], select {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.6rem;
    border-radius: 8px;
    font-family: inherit;
    outline: none;
    font-size: 0.85rem;
}
input[type="number"] { width: 60px; border:none; background: transparent; padding: 0.2rem; font-weight: bold; }
select { cursor: pointer; }
select option { background: var(--bg-dark); }

/* GRID */
.sequencer-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.seq-header-row, .seq-row {
    display: flex;
    align-items: center;
}

.seq-label {
    width: 80px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.seq-steps-header, .seq-steps-container {
    display: flex;
    flex: 1;
    gap: 10px;
}

.seq-beat-group {
    display: flex;
    flex: 1;
    gap: 4px;
    background: rgba(255,255,255,0.03);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.07);
    transition: 0.3s;
}

.light-mode .seq-beat-group {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.05);
}

.seq-beat-group:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--primary);
}

.light-mode .seq-beat-group:hover {
    background: rgba(0,0,0,0.04);
}

.step-indicator {
    flex: 1;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding-bottom: 0.3rem;
    transition: color 0.1s;
}
.step-indicator.active {
    color: var(--primary);
    font-weight: 900;
}

.seq-step {
    flex: 1;
    height: 25px;
    background: var(--step-off);
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.1s;
}
.seq-step:hover { background: rgba(255,255,255,0.1); }
.seq-step.active {
    background: var(--step-on);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}
.seq-step.playing-cursor {
    border-color: white;
    transform: scale(1.1);
}

/* Beat Gruplaması (4x4x4x4 yapısı) */
/* Artık HTML içinde div ile sağlandığı için ekstra margin-right gerekmez */


/* === SAÄž PANEL (GÃ–RSEL BATERÄ°) === */
.right-panel {
    flex: 4;
    background: radial-gradient(circle, #1a2530 0%, #000 100%);
    box-shadow: -15px 0 30px rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    border-left: 2px solid #333;
    position: sticky;
    top: 0;
    height: 100vh;
}

.drum-svg {
    width: 100%;
    max-width: 500px;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.8));
    overflow: visible;
}

.svg-zone {
    transform-box: fill-box;
    transform-origin: center;
    transition: all 0.08s ease-out;
    cursor: pointer;
}

/* Ortak Parlama Efekti */
.svg-zone.flash {
    transform: scale(1.15);
    filter: drop-shadow(0 0 25px #00f2fe) brightness(1.8);
}

/* Spesifik Parlamalara Ã–zelleÅŸtirmeler */
#zone-kick.flash { filter: drop-shadow(0 0 35px #ff2a5f) brightness(1.5); }
#zone-snare.flash { filter: drop-shadow(0 0 25px #fff) brightness(1.7); }
#zone-tom.flash { filter: drop-shadow(0 0 25px #4facfe) brightness(1.8); transform: scale(1.1); }
#zone-tom2.flash { filter: drop-shadow(0 0 25px #4facfe) brightness(1.8); transform: scale(1.1); }
#zone-tom3.flash { filter: drop-shadow(0 0 25px #4facfe) brightness(1.8); transform: scale(1.1); }
#zone-boom.flash { filter: drop-shadow(0 0 25px #ff6a00) brightness(1.8); transform: scale(1.1); }
#zone-hihat.flash { filter: drop-shadow(0 0 25px #ffdf00) brightness(1.5); transform: scale(1.05) translateY(-5px); }
#zone-openhat.flash { filter: drop-shadow(0 0 30px #ffdf00) brightness(1.8); transform: scale(1.1) translateY(-10px); }
#zone-ride.flash { filter: drop-shadow(0 0 30px #ffdf00) brightness(1.5); transform: scale(1.05) rotate(5deg); }
#zone-tink.flash { filter: drop-shadow(0 0 20px #fff) brightness(2); transform: scale(1.2); }
#zone-clap.flash { filter: drop-shadow(0 0 30px #ff2a5f) brightness(1.5); transform: scale(1.3); }
/* ====== TIMELINE ÇUBUĞU ====== */
.timeline-wrapper {
    margin-top: 1.5rem;
    background: rgba(20, 20, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(10px);
}
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.timeline-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #4facfe;
}
.timeline-controls {
    display: flex;
    gap: 0.5rem;
}
.timeline-track {
    min-height: 80px;
    background: #090910;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    align-items: center;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}
#tl-empty-text {
    color: #666;
    font-size: 0.9rem;
    margin: auto;
    font-style: italic;
}

/* ====== AYDINLIK (LIGHT) MOD PRO ====== */
body.light-mode {
    --bg-dark: #f0f4f8;
    --panel-bg: rgba(255, 255, 255, 0.95);
    --border-color: #dde3e9;
    --text-main: #333333;
    --text-muted: #6c757d;
    --step-off: #e9ecef;
    --step-on: #1a73e8;
    color: var(--text-main);
}

body.light-mode .left-panel { background: linear-gradient(135deg, #e4eef5, #f8fbfd, #ffffff); }
body.light-mode .right-panel { background: radial-gradient(circle, #f4f7f9 0%, #c9d6df 100%); box-shadow: -15px 0 30px rgba(0,0,0,0.03); }

/* Butonlar */
body.light-mode .btn {
    background: #ffffff;
    border-color: #d1d5db;
    color: #4b5563;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
body.light-mode .btn:hover { background: #f3f4f6; color: #111827; border-color: #9ca3af; }

body.light-mode .play-btn { background: #e0f2fe; color: #0284c7; border-color: #bae6fd; }
body.light-mode .play-btn:hover { background: #0284c7; color: #fff; }
body.light-mode .stop-btn { background: #ffe4e6; color: #e11d48; border-color: #fecdd3; }
body.light-mode .stop-btn:hover { background: #e11d48; color: #fff; }

/* Input ve Select Metin Rengi Gorunurluk Sorunu */
body.light-mode .controls input, 
body.light-mode .controls select {
    background: #ffffff;
    color: #111827;
    border: 1px solid #d1d5db;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
}

/* Pad Tuslari (Keys) */
body.light-mode .key {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #1f2937;
    box-shadow: 0 4px 6px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.08);
}
body.light-mode .key:hover { border-color: #3b82f6; }
body.light-mode .key.playing { background: #eff6ff; border-color: #2563eb; color: #1d4ed8; box-shadow: 0 0 15px rgba(59, 130, 246, 0.4); }
body.light-mode .key kbd { color: #111827; }
body.light-mode .key .sound { color: #6b7280; font-weight: 600; }

/* Timeline UI */
body.light-mode .timeline-wrapper { background: rgba(255, 255, 255, 0.85); box-shadow: 0 10px 30px rgba(0,0,0,0.04); }
body.light-mode .timeline-header h3 { color: #0f172a; }
body.light-mode .timeline-track { background: #f1f5f9; box-shadow: inset 0 2px 8px rgba(0,0,0,0.06); }
body.light-mode #tl-empty-text { color: #94a3b8; }

body.light-mode .tl-block {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #334155;
    box-shadow: 0 4px 6px rgba(0,0,0,0.04);
}
body.light-mode .tl-block .block-label { color: #1e293b; }
body.light-mode .tl-block.wait-block { background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 10px, #e2e8f0 10px, #e2e8f0 20px); color: #475569; }
body.light-mode .tl-block.wait-block .block-label { color: #334155; }
body.light-mode .tl-block.playing-block { background: #dcfce7; border-color: #22c55e; box-shadow: 0 0 15px rgba(34, 197, 94, 0.3); }
body.light-mode .tl-block.editing-block { background: #fef3c7; border-color: #f59e0b; box-shadow: 0 0 15px rgba(245, 158, 11, 0.3); }

/* Grid Sequencer */
body.light-mode .notebook-container { background: #ffffff; border: 1px solid #e2e8f0; box-shadow: 0 20px 40px rgba(0,0,0,0.05); }
body.light-mode .seq-step { box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }
body.light-mode .seq-step.active { border-color: transparent; box-shadow: 0 4px 10px rgba(26, 115, 232, 0.3); }
body.light-mode .seq-step.playing-cursor { border-color: #111827; }
body.light-mode .step-indicator { color: #94a3b8; }
body.light-mode .step-indicator.active { color: #2563eb; text-shadow: 0 0 8px rgba(37, 99, 235, 0.4); }
body.light-mode .seq-label { color: #64748b; }

/* ====== MOBIL RESPONSIVE (TELEFON VE TABLET UYUMU) ====== */
@media screen and (max-width: 1024px) {
    .main-split {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    .left-panel {
        padding: 1rem;
    }
    .right-panel {
        padding: 2rem 0;
        border-left: none;
        border-top: 2px solid #333;
    }
    body.light-mode .right-panel {
        border-top: 1px solid #dde3e9;
    }
}

@media screen and (max-width: 768px) {
    .app-header > div {
        flex-direction: column !important;
        text-align: center;
        gap: 1rem;
    }
    
    .app-header h1 {
        font-size: 1.8rem;
    }

    .keys {
        gap: 0.5rem;
    }
    
    .key {
        width: 60px;
        height: 70px;
        padding: 0.5rem;
    }
    
    .key kbd {
        font-size: 1.3rem;
    }
    .key .sound {
        font-size: 0.65rem;
    }

    .controls {
        flex-direction: column;
        gap: 1.5rem;
        align-items: stretch;
    }

    .transport, .settings-controls, .db-controls {
        justify-content: center;
        width: 100%;
        gap: 0.5rem;
    }
    
    .db-controls input {
        flex: 1;
        min-width: 150px;
    }

    /* Timeline Section */
    .timeline-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .timeline-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Defter (Sequencer) Yatay Kaydirma (Scroll) Ayari */
    .notebook-container {
        padding: 1rem 0.5rem;
        width: 100%;
        overflow: hidden; 
    }
    
    .sequencer-grid {
        overflow-x: auto;
        padding-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    .seq-header-row, .seq-row {
        min-width: 600px; /* Mobil ekranda kutulari ezilmekten kurtarir, kaydirma cikarir */
        padding: 0 10px;
    }
    
    /* Sag taraftaki dev bateri SVG'yi kucultme */
    .drum-svg {
        max-width: 320px;
        margin: auto;
    }
}
