/* SPG License Manager — Styles */

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

:root {
    --navy:   #16325c;
    --blue:   #1d4ed8;
    --green:  #16a34a;
    --red:    #dc2626;
    --orange: #ea580c;
    --gray:   #6b7280;
    --light:  #f3f4f6;
    --border: #e5e7eb;
    --white:  #ffffff;
    --shadow: 0 1px 4px rgba(0,0,0,.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    background: #f0f2f5;
    color: #1f2937;
    min-height: 100vh;
}

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: var(--navy);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
}

.sidebar-logo {
    padding: 22px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo h1 { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.3; }
.sidebar-logo small { font-size: 11px; opacity: .55; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: 13.5px;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; border-left-color: #60a5fa; }
.sidebar-nav .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-nav .nav-sep { border-top: 1px solid rgba(255,255,255,.08); margin: 8px 20px; }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: 12px;
    color: rgba(255,255,255,.4);
}

.main { margin-left: 220px; padding: 28px 32px; flex: 1; }

/* ── Page header ── */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; color: #111827; }
.page-header p  { color: var(--gray); margin-top: 4px; font-size: 13.5px; }

/* ── Stat cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
    background: var(--white);
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--blue);
}
.stat-card.green  { border-top-color: var(--green); }
.stat-card.red    { border-top-color: var(--red); }
.stat-card.orange { border-top-color: var(--orange); }
.stat-card .stat-num   { font-size: 32px; font-weight: 700; color: #111; line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: var(--gray); margin-top: 4px; }

/* ── Card ── */
.card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}
.card-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 22px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    background: #f8f9fb;
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafbfc; }

/* ── Badges ── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }

/* ── Boutons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary   { background: var(--navy);  color: #fff; }
.btn-success   { background: var(--green); color: #fff; }
.btn-danger    { background: var(--red);   color: #fff; }
.btn-secondary { background: #e5e7eb;      color: #374151; }
.btn-sm        { padding: 5px 11px; font-size: 12.5px; }
.btn:hover     { opacity: .88; }

/* ── Formulaires ── */
.form-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 600; color: #374151; }
label .req { color: var(--red); margin-left: 2px; }
input[type="text"],
input[type="password"],
input[type="date"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: #111;
    background: #fff;
    transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(29,78,216,.1);
}
.form-hint { font-size: 12px; color: var(--gray); }
.form-actions { margin-top: 22px; display: flex; gap: 10px; }

/* ── Alerts / Flash ── */
.alert {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13.5px;
    display: flex; align-items: center; gap: 10px;
    border-left: 4px solid;
}
.alert-success { background: #f0fdf4; border-color: var(--green); color: #15803d; }
.alert-error   { background: #fef2f2; border-color: var(--red);   color: #b91c1c; }
.alert-info    { background: #eff6ff; border-color: var(--blue);  color: #1d4ed8; }

/* ── Code / Clés ── */
code {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: #f3f4f6;
    padding: 2px 7px;
    border-radius: 4px;
    color: #16325c;
}

/* ── Log ── */
.log-box {
    background: #0f172a;
    color: #94a3b8;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.7;
    padding: 16px;
    border-radius: 8px;
    max-height: 480px;
    overflow-y: auto;
}
.log-box .log-valid   { color: #4ade80; }
.log-box .log-invalid { color: #f87171; }

/* ── Login page ── */
.login-wrap {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.login-box {
    background: #fff;
    border-radius: 14px;
    padding: 40px 36px;
    width: 100%; max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    text-align: center;
}
.login-box h1 { font-size: 22px; margin-bottom: 6px; color: var(--navy); }
.login-box p  { color: var(--gray); font-size: 13.5px; margin-bottom: 26px; }
.login-box input { margin-bottom: 14px; }
.login-box .btn  { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }

/* ── Misc ── */
.text-gray   { color: var(--gray); }
.text-small  { font-size: 12px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 14px; }
.flex { display: flex; align-items: center; gap: 8px; }
.ml-auto { margin-left: auto; }
.key-gen { display: flex; gap: 8px; }
.key-gen input { flex: 1; }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main    { margin-left: 0; padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
