/* =====================================================================
   Serenity License Admin – Thème
   Inspiré du langage visuel Serenity (#0087FA, shadcn-style)
   ================================================================== */

/* -- Reset & base ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
                 Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #18181b;
    background: #f4f6f8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: #0087FA; text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85em;
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
    color: #1e293b;
}

/* -- Topbar ------------------------------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e4e4e7;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #18181b;
    text-decoration: none;
}
.topbar-brand img { height: 32px; width: 32px; }
.topbar-brand strong { color: #0087FA; font-weight: 700; }
.topbar-nav { display: flex; gap: 4px; flex: 1; margin-left: 24px; }
.topbar-nav a {
    color: #52525b;
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
}
.topbar-nav a:hover { background: #f4f4f5; color: #0087FA; }
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #52525b;
    font-size: 13px;
}

/* -- Layouts ------------------------------------------------------ */
.app-main {
    flex: 1;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 24px;
}
.guest-main { flex: 1; }
.app-footer {
    text-align: center;
    padding: 16px;
    color: #71717a;
    font-size: 12px;
    border-top: 1px solid #e4e4e7;
    background: #ffffff;
}

/* -- Auth (login) ------------------------------------------------- */
.auth-page { min-height: 100vh; display: flex; background: #fafafa; }
.auth-container { display: flex; width: 100%; min-height: 100vh; }

.auth-image-side {
    display: none;
    position: relative;
    flex: 1;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0087FA 130%);
    overflow: hidden;
}
@media (min-width: 1024px) { .auth-image-side { display: block; } }
.auth-image-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(0,135,250,.25) 0%, rgba(26,26,46,.85) 100%);
}
.auth-image-content {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; justify-content: flex-end;
    height: 100%; padding: 48px; color: #fff;
}
.auth-quote { max-width: 480px; }
.auth-quote blockquote {
    font-size: 22px; font-weight: 300; line-height: 1.5;
    margin: 0 0 16px; opacity: .95;
}
.auth-quote blockquote::before {
    content: '"'; font-size: 48px; line-height: 0; vertical-align: -12px;
    opacity: .5; margin-right: 4px;
}
.auth-quote-author { font-size: 14px; font-weight: 500; opacity: .7; }

.auth-form-side {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 32px; background: #fff;
}
@media (min-width: 1024px) { .auth-form-side { max-width: 520px; } }
.auth-form-container { width: 100%; max-width: 380px; }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-logo { height: 56px; margin-bottom: 20px; }
.auth-title { font-size: 24px; font-weight: 600; margin: 0 0 8px; color: #18181b; }
.auth-subtitle { font-size: 14px; color: #71717a; margin: 0; }
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: 13px; font-weight: 500; color: #18181b; }
.auth-field input {
    padding: 10px 12px; border: 1px solid #e4e4e7; border-radius: 8px;
    font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus {
    outline: none; border-color: #0087FA;
    box-shadow: 0 0 0 3px rgba(0,135,250,.15);
}

/* -- Page header -------------------------------------------------- */
.page { display: flex; flex-direction: column; gap: 24px; }
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 16px;
}
.page-header h1 {
    margin: 0; font-size: 24px; font-weight: 600; color: #18181b;
    display: flex; align-items: center; gap: 12px;
}
.page-actions { display: flex; gap: 8px; }

/* -- Stats grid --------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.stat {
    background: #fff; border: 1px solid #e4e4e7; border-radius: 10px;
    padding: 18px 20px; border-left: 4px solid #e4e4e7;
}
.stat-label { font-size: 12px; text-transform: uppercase; color: #71717a; letter-spacing: .04em; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: #18181b; }
.stat-primary { border-left-color: #0087FA; }
.stat-success { border-left-color: #10b981; }
.stat-warning { border-left-color: #f59e0b; }
.stat-danger  { border-left-color: #ef4444; }
.stat-muted   { border-left-color: #94a3b8; }

/* -- Cards -------------------------------------------------------- */
.card {
    background: #fff; border: 1px solid #e4e4e7; border-radius: 10px;
    padding: 20px 24px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9;
}
.card-header h2 { margin: 0; font-size: 16px; font-weight: 600; color: #18181b; }
.card-danger { border-color: #fecaca; background: #fff5f5; }
.card-danger .card-header { border-bottom-color: #fecaca; }

.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* -- Tables ------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
    padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}
.table th { background: #fafafa; font-weight: 600; color: #52525b; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.table tbody tr:hover { background: #fafbfc; }
.table .actions { white-space: nowrap; }

.muted { color: #94a3b8; font-size: 12px; }
.empty { padding: 40px; text-align: center; color: #71717a; }
.empty h1 { font-size: 64px; color: #0087FA; margin: 0 0 8px; }

/* -- Badges ------------------------------------------------------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-active   { background: #ecfdf5; color: #065f46; }
.badge-expiring { background: #fffbeb; color: #92400e; }
.badge-expired  { background: #fef2f2; color: #991b1b; }
.badge-revoked  { background: #f1f5f9; color: #475569; text-decoration: line-through; }
.badge-muted    { background: #f1f5f9; color: #64748b; }

/* -- Forms -------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; font-weight: 500; color: #18181b; }
.form-field .hint { font-size: 12px; color: #71717a; }
.form-field input,
.form-field textarea,
.form-field select {
    padding: 9px 12px; border: 1px solid #e4e4e7; border-radius: 8px;
    font-size: 14px; font-family: inherit; transition: border-color .15s, box-shadow .15s;
    background: #fff;
}
.form-field textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; }
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    outline: none; border-color: #0087FA;
    box-shadow: 0 0 0 3px rgba(0,135,250,.15);
}
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.form-inline {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px;
}
.form-inline input {
    padding: 8px 10px; border: 1px solid #e4e4e7; border-radius: 8px;
    font-size: 13px; flex: 1; min-width: 200px;
}
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.dl dt { color: #71717a; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.dl dd { margin: 0; color: #18181b; word-break: break-all; }

/* -- Buttons ------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; font-size: 13px; font-weight: 500;
    border-radius: 8px; border: 1px solid transparent; cursor: pointer;
    text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
    font-family: inherit; line-height: 1;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: #0087FA; color: #fff; box-shadow: 0 1px 2px rgba(0,135,250,.3); }
.btn-primary:hover:not(:disabled) { background: #006fd1; text-decoration: none; }
.btn-ghost { background: #fff; color: #18181b; border-color: #e4e4e7; }
.btn-ghost:hover:not(:disabled) { background: #f4f4f5; text-decoration: none; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.inline { display: inline; margin: 0; padding: 0; }
.link { color: #0087FA; font-weight: 500; }

/* -- Misc --------------------------------------------------------- */
.codeblock {
    background: #0f172a; color: #e2e8f0; padding: 14px 16px;
    border-radius: 8px; font-family: ui-monospace, monospace; font-size: 12px;
    overflow-x: auto; word-break: break-all; white-space: pre-wrap;
    margin: 0;
}
.fp { font-size: 11px; word-break: break-all; }
.info-box {
    background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af;
    padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px;
}
.info-box-warning { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.info-box .codeblock { margin-top: 10px; }

/* -- Flash -------------------------------------------------------- */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
    padding: 12px 16px; border-radius: 8px; border: 1px solid;
    font-size: 13px;
}
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.flash-warning { background: #fffbeb; border-color: #fde68a; color: #78350f; }
