/* ============================================================
   CrowStudios Admin Infrastructure — Style System
   Repris et adapté du design system CrowAccounts
   Palette : Dark (CrowStudios)  |  Police : Outfit
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --black:       #000000;
  --white:       #ffffff;
  --bg:          #000000;
  --surface-1:   #0d0d0d;   /* sidebar, header */
  --surface-2:   #111111;   /* cards */
  --surface-3:   #191919;   /* inputs, hover */
  --surface-4:   #222222;   /* hover léger */

  --border:      rgba(255,255,255,0.07);
  --border-md:   rgba(255,255,255,0.12);
  --border-focus:rgba(255,255,255,0.35);

  --text-1:      #ffffff;
  --text-2:      rgba(255,255,255,0.7);
  --text-3:      rgba(255,255,255,0.4);
  --text-4:      rgba(255,255,255,0.2);

  --danger:      #f87171;
  --danger-bg:   rgba(248,113,113,0.1);
  --danger-border:rgba(248,113,113,0.25);
  --success:     #4ade80;
  --success-bg:  rgba(74,222,128,0.08);
  --success-border:rgba(74,222,128,0.2);

  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 999px;

  --shadow-sm:  0 2px 12px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 48px rgba(0,0,0,0.7);

  --font:       'Outfit', sans-serif;
  --sidebar-w:  250px;
  --header-h:   64px;
  --transition: 0.2s ease;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  overflow-x: hidden;
}

/* Page login — centrage */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

a {
  color: var(--text-1);
  text-decoration: none;
  font-weight: 600;
  transition: opacity var(--transition);
}
a:hover { opacity: 0.6; }

::selection { background: var(--white); color: var(--black); }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

/* Icônes Lucide : lucide.createIcons() remplace <i data-lucide="..."> par
   un <svg class="lucide lucide-xxx">. Les sélecteurs ciblent donc `svg`. */
.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2px;
  flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════
   LOGIN — écran de connexion
═══════════════════════════════════════════════════════════ */

.login-box {
  width: 100%;
  max-width: 780px;
  min-height: 440px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-md);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--surface-2);
  animation: boxFadeIn 0.5s cubic-bezier(.22,1,.36,1) both;
}

@keyframes boxFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Colonne gauche — Branding */
.login-brand {
  background: var(--surface-1);
  color: var(--text-1);
  padding: 52px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.login-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 25%, rgba(255,255,255,0.04) 0%, transparent 55%),
    radial-gradient(circle at 85% 75%, rgba(255,255,255,0.03) 0%, transparent 50%);
  pointer-events: none;
}
.login-brand::after {
  content: '';
  position: absolute;
  bottom: -70px;
  right: -70px;
  width: 200px;
  height: 200px;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 50%;
  pointer-events: none;
}

/* Logo CrowStudios — lowercase + petit rond */
.login-brand-logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-1);
  text-transform: lowercase;
  letter-spacing: -0.5px;
  margin-bottom: 40px;
  position: relative;
  z-index: 1;
  display: inline-block;
  line-height: 1;
}
.login-brand-logo::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--white);
  border-radius: 50%;
  margin-left: 2px;
  vertical-align: super;
  font-size: 0;
}

.login-brand h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 14px;
  line-height: 1.1;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
}

.login-brand p {
  color: var(--text-3);
  line-height: 1.7;
  font-size: 0.95rem;
  font-weight: 300;
  position: relative;
  z-index: 1;
  max-width: 260px;
  margin-bottom: 34px;
}

/* Features (colonne gauche) */
.brand-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.brand-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-3);
  transition: color var(--transition);
}
.brand-feature:hover { color: var(--text-2); }
.brand-feature-icon {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-feature-icon svg { width: 13px; height: 13px; color: var(--text-3); }

/* Colonne droite — Formulaire */
.login-form-area {
  padding: 52px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--surface-2);
}

.form-header { margin-bottom: 24px; }
.form-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.form-header p {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--text-3);
}

/* ── Champs avec labels flottants ───────────────────────────── */
.input-group {
  position: relative;
  margin-bottom: 16px;
  width: 100%;
}

.input-group input {
  width: 100%;
  padding: 22px 14px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.97rem;
  font-family: var(--font);
  font-weight: 400;
  outline: none;
  background: var(--surface-3);
  color: var(--text-1);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.input-group input:focus {
  border-color: var(--border-focus);
  background: var(--surface-4);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
  outline: none;
}

.input-group label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 0.95rem;
  font-weight: 400;
  pointer-events: none;
  transition: all 0.18s cubic-bezier(.4,0,.2,1);
}
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: 11px;
  transform: none;
  font-size: 0.65rem;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Bouton toggle mot de passe */
.input-group button {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  width: auto;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}
.input-group button:hover { color: var(--text-1); }

/* ── Message box avec icône ──────────────────────────────────── */
.message-box {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.85rem;
  font-weight: 500;
}
.message-box svg { width: 15px; height: 15px; flex-shrink: 0; }
.message-box.error   { display: flex; background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-border); }
.message-box.success { display: flex; background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }

/* ── Bouton submit principal ──────────────────────────────────── */
.btn-submit {
  width: 100%;
  padding: 13px 20px;
  background: var(--white);
  color: var(--black);
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity var(--transition), transform var(--transition);
  letter-spacing: -0.1px;
}
.btn-submit svg { width: 16px; height: 16px; transition: transform var(--transition); }
.btn-submit:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-submit:hover svg { transform: translateX(3px); }
.btn-submit:active { transform: translateY(0); opacity: 1; }
.btn-submit:disabled { opacity: 0.5; pointer-events: none; }

.btn-submit.loading { opacity: 0.5; pointer-events: none; }
.btn-submit.loading .btn-label::after {
  content: '…';
  animation: dots 1s infinite;
}
@keyframes dots { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ── Indice de redirection ─────────────────────────────────────── */
.redirect-hint {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 300;
  text-align: center;
}
.redirect-hint strong {
  color: var(--text-2);
  font-family: monospace;
  font-weight: 500;
}

/* ── Responsive login ─────────────────────────────────────────── */
@media (max-width: 680px) {
  body.login-page { padding: 0; align-items: stretch; }

  .login-box {
    grid-template-columns: 1fr;
    max-width: 100%;
    min-height: 100vh;
    border-radius: 0;
    border: none;
    animation: none;
  }
  .login-brand {
    padding: 40px 28px 28px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .login-brand::after { display: none; }
  .brand-features { display: none; }
  .login-form-area { padding: 36px 28px 48px; flex: 1; }
}
@media (max-width: 400px) {
  .login-brand { padding: 32px 20px 24px; }
  .login-brand h1 { font-size: 1.4rem; }
  .login-form-area { padding: 28px 20px 40px; }
}


/* ═══════════════════════════════════════════════════════════
   DASHBOARD — Structure
═══════════════════════════════════════════════════════════ */

.dashboard-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 14px;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 32px;
  padding: 0 10px;
  letter-spacing: -0.5px;
  text-transform: lowercase;
  display: inline-block;
  line-height: 1;
}
.sidebar-logo::after {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--white);
  border-radius: 50%;
  margin-left: 2px;
  vertical-align: super;
  font-size: 0;
}

.sidebar nav { flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: var(--text-3);
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  font-weight: 400;
  font-size: 0.92rem;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  text-decoration: none;
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-link:hover {
  background: var(--surface-3);
  color: var(--text-1);
  opacity: 1;
  text-decoration: none;
}
.nav-link.active {
  background: rgba(255,255,255,0.08);
  color: var(--text-1);
  font-weight: 600;
  opacity: 1;
  text-decoration: none;
}

/* ── Logout ───────────────────────────────────────────────────── */
.logout-btn {
  margin-top: auto;
  background: transparent;
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-decoration: none;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: background var(--transition);
}
.logout-btn:hover { background: var(--danger-bg); opacity: 1; text-decoration: none; color: var(--danger); }
.logout-btn svg { width: 17px; height: 17px; }

/* ── Header fixe ───────────────────────────────────────────────── */
header {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--header-h);
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 28px;
  z-index: 90;
  gap: 12px;
}

.session-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-3);
  font-weight: 300;
}
.session-user strong {
  color: var(--text-1);
  font-family: monospace;
  font-weight: 500;
}

.profile-avatar-small {
  width: 32px;
  height: 32px;
  background: var(--surface-3);
  border: 1px solid var(--border-md);
  border-radius: 50%;
  color: var(--text-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  overflow: hidden;
  flex-shrink: 0;
}

/* ── Main content ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  margin-left: var(--sidebar-w);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.google-container {
  max-width: 940px;
  margin: 0 auto;
  padding: 40px 28px;
  width: 100%;
  margin-top: var(--header-h);
  animation: fadeIn 0.8s ease-out both;
}

.dash-intro { margin-bottom: 24px; }
.dash-intro h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.8px;
  margin-bottom: 6px;
}
.dash-intro p {
  color: var(--text-3);
  font-size: 0.9rem;
  font-weight: 300;
}

/* ── Cards génériques ─────────────────────────────────────────── */
.google-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  transition: border-color var(--transition);
}
.google-card:hover { border-color: var(--border-md); }

/* ── Bandeau statut de session ────────────────────────────────── */
.status-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 20px 24px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.status-item { display: flex; align-items: center; gap: 12px; }
.status-icon { color: var(--success); }
.status-icon svg { width: 20px; height: 20px; }
.status-info { display: flex; flex-direction: column; }
.status-label {
  font-size: 0.65rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.status-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-1);
  font-family: monospace;
}
.status-separator {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 28px;
}

/* ── Grille de services (dashboard) ──────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.action-card {
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
  margin-bottom: 0;
  color: inherit;
  display: block;
}
.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-md);
  opacity: 1;
}

.card-content { display: flex; flex-direction: column; height: 100%; }
.card-main { padding: 22px; display: flex; gap: 16px; flex-grow: 1; }

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 1.15rem;
}
.card-icon svg { width: 20px; height: 20px; }

.card-text h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-1);
  letter-spacing: -0.3px;
}
.card-text p {
  font-size: 0.87rem;
  color: var(--text-3);
  line-height: 1.6;
  font-weight: 300;
}

.card-footer {
  padding: 11px 22px;
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: monospace;
}
.card-footer svg { width: 15px; height: 15px; color: var(--text-4); transition: transform var(--transition); }
.action-card:hover .card-footer svg { transform: translateX(3px); color: var(--text-2); }

/* ── État vide ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-3);
}
.empty-state svg { width: 30px; height: 30px; color: var(--text-4); margin-bottom: 14px; }
.empty-state p { font-size: 0.9rem; font-weight: 300; }

/* ── Hamburger mobile ─────────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 120;
  background: var(--surface-2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-1);
  transition: opacity var(--transition), transform var(--transition);
}
.sidebar-toggle svg { width: 18px; height: 18px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 95;
  backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Dashboard
═══════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 110;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .main-content { margin-left: 0; }
  header { left: 0; right: 0; padding-left: 64px; padding-right: 20px; }
  .google-container { padding: 24px 16px; margin-top: var(--header-h); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  header { height: 56px; }
  .google-container { margin-top: 56px; padding: 16px 12px; }
  .session-user span.session-user-text { display: none; }
  .status-card { flex-direction: column; align-items: flex-start; gap: 14px; }
  .status-separator { display: none; }
}

/* Accessibilité clavier */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--text-1);
  outline-offset: 2px;
}
