/* ============================================================
   EVM — assets/css/style.css
   Feuille de styles principale
   ============================================================ */

/* ---- Variables ------------------------------------------- */
:root {
    --bg-deep:      #070e1a;
    --bg-dark:      #0a1628;
    --bg-card:      #111d35;
    --bg-card2:     #0d1f38;
    --border:       #1e3a5f;
    --border-light: #2a4a75;
    --accent:       #4da6ff;
    --accent-dark:  #1a6fbd;
    --text-primary: #e0e6f0;
    --text-muted:   #8899aa;
    --text-light:   #c0d0e0;
    --success:      #4caf50;
    --error:        #f44336;
    --warning:      #ff9800;
    --info:         #4da6ff;
    --radius:       10px;
    --shadow:       0 8px 30px rgba(0,0,0,.4);
    --font:         'Inter', 'Segoe UI', sans-serif;
}

/* ---- Reset ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 15px;
    line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---- Navbar ---------------------------------------------- */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.nav-logo { height: 40px; }
.nav-title { display: flex; flex-direction: column; }
.nav-title strong { color: var(--accent); font-size: 16px; line-height: 1.2; }
.nav-title small  { color: var(--text-muted); font-size: 11px; }
.navbar-menu { display: flex; align-items: center; gap: 16px; }
.nav-user { color: var(--text-muted); font-size: 14px; }
.btn-nav-logout {
    padding: 7px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
}
.btn-nav-logout:hover {
    border-color: var(--error);
    color: var(--error);
    text-decoration: none;
}

/* ---- Layout ---------------------------------------------- */
.page-wrapper {
    flex: 1;
    display: flex;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 30px 20px;
    gap: 24px;
}
.page-wrapper.full { max-width: 100%; }
.page-wrapper.centered {
    justify-content: center;
    align-items: flex-start;
}

/* ---- Sidebar --------------------------------------------- */
.sidebar {
    width: 240px;
    flex-shrink: 0;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    transition: all .2s;
    text-decoration: none;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: var(--bg-card2);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}
.sidebar-nav .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-section {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 16px 14px 4px;
}

/* ---- Contenu principal ----------------------------------- */
.main-content { flex: 1; min-width: 0; }

/* ---- Cards ----------------------------------------------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ---- Page title ------------------------------------------ */
.page-header {
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}
.page-header p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ---- Formulaires ----------------------------------------- */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(77,166,255,.15);
}
.form-control::placeholder { color: #445566; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ---- Boutons --------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border: none;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
    text-decoration: none;
}
.btn:hover        { opacity: .85; }
.btn:active       { transform: scale(.98); }
.btn-primary      { background: linear-gradient(135deg,#1a6fbd,#0d4f8a); color:#fff; }
.btn-success      { background: linear-gradient(135deg,#1a8a3f,#0d6b2e); color:#fff; }
.btn-danger       { background: linear-gradient(135deg,#bd1a1a,#8a0d0d); color:#fff; }
.btn-warning      { background: linear-gradient(135deg,#bd6b1a,#8a4a0d); color:#fff; }
.btn-secondary    { background: var(--bg-card2); border:1px solid var(--border); color:var(--text-light); }
.btn-sm           { padding: 6px 12px; font-size: 12px; }
.btn-icon         { padding: 7px; border-radius: 6px; }
.btn-full         { width: 100%; justify-content: center; }

/* ---- Badges ---------------------------------------------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: rgba(76,175,80,.15); color:#4caf50; border:1px solid rgba(76,175,80,.3); }
.badge-danger  { background: rgba(244,67,54,.15);  color:#f44336; border:1px solid rgba(244,67,54,.3); }
.badge-warning { background: rgba(255,152,0,.15);  color:#ff9800; border:1px solid rgba(255,152,0,.3); }
.badge-info    { background: rgba(77,166,255,.15); color:#4da6ff; border:1px solid rgba(77,166,255,.3); }
.badge-muted   { background: rgba(136,153,170,.1); color:#8899aa; border:1px solid var(--border); }

/* ---- Tableau --------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    background: var(--bg-card2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(30,58,95,.5);
    color: var(--text-light);
}
tbody tr:hover td { background: rgba(77,166,255,.04); }
tbody tr:last-child td { border-bottom: none; }

/* ---- Alertes inline -------------------------------------- */
.alert {
    padding: 12px 16px;
    border-radius: 7px;
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success { background:rgba(76,175,80,.1);  border:1px solid rgba(76,175,80,.3);  color:#4caf50; }
.alert-error   { background:rgba(244,67,54,.1);  border:1px solid rgba(244,67,54,.3);  color:#f44336; }
.alert-warning { background:rgba(255,152,0,.1);  border:1px solid rgba(255,152,0,.3);  color:#ff9800; }
.alert-info    { background:rgba(77,166,255,.1); border:1px solid rgba(77,166,255,.3); color:#4da6ff; }

/* ---- Stats cards ----------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card2);
    flex-shrink: 0;
}
.stat-info .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}
.stat-info .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---- Page login ------------------------------------------ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
    padding: 20px;
}
.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img  { height: 80px; }
.login-logo h1   { font-size: 20px; color: var(--accent); margin-top: 10px; }
.login-logo p    { font-size: 12px; color: var(--text-muted); }
.login-tabs {
    display: flex;
    background: var(--bg-card2);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 24px;
}
.login-tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .2s;
    border: none;
    background: none;
}
.login-tab.active {
    background: var(--accent-dark);
    color: white;
}

/* ---- Footer ---------------------------------------------- */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 20px;
    margin-top: auto;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.footer-logo { height: 36px; }
.footer-info {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: var(--text-muted);
    gap: 2px;
}
.footer-info strong { color: var(--text-light); }
.footer-info a { color: var(--accent); }
.footer-copy {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- Génération IA --------------------------------------- */
.gen-result {
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 20px;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-light);
    max-height: 600px;
    overflow-y: auto;
}
.gen-result h1, .gen-result h2, .gen-result h3 {
    color: var(--accent);
    margin: 16px 0 8px;
}
.gen-toolbar {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

/* ---- Impression ------------------------------------------ */
@media print {
    .navbar, .sidebar, .footer, .gen-toolbar,
    .btn, .no-print { display: none !important; }

    body { background: white; color: black; font-size: 12pt; }

    .print-header {
        display: flex !important;
        align-items: center;
        gap: 16px;
        border-bottom: 2px solid #333;
        padding-bottom: 12px;
        margin-bottom: 20px;
    }
    .print-header img  { height: 60px; }
    .print-header .ph-info { font-size: 10pt; line-height: 1.6; }
    .print-header .ph-info strong { font-size: 13pt; }

    .gen-result {
        background: white;
        border: none;
        max-height: none;
        color: black;
    }
    .card {
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
    }
    .page-wrapper { display: block; padding: 0; }
}

.print-header { display: none; }

/* ---- Responsive ------------------------------------------ */
@media (max-width: 768px) {
    .page-wrapper { flex-direction: column; }
    .sidebar { width: 100%; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .login-box { padding: 25px 20px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .navbar { padding: 0 14px; }
    .nav-title small { display: none; }
}
