:root {
    --bg-dark: #0a0a0a;
    --bg-panel: #141414;
    --text-main: #e0e0e0;
    --text-muted: #888888;
    --accent: #00ffcc;
    --accent-hover: #00ccaa;
    --danger: #ff3333;
    --danger-bg: rgba(255, 51, 51, 0.1);
    --warning: #ffcc00;
    --success: #33ff33;
    --border: #333333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'JetBrains Mono', monospace;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.dashboard-wrapper {
    display: flex;
    width: 95vw;
    max-width: 1200px;
    height: 90vh;
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    /* Bords carrés, pas de border-radius */
}

/* SIDEBAR */
.sidebar {
    width: 320px;
    background-color: #0d0d0d;
    border-right: 1px solid var(--border);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.logo h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.3);
}

.logo span {
    font-size: 12px;
    color: var(--text-muted);
}

h3 {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 12px;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 5px;
}

.status-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

/* TOGGLE SWITCH - Style Brutaliste */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #000;
    padding: 15px;
    border: 1px solid var(--border);
}

.toggle-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.toggle-label.active-secure { color: var(--success); }
.toggle-label.active-vuln { color: var(--danger); text-shadow: 0 0 5px rgba(255, 51, 51, 0.5); }

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    border: 1px solid var(--border);
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--danger);
    transition: .2s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 2px;
    bottom: 2px;
    background-color: #000;
    transition: .2s;
}

input:checked + .slider {
    background-color: var(--success);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

/* BUTTONS */
.attack-simulation {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-action {
    display: block;
    width: 100%;
    padding: 14px 16px;
    background-color: #000;
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    text-transform: uppercase;
}

.btn-action:hover {
    background-color: var(--border);
}

.btn-action.safe:hover { border-color: var(--accent); color: var(--accent); }
.btn-action.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-action.warning:hover { border-color: var(--warning); color: var(--warning); }

/* MAIN CHAT AREA */
.chat-interface {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
}

.chat-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0d0d0d;
}

.chat-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.system-status {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border: 1px solid currentColor;
}

.system-status.secure { color: var(--success); }
.system-status.vuln { color: var(--danger); background: var(--danger-bg); }

.chat-box {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 15px;
    max-width: 90%;
}

.msg-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: #000;
}

.system-msg .msg-avatar { color: var(--accent); border-color: var(--accent); }
.user-msg .msg-avatar { color: var(--text-main); }
.error-msg .msg-avatar { color: var(--danger); border-color: var(--danger); }

.user-msg {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-content {
    background: #000;
    padding: 14px 18px;
    border: 1px solid var(--border);
    line-height: 1.6;
    font-size: 14px;
    color: var(--text-main);
}

.user-msg .msg-content { border-color: var(--text-muted); }
.error-msg .msg-content { border-color: var(--danger); color: var(--danger); }
.system-msg .msg-content { border-color: var(--accent); }

.input-area {
    padding: 24px 30px;
    background: #0d0d0d;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 15px;
}

.prompt-symbol {
    color: var(--accent);
    font-weight: bold;
    font-size: 18px;
}

#user-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 0;
    font-size: 15px;
    outline: none;
}

#user-input:focus {
    border-bottom-color: var(--accent);
}

#send-btn {
    background: var(--text-main);
    color: #000;
    border: none;
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
}

#send-btn:hover { background: var(--accent); }

/* MODAL DOCUMENTATION */
.modal-overlay {
    display: none; /* Caché par défaut */
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--accent);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.2);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px dashed var(--accent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000;
}

.modal-header h2 {
    color: var(--accent);
    font-size: 18px;
}

#close-modal {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-weight: bold;
}

#close-modal:hover {
    background: var(--danger);
    color: #fff;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    color: var(--text-main);
}

.modal-body h3 {
    color: var(--accent);
    margin-top: 25px;
    margin-bottom: 10px;
    border-bottom: none;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    color: var(--text-muted);
}

.modal-body pre {
    background: #000;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: 15px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.modal-body code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: #e0e0e0;
}

/* ==========================================
   RESPONSIVE DESIGN (Mobiles & Tablettes)
   ========================================== */
@media screen and (max-width: 850px) {
    body {
        align-items: flex-start;
    }

    .dashboard-wrapper {
        flex-direction: column;
        height: 100%;
        min-height: 100vh;
        width: 100vw;
        border: none;
        border-radius: 0;
    }

    .sidebar {
        width: 100%;
        padding: 15px;
        gap: 15px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
        max-height: none; /* Laisse le contenu définir la hauteur */
    }

    .attack-simulation {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .btn-action {
        flex: 1 1 calc(50% - 5px); /* Boutons côte à côte sur tablette */
        padding: 10px;
        font-size: 11px;
    }

    .chat-interface {
        /* Permet à la zone de chat de prendre tout l'espace restant */
        flex-grow: 1; 
        min-height: 50vh; 
    }

    .chat-header {
        padding: 15px;
    }

    .chat-box {
        padding: 15px;
        flex-grow: 1;
    }

    .input-area {
        padding: 15px;
        position: sticky;
        bottom: 0;
    }
}

@media screen and (max-width: 500px) {
    .btn-action {
        flex: 1 1 100%; /* Boutons empilés sur petit mobile */
    }
    
    .chat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .logo h2 { font-size: 20px; }
    
    .toggle-container {
        flex-direction: column;
        gap: 10px;
    }
}
