/* ─────────────────────────────────────────────
   West Indies Energy · Configurateur S4W
   Thème Data Center / Tech
───────────────────────────────────────────── */

:root {
    --dc-navy: #2B3990;
    --dc-navy2: #1e2d78;
    --dc-card: #142033;
    --electric: #E63329;
    --electric-dim: #c42820;
    --electric-glow: rgba(230, 51, 41, 0.12);
    --white: #fff;
    --offwhite: #f4f8fc;
    --text: #1a2d44;
    --muted: #6b82a0;
    --border: #dce8f5;
    --border-dark: #1e3a5f;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.12);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--offwhite);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--offwhite); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── NAVBAR ─── */
.navbar {
    background: var(--dc-navy);
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 72px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 24px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.navbar-logo { height: 52px; width: auto; border-radius: 6px; display: block; }
.brand-electric { color: var(--electric); font-weight: 700; font-size: 16px; letter-spacing: 1px; }
.brand-white { color: var(--white); font-weight: 600; font-size: 16px; }
.brand-tag {
    color: var(--muted);
    font-size: 11px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-dark);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
}

.navbar-links {
    display: flex;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link:hover { color: var(--white); background: rgba(255,255,255,0.06); }
.nav-link.active { color: var(--electric); background: var(--electric-glow); }

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.user-email { color: var(--muted); font-size: 12px; }

.badge-admin {
    background: var(--electric-glow);
    color: var(--electric);
    border: 1px solid var(--electric);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.btn-logout {
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    padding: 6px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.btn-logout:hover { color: var(--danger); border-color: var(--danger); }

/* ─── MAIN CONTENT ─── */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ─── FLASH MESSAGES ─── */
.flash-container { margin-bottom: 20px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ─── PAGE HEADER ─── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.2; }
.page-subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }
.electric { color: var(--electric); }

/* ─── BUTTONS ─── */
.btn-primary {
    background: var(--electric);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-primary:hover { background: var(--electric-dim); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,170,255,0.3); }

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--electric); color: var(--electric); }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-icon {
    color: var(--electric);
    text-decoration: none;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.btn-icon:hover { background: var(--electric-glow); border-color: var(--electric); }

/* ─── STATS GRID ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card.highlight { border-color: var(--electric); background: var(--electric-glow); }

.stat-icon { font-size: 28px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ─── SECTIONS ─── */
.section { margin-bottom: 32px; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-header h2 { font-size: 18px; font-weight: 600; }

/* ─── DATA TABLE ─── */
.table-wrapper {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: var(--dc-navy);
    color: var(--muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    text-align: left;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--offwhite); }

.ref-cell { font-family: monospace; font-size: 12px; color: var(--electric); font-weight: 600; }
.price-cell { font-weight: 600; color: var(--text); }
.muted { color: var(--muted); }
.font-medium { font-weight: 500; }

/* ─── BADGES ─── */
.badge-type {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.badge-pilotage { background: #dbeafe; color: #1d4ed8; }
.badge-surveillance { background: #d1fae5; color: #065f46; }

.badge-status {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-nouvelle { background: #fef3c7; color: #92400e; }
.badge-en_cours { background: #dbeafe; color: #1d4ed8; }
.badge-livree { background: #d1fae5; color: #065f46; }

/* ─── EMPTY STATE ─── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); margin-bottom: 20px; }

/* ─── QUICK ACTIONS ─── */
.quick-actions { margin-top: 32px; }
.quick-actions h2 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.action-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    display: block;
}
.action-card:hover { border-color: var(--electric); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.action-icon { font-size: 32px; margin-bottom: 12px; }
.action-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.action-desc { color: var(--muted); font-size: 12px; }

/* ─── LOGIN PAGE ─── */
.login-page {
    background: var(--dc-navy);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 900px;
    width: 100%;
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.4);
    margin: 20px;
}

.login-card { padding: 48px 40px; }

.login-header { margin-bottom: 32px; }
.login-logo { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; }
.login-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-subtitle { color: var(--muted); font-size: 13px; }

.login-form { margin-bottom: 24px; }

.login-footer {
    text-align: center;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.8;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.login-visual {
    background: linear-gradient(135deg, var(--dc-navy) 0%, var(--dc-navy2) 100%);
    padding: 48px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border-dark);
}

.visual-content { text-align: center; color: var(--white); }
.visual-icon { font-size: 56px; margin-bottom: 20px; }
.visual-content h2 { font-size: 20px; font-weight: 700; color: var(--white); margin-bottom: 12px; }
.visual-content p { color: var(--muted); font-size: 14px; margin-bottom: 24px; line-height: 1.7; }

.visual-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.feature {
    background: rgba(0,170,255,0.1);
    border: 1px solid rgba(0,170,255,0.2);
    color: var(--electric);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

/* ─── FORM ELEMENTS ─── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s;
    outline: none;
}
.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--electric);
    box-shadow: 0 0 0 3px var(--electric-glow);
}
.form-group textarea { resize: vertical; }

.required { color: var(--danger); }

.form-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.form-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; }
.form-section h3 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.5px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }

.checkbox-group { }
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: normal; text-transform: none; letter-spacing: 0; }
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--electric); }

/* ─── CONFIGURATEUR ─── */
.configurateur-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.config-panel { display: flex; flex-direction: column; gap: 20px; }

.config-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.step-num {
    width: 28px; height: 28px;
    background: var(--electric);
    color: var(--white);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    flex-shrink: 0;
}
.step-header h2 { font-size: 16px; font-weight: 600; }

/* Type cards */
.type-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.type-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}
.type-card:hover { border-color: var(--electric); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.type-card.selected {
    border-color: var(--electric);
    background: var(--electric-glow);
    box-shadow: 0 0 0 3px rgba(0,170,255,0.15);
}
.type-icon { font-size: 40px; margin-bottom: 12px; }
.type-title { font-weight: 700; font-size: 15px; color: var(--text); margin-bottom: 6px; }
.type-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Puissance */
.puissance-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.puissance-btn {
    cursor: pointer;
}
.puissance-btn input[type=radio] { display: none; }
.puissance-btn span {
    display: block;
    padding: 10px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    transition: all 0.2s;
}
.puissance-btn:hover span { border-color: var(--electric); color: var(--electric); }
.puissance-btn input:checked + span {
    background: var(--electric);
    border-color: var(--electric);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0,170,255,0.3);
}

/* Options table */
.options-table-wrapper {
    overflow-x: auto;
}

.options-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.options-table th {
    background: var(--offwhite);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.options-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.options-table tbody tr:last-child td { border-bottom: none; }
.options-table tbody tr:hover { background: var(--offwhite); }

.opt-label { font-weight: 500; }
.opt-price { color: var(--electric); font-weight: 600; white-space: nowrap; }
.opt-total { font-weight: 600; color: var(--text); }

.qty-input {
    width: 70px !important;
    padding: 6px 10px !important;
    text-align: center;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s;
}
.qty-input:focus { border-color: var(--electric); }

/* Recap panel */
.recap-panel {
    position: sticky;
    top: 80px;
}

.recap-card {
    background: var(--dc-navy);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.recap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-dark);
}
.recap-header h3 { color: var(--white); font-size: 15px; font-weight: 600; }
.recap-live { color: var(--electric); font-size: 11px; font-weight: 600; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.recap-config { padding: 20px; }
.recap-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 16px 0; }

.recap-config-info {
    color: var(--white);
}
.recap-config-type {
    font-size: 16px;
    font-weight: 700;
    color: var(--electric);
    margin-bottom: 4px;
}
.recap-config-puissance { color: var(--muted); font-size: 13px; }

.recap-lines-list {
    padding: 0 20px;
    border-bottom: 1px solid var(--border-dark);
    max-height: 300px;
    overflow-y: auto;
}

.recap-line {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 12px;
}
.recap-line:last-child { border-bottom: none; }
.recap-line-label { color: var(--muted); flex: 1; line-height: 1.4; }
.recap-line.is-base .recap-line-label { color: var(--white); font-weight: 600; }
.recap-line-price { color: var(--white); font-weight: 600; white-space: nowrap; }

.recap-totals { padding: 16px 20px; }
.recap-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
    color: var(--muted);
}
.recap-row span:last-child { color: var(--white); font-weight: 500; }
.remise-row { color: #fca5a5; }
.remise-row span { color: #fca5a5 !important; }
.remise-neg { color: #fca5a5 !important; }

.total-row {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-dark);
    font-size: 16px !important;
    font-weight: 700 !important;
}
.total-row span { color: var(--electric) !important; font-weight: 700 !important; }
.total-row span:first-child { color: var(--white) !important; }

.recap-actions { padding: 16px 20px; border-top: 1px solid var(--border-dark); }
.btn-commander { font-size: 15px; padding: 14px; }
.recap-note { text-align: center; color: var(--muted); font-size: 11px; margin-top: 8px; }

/* ─── MODAL ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}
.modal-icon { font-size: 48px; margin-bottom: 16px; }
.modal h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.modal p { color: var(--muted); margin-bottom: 24px; font-family: monospace; font-size: 16px; color: var(--electric); font-weight: 700; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }

/* ─── ADMIN SPECIFIC ─── */
.inline-form { display: inline-flex; }
.actions-cell { display: flex; align-items: center; gap: 8px; }

.select-sm {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    background: var(--white);
}
.select-sm:focus { border-color: var(--electric); }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    .configurateur-layout { grid-template-columns: 1fr; }
    .recap-panel { position: static; }
    .type-cards { grid-template-columns: 1fr 1fr; }
    .login-container { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .navbar-links { display: none; }
}

/* ── APP FOOTER ── */
.app-footer {
    background: var(--dc-navy);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 16px 24px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.75rem; color: rgba(255,255,255,0.3);
    margin-top: auto;
}
.app-footer a { color: rgba(255,255,255,0.4); text-decoration: none; transition: color 0.2s; }
.app-footer a:hover { color: var(--electric); }

/* ── Bouton annuler commande ── */
.btn-cancel {
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.25);
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}
.btn-cancel:hover {
    background: rgba(220, 38, 38, 0.15);
    border-color: #dc2626;
    transform: translateY(-1px);
}
