/* Portail OTP — style.css */

:root {
  --bg:          #f0f2f5;
  --surface:     #ffffff;
  --surface-alt: #f7f8fa;
  --border:      #d8dde6;
  --text:        #1a1d23;
  --text-muted:  #6b7280;
  --accent:      #1c4f8c;
  --accent-dark: #153b6b;
  --accent-light:#e8eff8;
  --success:     #15803d;
  --success-bg:  #dcfce7;
  --error:       #b91c1c;
  --error-bg:    #fee2e2;
  --warning:     #92400e;
  --warning-bg:  #fef3c7;
  --info:        #1e40af;
  --info-bg:     #dbeafe;
  --danger:      #dc2626;
  --radius:      10px;
  --shadow:      0 4px 24px rgba(0,0,0,.09);
  --font:        system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --mono:        ui-monospace, 'Courier New', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  background: var(--accent); color: #fff;
  padding: .75rem 2rem; font-size: .875rem;
}
.topbar-brand  { font-weight: 600; font-size: 1rem; }
.topbar-user   { margin-left: auto; opacity: .85; }
.topbar-logout {
  color: #fff; opacity: .75; text-decoration: none;
  border: 1px solid rgba(255,255,255,.35); border-radius: 5px;
  padding: .25rem .75rem; font-size: .8rem;
  transition: opacity .2s, background .2s;
}
.topbar-logout:hover { opacity: 1; background: rgba(255,255,255,.12); }

/* ── Login ── */
.page-login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #e8eff8 0%, #f0f2f5 60%, #dce7f5 100%);
}
.login-wrap { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2.5rem 2.5rem 2rem;
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-icon {
  width: 56px; height: 56px; background: var(--accent-light); color: var(--accent);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.login-icon svg  { width: 32px; height: 32px; }
.login-header h1 { font-size: 1.5rem; font-weight: 600; color: var(--accent); }
.login-subtitle  { font-size: .875rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Champs ── */
.field { margin-bottom: 1.25rem; }
.field label {
  display: block; font-size: .8125rem; font-weight: 500;
  color: var(--text-muted); margin-bottom: .35rem;
  text-transform: uppercase; letter-spacing: .05em;
}
.field input, .field-inline input {
  width: 100%; padding: .65rem .9rem;
  border: 1.5px solid var(--border); border-radius: 7px;
  font-family: var(--font); font-size: .9375rem;
  background: var(--surface-alt); color: var(--text);
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.field input:focus, .field-inline input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28,79,140,.12);
  background: #fff;
}

/* ── Boutons ── */
.btn-primary {
  display: block; width: 100%; padding: .75rem;
  background: var(--accent); color: #fff; border: none;
  border-radius: 7px; font-family: var(--font);
  font-size: .9375rem; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .1s; margin-top: .5rem;
}
.btn-primary:hover  { background: var(--accent-dark); }
.btn-primary:active { transform: scale(.98); }

.btn-icon {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; padding: .25rem .4rem; border-radius: 5px;
  opacity: .7; transition: opacity .2s, background .2s;
}
.btn-icon:hover { opacity: 1; background: var(--surface-alt); }
.btn-icon-danger:hover { background: var(--error-bg); }

.btn-copy-small {
  display: inline-block; margin-top: .6rem;
  padding: .35rem .85rem; font-size: .8125rem;
  background: var(--accent-light); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 6px;
  cursor: pointer; transition: background .2s; font-family: var(--font);
}
.btn-copy-small:hover { background: #d0e0f5; }

/* ── Alertes ── */
.alert {
  padding: .75rem 1rem; border-radius: 7px;
  font-size: .875rem; margin-bottom: 1.25rem; border-left: 4px solid;
}
.alert-error   { background: var(--error-bg);   color: var(--error);   border-color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info); }

/* ── Portal ── */
.page-portal { background: var(--bg); }
.portal-wrap { max-width: 900px; margin: 2rem auto; padding: 0 1.25rem 3rem; }

/* Barre de progression globale */
.global-timer {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem;
}
.global-timer-bar {
  flex: 1; height: 6px; background: var(--accent);
  border-radius: 3px; transition: width 1s linear, background .3s;
}
.global-timer-bar.expiring { background: var(--danger); }
.global-timer-text { font-size: .8125rem; color: var(--text-muted); white-space: nowrap; }
#global-countdown { font-weight: 600; color: var(--text); }

/* Grille des jetons */
.no-tokens {
  text-align: center; padding: 2.5rem;
  background: var(--surface); border-radius: var(--radius);
  color: var(--text-muted); margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.tokens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.token-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column;
}
.token-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: .75rem;
}
.token-label {
  font-weight: 600; font-size: .9375rem;
  color: var(--accent); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  max-width: 160px;
}
.token-actions { display: flex; gap: .15rem; flex-shrink: 0; }
.token-otp {
  font-family: var(--mono); font-size: 2.25rem; font-weight: 700;
  letter-spacing: .25em; color: var(--text);
  filter: blur(5px);
  user-select: none;
  cursor: default;
  transition: filter .25s, opacity .2s;
}
.token-card:hover .token-otp { filter: none; user-select: text; }
.token-otp.otp-refresh { opacity: 0; }

/* Formulaire d'ajout */
.add-token-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem 2rem;
  border-top: 3px solid var(--accent);
}
.add-token-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: .3rem; color: var(--accent); }
.add-token-card p  { font-size: .875rem; color: var(--text-muted); margin-bottom: 1rem; }

.add-token-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.field-inline label {
  display: block; font-size: .8rem; font-weight: 500;
  color: var(--text-muted); margin-bottom: .3rem;
  text-transform: uppercase; letter-spacing: .05em;
}
.field-inline input { font-size: .9rem; }
.secret-input { font-family: var(--mono) !important; letter-spacing: .08em; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .login-card, .add-token-card { padding: 1.5rem 1.25rem; }
  .topbar { padding: .6rem 1rem; }
  .topbar-user { display: none; }
  .add-token-fields { grid-template-columns: 1fr; }
  .tokens-grid { grid-template-columns: 1fr; }
  .token-otp { font-size: 1.85rem; }
}

/* ── Logo établissement ── */
.login-logo {
  display: block;
  max-height: 80px;
  max-width: 200px;
  margin: 0 auto 1rem;
  object-fit: contain;
}
.topbar-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}
