:root {
    --bg: #121212; --panel: #1e1e24; --border: #333;
    --text: #e0e0e0; --accent: #3498db; --valid: #2ecc71;
    --danger: #e74c3c; --warning: #f1c40f; --highlight: #9b59b6;
    --scroll-track: #1a1a1a; --scroll-thumb: #444;
}
body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: 'Segoe UI', sans-serif; overflow: hidden; height: 100vh; }

/* LAYOUT HORIZONTAL FLEX (Mobile Friendly) */
#game-container {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow-x: auto; /* Scroll horizontal global */
    overflow-y: hidden;
    scroll-behavior: smooth;
    gap: 1px;
    background: var(--border);
}

/* COLONNES */
.col {
    min-width: 300px; /* Largeur fixe minimale pour lisibilité mobile */
    max-width: 320px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-right: 1px solid var(--border);
    flex-shrink: 0; /* Empêche les colonnes de s'écraser */
}

/* CUSTOM SCROLLBARS (Webkit) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scroll-track); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #666; }

/* Conteneurs internes scrollables (Y) */
.scroll-box { overflow-y: auto; padding-right: 5px; }
.full-height { flex: 1; } /* Prend toute la place restante */

/* HEADER & ELEMENTS */
.header-box { background: var(--panel); padding: 15px; border-radius: 8px; border-bottom: 2px solid var(--accent); margin-bottom: 10px; }
h1 { margin: 0; font-size: 1.2rem; text-transform: uppercase; color: var(--accent); letter-spacing: 2px; }
.stats-row { display: flex; justify-content: space-between; font-size: 1.4rem; font-weight: bold; margin-top: 10px; }
.stats-row-sm { display: flex; justify-content: space-between; font-size: 0.8rem; color: #888; margin-top: 5px; }
.section-title { font-size: 0.8rem; text-transform: uppercase; color: #666; border-bottom: 1px solid #333; padding-bottom: 2px; margin-top: 15px; margin-bottom: 10px; font-weight: bold; }

/* CARTES */
.project-card, .email-item, .contact-item, .employee-card, .catalogue-card, .stock-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 10px; margin-bottom: 8px; position: relative;
}

/* SPECIFIQUE */
#history-log { height: 200px; font-family: monospace; font-size: 0.75rem; color: #aaa; background: #000; padding: 5px; border-radius: 4px; border: 1px solid #333; }
.catalogue-card { border-left: 3px solid var(--valid); }
.stock-card { border-left: 3px solid var(--warning); font-size: 0.8rem; }
.hype-container { background: #000; height: 6px; border-radius: 3px; overflow: hidden; margin: 5px 0; }
.hype-bar { height: 100%; transition: width 0.5s; }

/* BUTTONS & UI */
button { cursor: pointer; }
.btn-refine, .btn-job-hire, .btn-upgrade, .btn-event { width: 100%; border: 1px solid #444; background: #2a2a2a; color: #fff; padding: 6px; border-radius: 4px; margin-top: 2px; }
.btn-valid { background: var(--valid); border: none; color: #000; font-weight: bold; padding: 5px 10px; border-radius: 4px; }
.btn-trash { background: var(--danger); border: none; color: #fff; padding: 5px 10px; border-radius: 4px; }
.btn-pilon { background: #444; color: #fff; border: none; padding: 2px 6px; border-radius: 3px; font-size: 0.7rem; }
.btn-ship { background: var(--accent); color: #fff; width: 100%; border: none; padding: 8px; border-radius: 4px; font-weight: bold; }
.btn-ship:disabled { background: #444; color: #888; }

/* MODAL */
.hidden { display: none !important; }
#modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 2000; display: flex; justify-content: center; align-items: center; }
#modal-box { background: #1e1e24; border: 1px solid #555; width: 90%; max-width: 500px; max-height: 80vh; display: flex; flex-direction: column; border-radius: 8px; }
.modal-header { padding: 15px; border-bottom: 1px solid #333; display: flex; justify-content: space-between; background: #252525; }
.modal-content { overflow-y: auto; padding: 10px; }
.staff-row { display: grid; grid-template-columns: 1fr 80px 80px 60px; gap: 10px; align-items: center; background: #2c3e50; margin-bottom: 5px; padding: 10px; border-radius: 4px; }
.staff-row.busy { opacity: 0.5; pointer-events: none; }

/* ANIMATIONS */
.floater { position: absolute; font-weight: bold; pointer-events: none; animation: floatUp 1s forwards; z-index: 9999; text-shadow: 1px 1px 0 #000; }
@keyframes floatUp { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-30px); opacity: 0; } }


/* NOUVEAUX BOUTONS STATUTS */
.btn-status-0 { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-status-1 { background: transparent; border: 1px solid var(--warning); color: var(--warning); }
.btn-status-2 { background: var(--danger); border: 1px solid var(--danger); color: #fff; }

.btn-logistics { width: 100%; padding: 8px; background: var(--panel); border: 1px dashed #666; color: #aaa; margin-bottom: 10px; cursor: pointer; }
.btn-logistics.active { border-style: solid; border-color: var(--valid); color: var(--valid); background: #1a2e22; }

/* Indicateur livraison bloquée */
.delivery-blocked-box { border: 2px solid var(--danger); background: #3c1f1f; padding: 10px; border-radius: 4px; margin-top: 5px; animation: pulse 1s infinite; }

/* --- GESTION COLONNES & NOTIFICATIONS --- */

/* Transition fluide pour l'ouverture/fermeture */
.col {
    transition: min-width 0.3s ease, max-width 0.3s ease, background 0.3s;
    position: relative;
}

/* État plié (Collapsed) */
.col.collapsed {
    min-width: 50px !important;
    max-width: 50px !important;
    padding: 0;
    cursor: pointer;
    background: #181818;
}

.col.collapsed:hover {
    background: #222;
}

/* Cacher le contenu quand plié, sauf le titre */
.col.collapsed > *:not(.section-title-header) {
    display: none !important;
}

/* Style du header de colonne */
.section-title-header {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #888;
    border-bottom: 1px solid #333;
    padding: 10px;
    margin-bottom: 10px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    white-space: nowrap;
}

/* Rotation du titre quand plié */
.col.collapsed .section-title-header {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    height: 100%;
    width: 100%;
    border-bottom: none;
    border-left: 1px solid #333;
    margin: 0;
    justify-content: center;
    gap: 10px;
}

/* La pastille de notification (Point rouge) */
.notify-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: var(--danger);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--danger);
    opacity: 0;
    transition: opacity 0.3s;
}

.notify-badge.active {
    opacity: 1;
    animation: pulseRed 1s infinite;
}

@keyframes pulseRed {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.4); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* Forcer la 1ère colonne (Dashboard) à rester ouverte */
#col-dashboard.collapsed {
    min-width: 300px !important;
    max-width: 320px !important;
    padding: 10px;
    cursor: default;
}
#col-dashboard.collapsed > * { display: flex !important; } /* Restore flex for dashboard */
#col-dashboard .section-title-header { cursor: default; }