:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --accent-color: #00f2ea; /* Cyan néon */
    --accent-secondary: #ff00ff; /* Magenta néon */
    --record-color: #ff4b2b;
    --surface-light: rgba(255, 255, 255, 0.05);
    --border-radius: 16px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    overflow: hidden; /* Empêche le défilement général sur tablette */
    height: 100vh;
    width: 100vw;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

header {
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px; /* On arrondit un peu le logo pour faire plus moderne */
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo h1 span {
    color: var(--accent-color);
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

#tracks-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.2rem;
    font-style: italic;
    text-align: center;
}

.track-card {
    background: var(--surface-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
    backdrop-filter: blur(10px);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.track-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

/* On stylise notre nouvelle zone de texte pour qu'elle ait l'air magique ! */
.track-name-input {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--accent-color);
    background: transparent;
    border: none;
    border-bottom: 1px dashed rgba(0, 242, 234, 0.3); /* Petite ligne pointillée pour dire "tu peux cliquer ici" */
    font-family: inherit;
    outline: none;
    padding: 2px 0;
    width: 60%;
    transition: border-bottom 0.2s;
}

.track-name-input:focus {
    border-bottom: 1px solid var(--accent-color); /* Ligne pleine quand on écrit dedans ! */
}

.track-timeline {
    height: 40px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    width: 100%;
    position: relative; /* Très important pour positionner les blocs de son pile poil dedans */
    overflow: hidden; /* Empêche les blocs de dépasser si très longs */
    display: flex;
    align-items: center;
}

.timeline-empty-text {
    color: rgba(255,255,255,0.3);
    font-size: 0.8rem;
    font-style: italic;
    padding-left: 10px;
}

.audio-block {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color) 0%, rgba(0,242,234,0.6) 100%);
    position: absolute; /* Il est libre de se placer n'importe où sur l'axe X ou Y */
    top: 0;
    left: 0;
    border-radius: 6px;
    color: var(--bg-color);
    font-weight: bold;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    padding-left: 10px;
    box-shadow: 0 0 10px rgba(0,242,234,0.3);
}

/* Le fameux curseur de temps qui avance ! */
.playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: white;
    box-shadow: 0 0 8px 1px white, 0 0 15px 3px var(--accent-secondary); 
    z-index: 10; /* Pour s'assurer qu'il passe au dessus des blocs de son */
    pointer-events: none; /* Pour ne pas gêner si on clique dessus plus tard */
}

.track-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.track-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    transition: transform 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.track-actions button:hover {
    filter: brightness(1.2);
}

.track-actions button:active {
    transform: scale(0.9);
}

.track-btn-red {
    color: var(--record-color) !important;
}

.track-btn-accent {
    color: var(--accent-color) !important;
}

.track-btn-gray {
    color: rgba(255, 255, 255, 0.5) !important;
}

.track-actions button:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.volume-slider {
    width: 100px;
    accent-color: var(--accent-color);
}

footer {
    background-color: var(--card-bg);
    padding: 20px 30px;
    border-top: 1px solid var(--surface-light);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}

.transport {
    display: flex;
    gap: 30px;
    align-items: center;
}

.btn-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: var(--surface-light);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-circle:active {
    transform: scale(0.9);
}

.btn-circle svg {
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.2));
}

.btn-record {
    background: linear-gradient(135deg, var(--record-color), #bc4e9c);
}

.btn-record:hover {
    box-shadow: 0 0 20px rgba(255, 75, 43, 0.4);
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: none;
    background: var(--surface-light);
    color: var(--accent-color);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.fab:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

.mixer-status {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--surface-light);
}

/* Tablet Optimizations */
@media (min-width: 768px) {
    .logo h1 { font-size: 2rem; }
    .btn-circle { width: 80px; height: 80px; }
    .mixer-status { font-size: 2rem; }
}

/* Le fameux panneau magique de mise à jour ! */
.update-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-color));
    color: var(--bg-color);
    padding: 15px 25px;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0,242,234,0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1000;
    animation: popUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popUp {
    from { opacity: 0; bottom: -50px; }
    to { opacity: 1; bottom: 20px; }
}

.update-toast button {
    background: var(--bg-color);
    color: var(--text-color);
    border: none;
    padding: 8px 15px;
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.update-toast button:active {
    transform: scale(0.9);
}

/* Le petit label secret montrant qu'on évolue avec le temps ! */
.app-version {
    position: fixed;
    bottom: 5px; /* On le baisse un peu plus encore */
    right: 25px;
    font-size: 0.7rem;
    font-family: 'Courier New', Courier, monospace;
    color: rgba(255, 255, 255, 0.4);
    z-index: 2000; /* Devant le mode PRO aussi */
    pointer-events: none; 
}

/* ÉTAPE PRO : Un bouton qui brille comme de l'or ! 🌟 */
.pro-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    color: #3b2f00;
    border: none;
    padding: 6px 14px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3), inset 0 0 5px rgba(255,255,255,0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    margin-left: 20px;
    position: relative;
    overflow: hidden;
}

.pro-badge::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: rotate(45deg);
    animation: goldShine 3s infinite;
}

@keyframes goldShine {
    0% { transform: translateX(-100%) rotate(45deg); }
    20%, 100% { transform: translateX(100%) rotate(45deg); }
}

.pro-badge:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
}

.pro-badge:active {
    transform: scale(0.95);
}

/* ÉTAPE PRO : Le Design de la Console de Mixage Géante ! 🎛️ */
.pro-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1b262c 0%, #0f1a20 100%);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.pro-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255,255,255,0.05);
    padding-bottom: 15px;
}

.btn-back {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

/* ÉTAPE PRO : L'Interface DAW "Cubase" 🎹 */
.pro-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    color: #ccc;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.pro-header {
    background: #232323;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    border-bottom: 1px solid #000;
}

.pro-transport {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-transport {
    background: #333;
    border: 1px solid #000;
    color: #eee;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
}

.btn-record-pro.recording {
    background: #e74c3c;
    color: #fff;
    box-shadow: 0 0 10px #e74c3c;
    animation: pulseRed 1s infinite alternate;
}

@keyframes pulseRed {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

.pro-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.pro-sidebar {
    width: 220px;
    background: #2a2a2a;
    border-right: 2px solid #000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.pro-sidebar-ruler-spacer {
    height: 25px; /* Même hauteur que pro-time-ruler ! */
    background: #222;
    border-bottom: 1px solid #111;
    flex-shrink: 0;
}

.pro-track-header {
    height: 100px; /* On l'agrandit pour les faders */
    border-bottom: 1px solid #000;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: linear-gradient(180deg, #333 0%, #222 100%);
    transition: background 0.2s;
}

.pro-track-header.active { 
    background: #3d3d3d; 
    border-left: 4px solid var(--accent-color);
}

.pro-track-recording-dimmed {
    opacity: 0.3;
    filter: grayscale(1);
    pointer-events: none; /* On empêche de cliquer sur les autres pendant un REC PRO */
}

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

.pro-track-input {
    font-size: 0.8rem;
    font-weight: bold;
    color: #eee;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    width: 140px;
    padding: 2px;
}

.pro-track-input:focus {
    background: #000;
    border-color: #555;
    outline: none;
}

.pro-track-num {
    font-size: 0.6rem;
    color: #888;
}

.pro-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pro-btns-row {
    display: flex;
    gap: 4px;
}

.pro-mini-btn {
    width: 22px;
    height: 22px;
    background: #444;
    border: 1px solid #111;
    color: #aaa;
    font-size: 0.6rem;
    font-weight: 900;
    cursor: pointer;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pro-mini-btn.btn-mute.active { background: #e67e22; color: #fff; }
.pro-mini-btn.btn-solo.active { background: #f1c40f; color: #000; }
.pro-mini-btn.btn-rec.recording-active { 
    background: #ff4b2b; 
    color: #fff;
    box-shadow: 0 0 10px #ff4b2b;
    animation: pro-pulse-rec 1s infinite alternate;
}

@keyframes pro-pulse-rec {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0.7; transform: scale(1.05); }
}

.pro-fader-area {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #111;
    padding: 2px 5px;
    border-radius: 3px;
}

.pro-volume-fader {
    flex: 1;
    appearance: none;
    height: 4px;
    background: #333;
    outline: none;
    border-radius: 2px;
}

.pro-volume-fader::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    background: #ddd;
    border-radius: 2px;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.pro-level-meter {
    width: 40px;
    height: 6px;
    background: #000;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.pro-level-bar {
    position: absolute;
    left: 0;
    height: 100%;
    width: 0%; /* Animé en JS */
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    transition: width 0.1s;
}

.pro-timeline-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1d1d1d;
    overflow: auto;
    position: relative;
}

.pro-time-ruler {
    height: 25px;
    background: #333;
    border-bottom: 1px solid #000;
    position: sticky;
    top: 0;
    z-index: 10;
    background-image: linear-gradient(90deg, #000 1px, transparent 1px);
    background-size: 80px 100%; /* Une mesure toutes les 4 secondes environ à 20px/s */
}

.pro-timeline {
    flex: 1;
    position: relative;
    background-image: 
        linear-gradient(90deg, rgba(0,0,0,0.5) 1px, transparent 1px),
        linear-gradient(rgba(0,0,0,0.5) 1px, transparent 1px);
    background-size: 20px 80px, 100% 80px; /* Grille de 20px (temps) x 80px (pistes) */
}

.pro-playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 10px #fff;
    z-index: 5;
    pointer-events: none;
}

.pro-track-lane {
    height: 100px; /* Aligné avec le header ! */
    border-bottom: 1px solid #111;
    position: relative;
    background-image: 
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,0.01) 1px, transparent 1px);
    background-size: 20px 100px, 100% 20px;
}

.pro-audio-block {
    position: absolute;
    height: 90px; /* Presque toute la hauteur */
    top: 5px; /* Petit espacement en haut et bas */
    background: var(--accent-color);
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    overflow: hidden;
}

/* Simulation de l'onde sonore Waveform (Style Dictaphone) */
.pro-waveform {
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="40"><path d="M0 20 L2 10 L4 30 L6 5 L8 35 L10 15 L12 25 L14 20 L16 30 L18 10 L20 25 L22 15 L24 20" stroke="white" stroke-width="2" fill="none"/></svg>');
    background-repeat: repeat-x;
    background-size: 25px 100%;
    opacity: 0.8;
}

/* On rajoute l'onde aussi sur les blocs de l'écran principal ! */
.audio-block {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color) 0%, rgba(0,242,234,0.6) 100%);
    position: absolute; 
    top: 0;
    left: 0;
    border-radius: 6px;
    color: var(--bg-color);
    font-weight: bold;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    padding-left: 10px;
    box-shadow: 0 0 10px rgba(0,242,234,0.3);
    overflow: hidden;
}

.audio-block::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="50" height="40"><path d="M0 20 L5 5 L10 35 L15 15 L20 25 L25 20 L30 30 L35 10 L40 25 L45 15 L50 20" stroke="black" stroke-opacity="0.2" fill="none"/></svg>');
    background-repeat: repeat-x;
    background-size: 20px 100%;
    pointer-events: none;
}
.pro-media-bay {
    width: 60px;
    background: #222;
    border-left: 1px solid #000;
    display: flex;
    flex-direction: column;
}

.media-tab {
    writing-mode: vertical-rl;
    padding: 15px 5px;
    font-size: 0.7rem;
    cursor: pointer;
    border-bottom: 1px solid #333;
}

.media-tab.active { background: #333; color: #fff; }

/* On masque les anciens styles inutiles */
.pro-grid-main, .pro-grid, .grid-block, .pro-info { display: none; }
