/* ============================================================
   Channel Manager Georgi Invest — Admin Stylesheet
   Charte alignée sur georgi-invest.com (noir + or)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Raleway:wght@300;400;500;600;700&family=Cormorant+Garamond:wght@400;500;600&display=swap');

:root {
  --color-bg-dark:       #0a0a0a;
  --color-bg-section:    #111111;
  --color-bg-card:       #1a1a1a;
  --color-bg-card-hover: #222222;
  --color-bg-input:      #161616;
  --color-gold:          #c6a057;
  --color-gold-light:    #ded594;
  --color-gold-dark:     #9a7a3a;
  --color-white:         #ffffff;
  --color-text:          #d4d4d4;
  --color-text-muted:    #888888;
  --color-border:        #2a2a2a;
  --color-border-gold:   rgba(198, 160, 87, 0.3);
  --color-success:       #4caf50;
  --color-warning:       #ff9800;
  --color-danger:        #e53935;
  --color-info:          #2196f3;

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Raleway', 'Segoe UI', sans-serif;
  --font-accent:  'Cormorant Garamond', Georgia, serif;

  --sidebar-w: 260px;
  --header-h: 70px;
  --radius: 4px;
  --transition: all .25s ease;
}

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

html { font-size: 15px; }

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

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

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-white);
  font-weight: 600;
  letter-spacing: .3px;
}
h1 { font-size: 2rem;   margin-bottom: .25rem; }
h2 { font-size: 1.5rem; margin-bottom: .25rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

.subtitle {
  font-family: var(--font-accent);
  font-size: 1.05rem;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  font-weight: 500;
}

.gold-line {
  width: 50px; height: 2px;
  background: linear-gradient(90deg, var(--color-gold-dark), var(--color-gold-light));
  margin: .8rem 0 1.5rem;
}

/* ============================================================
   LAYOUT — Sidebar + main
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #0d0d0d 0%, #050505 100%);
  border-right: 1px solid var(--color-border);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem 1.5rem 1.2rem;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: .8rem;
}
.sidebar-brand .logo-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--color-gold-dark), var(--color-gold));
  color: var(--color-bg-dark);
  font-family: var(--font-heading);
  font-weight: 700; font-size: 1.2rem;
  border-radius: var(--radius);
}
.sidebar-brand .brand-text {
  font-family: var(--font-heading);
  color: var(--color-white);
  font-size: 1.05rem;
  line-height: 1.1;
}
.sidebar-brand .brand-text small {
  display: block;
  font-family: var(--font-accent);
  font-size: .8rem;
  color: var(--color-gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav { padding: 1rem 0; flex: 1; }
.sidebar-nav .nav-group {
  padding: .8rem 1.5rem .4rem;
  font-family: var(--font-accent);
  font-size: .75rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.sidebar-nav a {
  display: flex; align-items: center; gap: .8rem;
  padding: .65rem 1.5rem;
  color: var(--color-text);
  border-left: 3px solid transparent;
  font-size: .92rem;
}
.sidebar-nav a:hover {
  background: var(--color-bg-card);
  color: var(--color-gold);
  border-left-color: var(--color-gold-dark);
}
.sidebar-nav a.active {
  background: var(--color-bg-card);
  color: var(--color-gold);
  border-left-color: var(--color-gold);
  font-weight: 600;
}
.sidebar-nav .nav-icon { font-size: 1.1rem; opacity: .9; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: .8rem;
  color: var(--color-text-muted);
}
.sidebar-footer strong { color: var(--color-gold); font-weight: 500; }

/* ============================================================
   HEADER + main area
   ============================================================ */
.main { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: var(--header-h);
  background: var(--color-bg-section);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title h1 { font-size: 1.4rem; }
.topbar-title .crumb { font-family: var(--font-accent); color: var(--color-gold); font-size: .85rem; letter-spacing: 2px; text-transform: uppercase; }

.topbar-user { display: flex; align-items: center; gap: 1rem; }
.user-chip {
  display: flex; align-items: center; gap: .7rem;
  padding: .4rem .9rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.user-chip .avatar {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--color-gold-dark), var(--color-gold));
  color: var(--color-bg-dark);
  border-radius: 50%;
  font-weight: 700; font-size: .85rem;
}
.user-chip .name { color: var(--color-white); font-size: .9rem; font-weight: 500; }
.user-chip .role { font-size: .72rem; color: var(--color-gold); text-transform: uppercase; letter-spacing: 1.5px; }

.content { padding: 2rem; flex: 1; }
.content-header { margin-bottom: 2rem; }
.content-header .actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.content-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }

/* ============================================================
   Cartes / Panels
   ============================================================ */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: var(--transition);
}
.card:hover { border-color: var(--color-border-gold); }
.card-title {
  font-family: var(--font-heading);
  color: var(--color-white);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: .8rem;
  border-bottom: 1px solid var(--color-border);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}
.kpi {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-gold);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
}
.kpi .label {
  font-family: var(--font-accent);
  color: var(--color-gold);
  text-transform: uppercase;
  font-size: .78rem;
  letter-spacing: 2px;
  margin-bottom: .4rem;
}
.kpi .value {
  font-family: var(--font-heading);
  color: var(--color-white);
  font-size: 1.9rem;
  font-weight: 600;
}
.kpi .delta { font-size: .8rem; color: var(--color-text-muted); margin-top: .3rem; }

/* ============================================================
   Boutons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.2;
}
.btn-primary {
  background: linear-gradient(135deg, var(--color-gold-dark), var(--color-gold));
  color: var(--color-bg-dark);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
  color: var(--color-bg-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(198,160,87,.25);
}
.btn-outline {
  background: transparent;
  color: var(--color-gold);
  border-color: var(--color-gold);
}
.btn-outline:hover { background: var(--color-gold); color: var(--color-bg-dark); }

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-ghost:hover { border-color: var(--color-gold); color: var(--color-gold); }

.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
}
.btn-danger:hover { background: var(--color-danger); color: var(--color-white); }

.btn-sm { padding: .4rem .9rem; font-size: .72rem; }

/* ============================================================
   Tableaux
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
table.data th, table.data td {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: middle;
}
table.data thead th {
  font-family: var(--font-accent);
  color: var(--color-gold);
  font-size: .8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
  background: rgba(198,160,87,.05);
}
table.data tbody tr:hover { background: var(--color-bg-card-hover); }
table.data .row-actions { display: flex; gap: .4rem; justify-content: flex-end; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-block;
  padding: .25rem .7rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid;
}
.badge-success { color: var(--color-success); border-color: var(--color-success); background: rgba(76,175,80,.1); }
.badge-warning { color: var(--color-warning); border-color: var(--color-warning); background: rgba(255,152,0,.1); }
.badge-danger  { color: var(--color-danger);  border-color: var(--color-danger);  background: rgba(229,57,53,.1); }
.badge-info    { color: var(--color-info);    border-color: var(--color-info);    background: rgba(33,150,243,.1); }
.badge-gold    { color: var(--color-gold);    border-color: var(--color-gold);    background: rgba(198,160,87,.12); }
.badge-muted   { color: var(--color-text-muted); border-color: var(--color-border); }

/* ============================================================
   Formulaires
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
}
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-family: var(--font-accent);
  color: var(--color-gold);
  text-transform: uppercase;
  font-size: .8rem;
  letter-spacing: 2px;
  font-weight: 500;
}
label .required { color: var(--color-danger); margin-left: 2px; }

input[type=text], input[type=email], input[type=password],
input[type=number], input[type=tel], input[type=url], input[type=date],
input[type=time], select, textarea {
  width: 100%;
  padding: .7rem .9rem;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-white);
  font-family: var(--font-body);
  font-size: .95rem;
  transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(198,160,87,.15);
}
textarea { resize: vertical; min-height: 100px; font-family: var(--font-body); }

.hint { color: var(--color-text-muted); font-size: .8rem; }

.form-actions {
  display: flex; gap: .8rem; flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   Alertes / flash
   ============================================================ */
.alerts { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: .6rem; }
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: .92rem;
  display: flex; align-items: center; gap: .7rem;
}
.alert-success { color: var(--color-success); border-color: var(--color-success); background: rgba(76,175,80,.08); }
.alert-error   { color: var(--color-danger);  border-color: var(--color-danger);  background: rgba(229,57,53,.08); }
.alert-info    { color: var(--color-info);    border-color: var(--color-info);    background: rgba(33,150,243,.08); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at top, #1a1a1a 0%, #0a0a0a 60%);
  padding: 2rem;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-gold);
  border-radius: var(--radius);
  padding: 2.5rem;
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-brand .logo-mark {
  width: 60px; height: 60px;
  margin: 0 auto 1rem;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--color-gold-dark), var(--color-gold));
  color: var(--color-bg-dark);
  font-family: var(--font-heading);
  font-weight: 700; font-size: 1.8rem;
  border-radius: var(--radius);
}
.login-brand h1 { font-size: 1.4rem; }
.login-brand .subtitle { font-size: .85rem; }
.login-card .form-actions { border: none; padding: 0; margin-top: 1.5rem; }
.login-card .btn { width: 100%; }

/* ============================================================
   Misc
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
  font-family: var(--font-accent);
  font-size: 1.1rem;
}
.empty-state-icon { font-size: 3rem; opacity: .3; margin-bottom: 1rem; }

.divider { height: 1px; background: var(--color-border); margin: 1.5rem 0; border: 0; }

.row-stack { display: flex; flex-direction: column; gap: .2rem; }
.row-stack .secondary { color: var(--color-text-muted); font-size: .82rem; }

.placeholder-note {
  padding: 1rem 1.2rem;
  background: rgba(198,160,87,.06);
  border: 1px dashed var(--color-border-gold);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: .9rem;
}

/* ============================================================
   Burger menu (mobile)
   ============================================================ */
.burger {
  display: none;
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  padding: 0;
}
.burger span {
  width: 22px; height: 2px;
  background: var(--color-gold);
  transition: var(--transition);
}
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 90;
  backdrop-filter: blur(4px);
}
.sidebar-close {
  display: none;
  position: absolute; top: 1rem; right: 1rem;
  background: transparent; border: none;
  color: var(--color-gold); font-size: 1.6rem; cursor: pointer;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
}

/* ============================================================
   Responsive — Tablette (≤ 900px)
   ============================================================ */
@media (max-width: 900px) {
  html { font-size: 14px; }

  .app-shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed; top: 0; left: 0;
    height: 100vh; width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .3s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,.6);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-close { display: flex; }

  .topbar { padding: 0 1rem; flex-wrap: wrap; gap: .5rem; }
  .burger { display: flex; }
  .topbar-title h1 { font-size: 1.15rem; }
  .topbar-title .crumb { font-size: .7rem; }
  .topbar-user .user-chip .role { display: none; }
  .topbar-user .user-chip { padding: .3rem .6rem; gap: .5rem; }
  .topbar-user .user-chip .name { font-size: .82rem; }
  .topbar-user .user-chip .avatar { width: 28px; height: 28px; font-size: .75rem; }

  .content { padding: 1rem; }
  .content-header { flex-direction: column; align-items: flex-start; }
  .content-header .actions { width: 100%; }
  .content-header .actions .btn { flex: 1; }

  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
  .kpi { padding: 1rem; }
  .kpi .value { font-size: 1.5rem; }

  .card { padding: 1.2rem; }

  /* Tableaux : conserver le scroll horizontal avec indicateur visuel */
  .table-wrap {
    margin: 0 -1rem;
    padding: 0 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap::-webkit-scrollbar { height: 6px; }
  .table-wrap::-webkit-scrollbar-thumb { background: var(--color-gold-dark); border-radius: 3px; }
  table.data { min-width: 600px; }
  table.data th, table.data td { padding: .7rem .8rem; font-size: .85rem; }
  .row-actions { flex-wrap: wrap; gap: .3rem; }

  /* Boutons : plus grands pour le tactile */
  .btn { padding: .75rem 1.2rem; font-size: .78rem; min-height: 44px; }
  .btn-sm { min-height: 36px; padding: .5rem .9rem; }

  /* Formulaires : tout sur une colonne en mobile */
  .form-grid { grid-template-columns: 1fr; gap: .9rem; }
  input, select, textarea { font-size: 16px; padding: .8rem; } /* 16px évite le zoom auto iOS */
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  /* Photos grid plus compact */
  .card div[style*="repeat(auto-fill"] { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important; }
}

/* ============================================================
   Responsive — Smartphone (≤ 600px)
   ============================================================ */
@media (max-width: 600px) {
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }

  .topbar { height: 60px; }
  .topbar-user .user-chip .name { display: none; }
  .topbar-user form .btn { padding: .5rem .8rem; font-size: .7rem; }

  .login-card { padding: 1.8rem 1.4rem; }
  .login-brand .logo-mark { width: 50px; height: 50px; font-size: 1.5rem; }

  /* KPI : empilés mais lisibles */
  .kpi-grid { grid-template-columns: 1fr 1fr; }

  .placeholder-note { font-size: .82rem; padding: .8rem 1rem; }

  /* Sidebar plein écran sur les vraiment petits écrans */
  .sidebar { width: 85vw; max-width: 320px; }
}

/* ============================================================
   Responsive — Très grand écran (≥ 1400px)
   ============================================================ */
@media (min-width: 1400px) {
  .content { max-width: 1400px; margin: 0 auto; padding: 2.5rem 3rem; width: 100%; }
}

/* ============================================================
   Tactile : meilleurs feedback
   ============================================================ */
@media (hover: none) {
  .btn:active { transform: scale(.97); }
  .card:hover { border-color: var(--color-border); }
  .sidebar-nav a:hover { background: transparent; color: var(--color-text); border-left-color: transparent; }
  .sidebar-nav a:active { background: var(--color-bg-card); color: var(--color-gold); }
}
