/* ═══════════════════════════════════════════════
   ISantas – Admin Panel Stylesheet
   ═══════════════════════════════════════════════ */

:root {
  --primary:      #2FA4C7;   /* Bleu principal */
  --primary-dark: #1F7FA3;   /* Bleu foncé — hover */
  --primary-light:#6EC1D6;   /* Bleu clair — accents */
  --secondary:    #0D2B3E;   /* Sidebar fond */
  --sidebar-w:    240px;
  --bg:           #EFF6FA;   /* Fond admin légèrement bleuté */
  --card:         #FFFFFF;
  --text:         #1A2D3A;
  --text-mid:     #4A6070;
  --border:       #D0E6EF;
  --green:        #16A34A;
  --orange:       #D97706;
  --red:          #DC2626;
  --blue:         #2563EB;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 1px 6px rgba(47,164,199,.10);
  --shadow-md:    0 4px 16px rgba(47,164,199,.18);
  --transition:   .2s ease;
}

/* ── Reset ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font: inherit; }

/* ── Layout ──────────────────────────────────── */
.admin-layout {
  display: flex; min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: var(--secondary);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center;
}
.sidebar-logo img { height: 44px; width: auto; object-fit: contain; }
.sidebar-nav {
  flex: 1; padding: 16px 0; overflow-y: auto;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; color: #9CA3AF; font-weight: 500; font-size: .95rem;
  transition: all var(--transition);
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(47,164,199,.18); color: var(--primary);
  border-right: 3px solid var(--primary);
}
.sidebar-logout {
  margin: 12px 16px 20px; padding: 10px 16px; border-radius: var(--radius);
  background: rgba(220,38,38,.15); color: #F87171; border: 1px solid rgba(220,38,38,.3);
  cursor: pointer; font-weight: 600; transition: all var(--transition); text-align: left;
}
.sidebar-logout:hover { background: rgba(220,38,38,.25); }

/* ── Main Area ──────────────────────────────── */
.admin-main {
  flex: 1; margin-left: var(--sidebar-w); min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ── Topbar ──────────────────────────────────── */
.admin-topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); padding: 0 28px; height: 62px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.menu-toggle {
  display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-mid);
}
.admin-page-title { font-size: 1.3rem; font-weight: 700; flex: 1; }
.admin-user       { font-size: .9rem; color: var(--text-mid); }

/* ── Content padding ──────────────────────────── */
.admin-main > *:not(.admin-topbar) { padding: 28px; }

/* ── Stats Grid ─────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px; margin-bottom: 32px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.stat-icon   { font-size: 2rem; }
.stat-label  { font-size: .85rem; color: var(--text-mid); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-value  { font-size: 2rem; font-weight: 800; }
.stat-card.color-orange .stat-value { color: var(--primary); }
.stat-card.color-green  .stat-value { color: var(--green); }
.stat-card.color-blue   .stat-value { color: var(--blue); }
.stat-card.color-red    .stat-value { color: var(--red); }
.loading-card { color: var(--text-mid); font-style: italic; }

/* ── Admin Section ───────────────────────────── */
.admin-section        { background: var(--card); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.admin-section-title  { font-size: 1.1rem; font-weight: 700; margin-bottom: 18px; }

/* ── Table ───────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th {
  background: #F9FAFB; padding: 11px 14px; text-align: left;
  font-weight: 700; color: var(--text-mid); font-size: .8rem;
  text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td      { background: #FAFBFC; }
.text-center { text-align: center; }

/* ── Thumb image in table ─────────────────────── */
.thumb {
  width: 44px; height: 44px; border-radius: var(--radius); object-fit: cover;
  background: #f0f0f0;
}
.thumb-placeholder {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: #f0f0f0; display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}

/* ── Status Badges ───────────────────────────── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .78rem; font-weight: 700; text-transform: capitalize;
}
.badge-pending   { background: #FEF3C7; color: #92400E; }
.badge-confirmed { background: #DBEAFE; color: #1E40AF; }
.badge-shipped   { background: #EDE9FE; color: #6D28D9; }
.badge-delivered { background: #D1FAE5; color: #065F46; }
.badge-cancelled { background: #FEE2E2; color: #991B1B; }
.badge-admin     { background: #FEE2E2; color: #991B1B; }
.badge-user      { background: #DBEAFE; color: #1E40AF; }

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius);
  font-weight: 600; cursor: pointer; border: none; transition: all var(--transition);
  text-decoration: none;
}
.btn-primary     { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline     { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger      { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm          { padding: 6px 12px; font-size: .85rem; }
.btn-block       { display: flex; justify-content: center; width: 100%; }
.mt-1            { margin-top: 12px; }

/* ── Forms ───────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; color: var(--text);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: #fff; font-size: .95rem;
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,164,199,.18); }
.form-group textarea { resize: vertical; }
.form-group small    { display: block; margin-top: 5px; color: var(--text-mid); font-size: .82rem; }
.form-group small code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.search-bar   { margin-bottom: 20px; }
.search-input { padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: .95rem; width: 100%; max-width: 380px; }
.search-input:focus { outline: none; border-color: var(--primary); }
.filter-row   { display: flex; gap: 12px; margin-bottom: 20px; }
.select       { padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: .92rem; cursor: pointer; }
.select:focus { outline: none; border-color: var(--primary); }

/* ── Alerts ──────────────────────────────────── */
.alert          { padding: 12px 16px; border-radius: var(--radius); font-size: .9rem; margin-bottom: 16px; }
.alert-danger   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success  { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }

/* ── Modal ───────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 400;
}
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--card); border-radius: var(--radius-lg);
  width: min(640px, 96vw); max-height: 88vh; overflow-y: auto;
  z-index: 500; box-shadow: var(--shadow-md); padding: 24px;
}
.modal-sm { width: min(400px, 94vw); }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.modal-header h2  { font-size: 1.15rem; font-weight: 700; }
.modal-close      { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-mid); padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { background: #f3f4f6; }
.modal-footer     { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Login Page ──────────────────────────────── */
.login-body  { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--secondary); }
.login-card  {
  background: var(--card); border-radius: var(--radius-lg); padding: 40px 36px;
  width: min(420px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo  { margin-bottom: 12px; display: flex; justify-content: center; }
.login-logo img { height: 60px; width: auto; }
.login-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.login-sub   { color: var(--text-mid); margin-bottom: 28px; }
.login-hint  { margin-top: 18px; font-size: .82rem; color: var(--text-mid); text-align: center; }

/* ── Image Upload ────────────────────────────── */
.image-upload-wrap input[type="file"] {
  padding: 7px; background: #f9fafb;
}

/* ── Settings Card ───────────────────────────── */
.settings-card     { background: var(--card); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); max-width: 700px; }
.settings-section  { margin-bottom: 32px; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
.settings-section:last-of-type { border-bottom: none; }
.settings-section h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 18px; color: var(--text); }
.whatsapp-preview  { background: #F0FDF4; border: 1px solid #BBF7D0; border-radius: var(--radius); padding: 12px 16px; font-size: .88rem; color: #166534; margin-top: 8px; }
.whatsapp-preview code { font-family: 'Consolas', monospace; }

/* ── Order detail ────────────────────────────── */
.order-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 18px; }
.order-detail-col  { }
.order-detail-label { font-size: .8rem; color: var(--text-mid); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.order-detail-value { font-weight: 600; }
.order-items-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: 8px; }
.order-items-table th, .order-items-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.order-items-table th { background: #f9fafb; font-weight: 700; }
.order-items-total { font-weight: 800; font-size: 1rem; color: var(--primary); }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .menu-toggle { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row   { grid-template-columns: 1fr; }
  .order-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-topbar { padding: 0 16px; }
}

/* ── Stat carte En attente ────────────────────────────── */
.stat-card.color-pending .stat-value { color: #D97706; }


/* ── Blog — tags catégorie ───────────────────────────── */
.cat-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}

/* ── Blog — modal large ──────────────────────────────── */
.blog-modal { width: min(780px, 97vw); }
.blog-content-area { font-family: 'Consolas', monospace; font-size: .88rem; line-height: 1.6; }

/* ── Badges stock ─────────────────────────────────────── */
.stock-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: .82rem;
}
.stock-ok   { background: #D1FAE5; color: #065F46; }
.stock-low  { background: #FEF3C7; color: #92400E; }
.stock-zero { background: #FEE2E2; color: #991B1B; }
