/* ============================================================
   auth.css — Module 1 : Auth & Profils
   Palette : respecte #2d3137 du template de base
   ============================================================ */

/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --bg:           #2d3137;
    --bg-deep:      #1e2127;
    --bg-card:      #363b43;
    --bg-input:     #2a2f37;
    --border:       #454c56;
    --border-focus: #6e91c4;

    --text:         #e8eaed;
    --text-muted:   #8b919a;
    --text-label:   #b0b8c4;

    --accent:       #e8c547;          /* Or — couleur signature */
    --accent-dim:   rgba(232,197,71,.12);
    --accent-hover: #f0d060;

    --blue:         #4a90d9;
    --blue-dark:    #2e6fb0;
    --green:        #3dba74;
    --orange:       #e8853a;
    --red:          #d94a4a;
    --red-dark:     #b03030;
    --purple:       #8b68d4;

    --radius:       8px;
    --radius-lg:    14px;
    --shadow:       0 4px 24px rgba(0,0,0,.35);
    --shadow-sm:    0 2px 8px rgba(0,0,0,.25);

    --transition:   .18s ease;
}

/* ─── Reset complémentaire ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg);
    color: var(--text);
    margin: 0; padding: 0;
    font-family: sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ─── Flash messages ────────────────────────────────────────────────────────── */
.flash-zone {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.flash {
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    animation: slideIn .25s ease;
}
@keyframes slideIn {
    from { transform: translateX(30px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
.flash-error   { background: #4a1a1a; border-left: 4px solid var(--red); }
.flash-success { background: #1a3a28; border-left: 4px solid var(--green); }
.flash-info    { background: #1a2a3a; border-left: 4px solid var(--blue); }

/* ─── Alerts inline ─────────────────────────────────────────────────────────── */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
}
.alert-error   { background: rgba(217,74,74,.15);  border: 1px solid rgba(217,74,74,.35); }
.alert-success { background: rgba(61,186,116,.15); border: 1px solid rgba(61,186,116,.35); }
.alert-info    { background: rgba(74,144,217,.15); border: 1px solid rgba(74,144,217,.35); }
.alert i { margin-top: 2px; flex-shrink: 0; }

/* ─── Navbar ────────────────────────────────────────────────────────────────── */
.navbar {
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 500;
}
.navbar-inner {
    max-width: 994px;
    margin: 0 auto;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}
.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent) !important;
    letter-spacing: 1px;
}
.navbar-links {
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav-link {
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: var(--text); }
.nav-link--admin { color: var(--red); }
.nav-link--admin:hover { background: rgba(217,74,74,.15); color: var(--red); }
.nav-link--danger { color: var(--red); }

/* Dropdown nav */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
    background: rgba(255,255,255,.07);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all var(--transition);
}
.nav-dropdown-trigger:hover { background: rgba(255,255,255,.12); }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    right: 0; top: calc(100% + 6px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 200px;
    padding: 6px 0;
    box-shadow: var(--shadow);
    z-index: 600;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    color: var(--text-muted);
    font-size: 14px;
    transition: all var(--transition);
}
.nav-dropdown-menu a:hover { background: rgba(255,255,255,.06); color: var(--text); }
.nav-dropdown-sep { border-top: 1px solid var(--border); margin: 4px 0; }

/* ─── Boutons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #1a1a2e; }
.btn-primary:hover { background: var(--accent-hover); color: #1a1a2e; }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-dark); }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); background: rgba(255,255,255,.05); }

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

/* ─── Formulaires ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-label);
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 11px 14px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
}
.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(110,145,196,.15);
}
.form-input::placeholder { color: var(--text-muted); opacity: .7; }
.form-textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; display: block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-footer-link { text-align: right; margin-top: -10px; margin-bottom: 16px; }
.form-footer-link a { font-size: 13px; color: var(--text-muted); }
.form-footer-link a:hover { color: var(--accent); }

/* Input + toggle visible/masqué */
.input-with-toggle {
    position: relative;
    display: flex;
    align-items: center;
}
.input-with-toggle .form-input { padding-right: 44px; }
.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    padding: 0;
    transition: color var(--transition);
}
.toggle-password:hover { color: var(--text); }

/* Indicateur de force du mot de passe */
.password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 6px;
    transition: all .3s;
    background: transparent;
}
.password-strength.weak   { background: var(--red);    width: 33%; }
.password-strength.medium { background: var(--orange);  width: 66%; }
.password-strength.strong { background: var(--green);   width: 100%; }

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
}
.checkbox-label input[type=checkbox] {
    width: 16px; height: 16px;
    margin-top: 2px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

/* File drop zone */
.file-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}
.file-drop-zone.drag-over, .file-drop-zone.has-file {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.file-input-hidden { display: none; }
.file-drop-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 20px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}
.file-drop-label i { font-size: 28px; color: var(--accent); }
.file-drop-label:hover { color: var(--text); }
.file-security-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(232,197,71,.07);
    border-radius: var(--radius);
}

/* ─── OTP input (6 cases) ────────────────────────────────────────────────────── */
.otp-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 16px 0;
}
.otp-digit {
    width: 46px;
    height: 56px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
    -moz-appearance: textfield;
}
.otp-digit::-webkit-inner-spin-button { display: none; }
.otp-digit:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ─── Pages Auth ─────────────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(232,197,71,.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(74,144,217,.04) 0%, transparent 60%),
        var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow);
}
.auth-card--wide { max-width: 560px; }
.auth-card__logo {
    text-align: center;
    margin-bottom: 28px;
}
.auth-logo-text {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent);
}
.auth-card__icon { text-align: center; margin-bottom: 16px; }
.auth-card__title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    text-align: center;
}
.auth-card__sub {
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    margin: 0 0 28px;
    line-height: 1.6;
}
.auth-card__switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}
.auth-card__switch a { margin-left: 4px; font-weight: 600; }
.auth-form { margin-top: 8px; }

/* ─── 2FA Setup ──────────────────────────────────────────────────────────────── */
.totp-setup-steps { margin: 24px 0; }
.setup-step {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.setup-step:last-child { border-bottom: none; }
.step-num {
    width: 32px; height: 32px;
    background: var(--accent);
    color: #1a1a2e;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.step-body { font-size: 14px; color: var(--text-muted); padding-top: 4px; }
.step-body strong { color: var(--text); display: block; margin-bottom: 8px; }
.qr-wrapper { margin: 16px 0; }
.qr-code {
    display: block;
    border-radius: var(--radius);
    border: 4px solid #fff;
}
.manual-key { margin-top: 8px; font-size: 13px; }
.manual-key summary { cursor: pointer; color: var(--text-muted); }
.secret-display {
    font-family: monospace;
    font-size: 15px;
    letter-spacing: 3px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-top: 8px;
    word-break: break-all;
    color: var(--accent);
}

/* ─── Dashboard ──────────────────────────────────────────────────────────────── */
.dashboard-page {
    min-height: calc(100vh - 56px);
    padding: 40px 16px;
}
.dashboard-container {
    max-width: 994px;
    margin: 0 auto;
}
.dashboard-welcome {
    margin-bottom: 32px;
}
.dashboard-welcome h1 { font-size: 28px; margin: 0 0 6px; }
.accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }

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

.dash-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
}
.dash-card:hover {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(232,197,71,.06) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}
.dash-card__icon { font-size: 28px; color: var(--text-muted); margin-bottom: 4px; }
.dash-card__label { font-size: 15px; font-weight: 700; }
.dash-card__sub { font-size: 12px; color: var(--text-muted); }

.dash-card--accent .dash-card__icon { color: var(--accent); }
.dash-card--accent { border-color: rgba(232,197,71,.3); }

.dash-card--secure .dash-card__icon { color: var(--green); }
.dash-card--warning { border-color: rgba(232,133,58,.4); }
.dash-card--warning .dash-card__icon { color: var(--orange); }

.dash-card--admin .dash-card__icon { color: var(--red); }
.dash-card--admin { border-color: rgba(217,74,74,.3); }

.dash-card--promo {
    background: linear-gradient(135deg, var(--bg-card), rgba(138,104,212,.08));
    border-color: rgba(138,104,212,.35);
}
.dash-card--promo .dash-card__icon { color: var(--purple); }

.dash-card--alert { border-color: rgba(232,133,58,.5); }
.dash-card--alert .dash-card__icon { color: var(--orange); }

/* ─── Info banners ───────────────────────────────────────────────────────────── */
.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 14px;
}
.info-banner i { font-size: 18px; margin-top: 2px; flex-shrink: 0; }
.info-banner--warning { background: rgba(232,133,58,.12); border: 1px solid rgba(232,133,58,.35); color: #f0a060; }
.info-banner--error   { background: rgba(217,74,74,.12);  border: 1px solid rgba(217,74,74,.35);  color: #e07070; }
.info-banner--blue    { background: rgba(74,144,217,.12); border: 1px solid rgba(74,144,217,.35); color: #80b4e4; }
.info-banner--success { background: rgba(61,186,116,.12); border: 1px solid rgba(61,186,116,.35); color: #70d090; }

/* ─── Pages internes ─────────────────────────────────────────────────────────── */
.inner-page {
    min-height: calc(100vh - 56px);
    padding: 32px 16px 60px;
}
.inner-container {
    max-width: 994px;
    margin: 0 auto;
}
.inner-container--sm { max-width: 620px; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 {
    font-size: 24px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,.15);
}
.card-header h2 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body { padding: 24px; }

/* ─── Profile page ───────────────────────────────────────────────────────────── */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.profile-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.profile-field:last-child { border-bottom: none; }
.profile-field__label { color: var(--text-muted); }
.profile-field__value { font-weight: 500; }

.security-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.security-item:last-child { border-bottom: none; }
.security-item__info { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.security-item__info strong { color: var(--text); }

/* ─── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.badge-blue   { background: rgba(74,144,217,.2);  color: var(--blue); }
.badge-green  { background: rgba(61,186,116,.2);  color: var(--green); }
.badge-orange { background: rgba(232,133,58,.2);  color: var(--orange); }
.badge-red    { background: rgba(217,74,74,.2);   color: var(--red); }

/* ─── Tables admin ───────────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,.15);
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.03); }

/* Détail admin */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.detail-field {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-right: 20px;
}
.detail-field span { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.detail-field strong { color: var(--text); }

/* ─── Stats boxes (admin) ────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}
.stat-box--alert { border-color: rgba(232,133,58,.4); }
.stat-box__num { font-size: 32px; font-weight: 700; color: var(--accent); }
.stat-box__label { font-size: 13px; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 6px; }

/* ─── Storage bar ────────────────────────────────────────────────────────────── */
.storage-bar-wrap { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.storage-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}
.storage-bar__fill {
    height: 100%;
    background: var(--green);
    border-radius: 4px;
    transition: width .4s ease;
}
.storage-bar__fill.warn { background: var(--orange); }
.storage-bar__fill.full { background: var(--red); }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--bg-deep);
    border-top: 1px solid var(--border);
    padding: 18px 0;
    text-align: center;
}
.footer-inner { font-size: 13px; color: var(--text-muted); }

/* ─── Link-muted ─────────────────────────────────────────────────────────────── */
.link-muted { color: var(--text-muted); font-size: 13px; }
.link-muted:hover { color: var(--accent); }

/* ─── 404 ────────────────────────────────────────────────────────────────────── */
.page-404 {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 16px; text-align: center;
}
.page-404 h1 { font-size: 80px; margin: 0; color: var(--accent); }
.page-404 p { color: var(--text-muted); }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .profile-grid { grid-template-columns: 1fr; }
    .stats-grid   { grid-template-columns: repeat(2, 1fr); }
    .detail-grid  { grid-template-columns: 1fr; }
    .form-row     { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .auth-card { padding: 28px 20px; }
    .otp-digit { width: 40px; height: 50px; font-size: 20px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .navbar-inner { padding: 0 12px; }
}
