:root {
    --bg-dark: #090d16;
    --card-bg: rgba(18, 24, 38, 0.85);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #00f2fe;
    --primary-glow: rgba(0, 242, 254, 0.35);
    --primary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --danger: #ff3366;
    --danger-glow: rgba(255, 51, 102, 0.35);
    --success: #00e676;
    --success-glow: rgba(0, 230, 118, 0.4);
    --warning: #ffab00;
    --text-main: #f0f4f8;
    --text-muted: #8292a2;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 20px;
}

/* Neutralise tout element parasite injecte dans body */
body > *:not(.screen):not(.modal-backdrop):not(.background-glow):not(script) {
    display: none !important;
    visibility: hidden !important;
}

/* Arriere-plan halo */
.background-glow {
    position: fixed;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
}

.screen {
    width: 100%;
    position: relative;
    z-index: 1;
}

.hidden {
    display: none !important;
}

/* Cartes communes */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

/* 1. Ecran d'Authentification */
#auth-screen {
    max-width: 420px;
}

.auth-card {
    padding: 32px 28px;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo .tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
    margin-bottom: 24px;
}

.input-group {
    text-align: left;
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.95rem;
    color: #fff;
    outline: none;
    transition: all 0.25s ease;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

/* Case a cocher stylisee */
.checkbox-container {
    margin: 18px 0 22px 0;
    text-align: left;
}

.custom-checkbox-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.custom-checkbox-wrapper:hover {
    color: var(--text-main);
}

.custom-checkbox-wrapper input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-box {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.5);
    border: 1.5px solid rgba(0, 242, 254, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.custom-checkbox-wrapper input:checked + .checkbox-box {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.custom-checkbox-wrapper input:checked + .checkbox-box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #05101a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.error-msg {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--danger);
    font-weight: 600;
}

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px 20px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.25s ease;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #05101a;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--card-border);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger-outline {
    background: rgba(255, 51, 102, 0.06);
    color: var(--danger);
    border: 1px solid rgba(255, 51, 102, 0.3);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
}

.btn-danger-outline:hover {
    background: rgba(255, 51, 102, 0.15);
    border-color: var(--danger);
}

.btn-danger-outline:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    pointer-events: none;
}

.btn-danger-solid {
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 18px;
    font-weight: 700;
    cursor: pointer;
}

.btn-icon-add {
    background: rgba(0, 242, 254, 0.12);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--primary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.btn-icon-add:hover {
    background: var(--primary);
    color: #05101a;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* 2. Dashboard Layout (3 Colonnes) */
.dashboard-wrapper {
    max-width: 1120px;
    padding: 0;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 14px 24px;
}

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

.brand-name {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

.pulse-dot {
    width: 9px;
    height: 9px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--primary);
}

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

.user-badge {
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.25);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--primary);
    font-weight: 600;
}

/* Grille 3 Colonnes */
.dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    gap: 20px;
    align-items: stretch;
}

/* Colonne Gauche : Sidebar PC */
.sidebar-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
}

.sidebar-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.pc-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pc-nav-item {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.pc-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--card-border);
}

.pc-nav-item.active {
    background: rgba(0, 242, 254, 0.08);
    border-color: rgba(0, 242, 254, 0.35);
}

.pc-nav-name {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Colonne Centre : Main PC Card */
.main-pc-card {
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 480px;
}

.pc-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 18px;
}

.pc-detail-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.pc-meta-tags {
    display: flex;
    gap: 10px;
}

.mono-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--card-border);
    padding: 3px 8px;
    border-radius: 6px;
    color: var(--text-muted);
}

/* Badge Statut */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.4);
    font-size: 0.85rem;
    font-weight: 700;
}

.status-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #666;
    transition: all 0.3s;
}

.status-indicator.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success-glow);
}

.status-indicator.offline {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger-glow);
}

.status-indicator.booting {
    background: var(--warning);
    box-shadow: 0 0 10px rgba(255, 171, 0, 0.5);
    animation: blink 1s infinite alternate;
}

/* Bouton Power Principal */
.power-control-area {
    text-align: center;
    padding: 30px 0;
}

.power-ring-container {
    display: inline-block;
    padding: 16px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.08) 0%, transparent 70%);
}

.power-btn {
    width: 180px;
    height: 180px;
    min-width: 180px;
    min-height: 180px;
    padding: 12px;
    border-radius: 50%;
    overflow: hidden;
    box-sizing: border-box;
    background: linear-gradient(145deg, #161f33, #0f1624);
    border: 2px solid rgba(0, 242, 254, 0.35);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin: 0 auto;
}

.power-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 0 35px var(--primary-glow);
    transform: scale(1.03);
}

.power-btn:active {
    transform: scale(0.95);
    box-shadow: 0 0 15px var(--primary);
}

.power-btn.active {
    border-color: var(--success);
    color: var(--success);
    box-shadow: 0 0 30px var(--success-glow);
    cursor: default;
}

.power-btn.active:hover {
    transform: none;
    box-shadow: 0 0 30px var(--success-glow);
    border-color: var(--success);
}

.power-btn:disabled {
    opacity: 0.9;
    cursor: not-allowed;
}

.power-icon {
    width: 50px;
    height: 50px;
    stroke: currentColor;
    flex-shrink: 0;
}

.btn-caption {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    max-width: 120px;
    text-align: center;
    line-height: 1.25;
    word-break: break-word;
    white-space: normal;
    display: block;
    padding: 0 4px;
    user-select: none;
}

.power-hint {
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Zone Securite / Arret Force */
.safety-zone {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.safety-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.safety-info strong {
    color: var(--text-main);
}

/* Colonne Droite : Journal Agrandi */
.logs-sidebar-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
}

.log-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
}

.log-list-expanded {
    list-style: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    flex: 1;
    max-height: 390px;
    overflow-y: auto;
    padding-right: 4px;
}

.log-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #a4b4c4;
    line-height: 1.35;
}

.log-item.initial {
    color: var(--text-muted);
    font-style: italic;
}

/* Modales */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal-card {
    max-width: 400px;
    padding: 28px;
    text-align: left;
}

.modal-card h3 {
    margin-bottom: 8px;
    color: #fff;
    font-size: 1.15rem;
}

.modal-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

/* Responsive Tablette & Mobile */
@media (max-width: 960px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .safety-zone {
        flex-direction: column;
        align-items: stretch;
    }
}
