/* ============================================
   UZMA SPORT — Admin Panel CSS
   ============================================ */

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

:root {
  --red:       #E31212;
  --red-dark:  #b50e0e;
  --black:     #111111;
  --dark:      #1c1c1c;
  --dark2:     #252525;
  --grey-bg:   #f2f3f7;
  --grey-line: #e0e0e0;
  --grey-card: #ffffff;
  --text:      #333;
  --text-lt:   #777;
  --white:     #ffffff;
  --green:     #16a34a;
  --sidebar-w: 230px;
  --radius:    10px;
  --shadow:    0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.13);
}

html { font-size: 14px; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--grey-bg); color: var(--text); min-height: 100vh; }

/* =========================================
   LOGIN
   ========================================= */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--black) 0%, #2a0a0a 100%);
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%; max-width: 400px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

.login-logo {
  font-size: 2.2rem; font-weight: 900;
  color: var(--red); letter-spacing: 4px;
  text-align: center; margin-bottom: 4px;
}

.login-sub {
  text-align: center; color: var(--text-lt);
  font-size: 0.85rem; margin-bottom: 28px;
}

.login-card .form-group { margin-bottom: 16px; }

.login-card label {
  display: block; font-size: 0.8rem;
  font-weight: 600; color: var(--text-lt);
  margin-bottom: 6px;
}
.login-card label i { margin-right: 5px; color: var(--red); }

.login-card input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--grey-line);
  border-radius: 8px; font-size: 0.9rem;
  outline: none; transition: border-color 0.2s;
}
.login-card input:focus { border-color: var(--red); }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 44px; }
.toggle-pw {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text-lt); cursor: pointer; font-size: 0.9rem;
}

.login-error {
  color: var(--red); font-size: 0.8rem;
  text-align: center; min-height: 18px; margin-bottom: 8px;
}

.btn-login {
  width: 100%; background: var(--red); color: var(--white);
  border: none; border-radius: 8px;
  padding: 13px; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px;
  transition: background 0.2s;
}
.btn-login:hover { background: var(--red-dark); }

/* =========================================
   DASHBOARD LAYOUT
   ========================================= */
.dashboard { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--black);
  display: flex; flex-direction: column;
  position: fixed; top:0; left:0; bottom:0;
  z-index: 100;
  overflow-y: auto;
}

.admin-logo {
  padding: 24px 20px 20px;
  font-size: 1.4rem; font-weight: 900;
  color: var(--red); letter-spacing: 3px;
  border-bottom: 1px solid #2a2a2a;
}
.admin-logo span {
  display: block; font-size: 0.65rem;
  color: var(--text-lt); letter-spacing: 2px;
  font-weight: 500; margin-top: 2px;
}

.admin-nav { padding: 14px 0; flex: 1; }

.admin-link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px;
  color: #aaa; text-decoration: none;
  font-size: 0.88rem; font-weight: 600;
  border-left: 3px solid transparent;
  cursor: pointer; transition: all 0.2s;
}
.admin-link i { width: 18px; text-align: center; color: var(--red); }
.admin-link:hover, .admin-link.active {
  background: rgba(227,18,18,0.1);
  color: var(--white); border-left-color: var(--red);
}
.admin-link:hover i, .admin-link.active i { color: var(--white); }

.admin-sidebar-footer {
  padding: 16px;
  border-top: 1px solid #2a2a2a;
  display: flex; flex-direction: column; gap: 8px;
}

.btn-logout {
  background: rgba(227,18,18,0.15); color: var(--red);
  border: 1px solid rgba(227,18,18,0.3); border-radius: 8px;
  padding: 9px 14px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px;
  transition: all 0.2s;
}
.btn-logout:hover { background: var(--red); color: var(--white); }

.btn-site {
  background: #2a2a2a; color: #bbb;
  border: none; border-radius: 8px;
  padding: 9px 14px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px;
  text-decoration: none; transition: background 0.2s;
}
.btn-site:hover { background: #333; color: var(--white); }

/* --- Contenu principal --- */
.admin-content {
  margin-left: var(--sidebar-w);
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}

.admin-header {
  background: var(--white);
  padding: 18px 28px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--grey-line);
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 50;
}
.admin-header h1 { font-size: 1.2rem; font-weight: 800; color: var(--black); }

.admin-user {
  font-size: 0.82rem; color: var(--text-lt);
  display: flex; align-items: center; gap: 6px;
}
.admin-user i { color: var(--red); }

/* =========================================
   SECTIONS
   ========================================= */
.section { display: none; padding: 24px 28px; }
.section.active { display: block; }

/* =========================================
   TOOLBAR
   ========================================= */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}

.search-wrap {
  flex: 1; min-width: 200px;
  display: flex; align-items: center; gap: 10px;
  background: var(--white); border: 1.5px solid var(--grey-line);
  border-radius: 8px; padding: 0 14px;
}
.search-wrap i { color: var(--text-lt); }
.search-wrap input {
  flex: 1; border: none; outline: none;
  padding: 10px 0; font-size: 0.88rem; background: transparent;
}

.toolbar select {
  padding: 10px 14px; border: 1.5px solid var(--grey-line);
  border-radius: 8px; font-size: 0.85rem; background: var(--white);
  color: var(--text); outline: none; cursor: pointer;
}
.toolbar select:focus { border-color: var(--red); }

.btn-add-new {
  background: var(--red); color: var(--white);
  border: none; border-radius: 8px;
  padding: 10px 18px; font-size: 0.85rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  white-space: nowrap; transition: background 0.2s;
}
.btn-add-new:hover { background: var(--red-dark); }

/* Stats bar */
.stats-bar {
  display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap;
}
.stat-pill {
  background: var(--white);
  border: 1px solid var(--grey-line);
  border-radius: 20px; padding: 6px 14px;
  font-size: 0.8rem; font-weight: 600;
  display: flex; align-items: center; gap: 6px; color: var(--text);
}
.stat-pill i { color: var(--red); }

/* =========================================
   TABLE PRODUITS
   ========================================= */
.products-table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.products-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.84rem;
}

.products-table thead th {
  background: var(--black); color: var(--white);
  padding: 12px 16px; text-align: left;
  font-weight: 700; white-space: nowrap;
}
.products-table thead th:first-child { border-radius: var(--radius) 0 0 0; }
.products-table thead th:last-child  { border-radius: 0 var(--radius) 0 0; }

.products-table tbody tr { border-bottom: 1px solid var(--grey-line); transition: background 0.15s; }
.products-table tbody tr:hover { background: #fafafa; }
.products-table tbody tr:last-child { border-bottom: none; }

.products-table td { padding: 10px 16px; vertical-align: middle; }

.tbl-img {
  width: 52px; height: 52px;
  object-fit: cover; border-radius: 8px;
  display: block;
}

.tbl-name { font-weight: 700; color: var(--black); }
.tbl-cat {
  display: inline-block;
  background: var(--grey-bg);
  color: var(--text-lt);
  font-size: 0.72rem; font-weight: 600;
  padding: 3px 9px; border-radius: 12px;
}

.tbl-price { font-weight: 800; color: var(--black); }
.tbl-sale  { font-weight: 700; color: var(--red); }

.tbl-badge {
  display: inline-block;
  background: var(--red); color: var(--white);
  font-size: 0.68rem; font-weight: 700;
  padding: 3px 9px; border-radius: 12px;
}
.tbl-no-badge { color: var(--grey-line); font-size: 0.8rem; }

.toggle-visible {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; transition: color 0.2s;
}
.toggle-visible.on  { color: var(--green); }
.toggle-visible.off { color: var(--grey-line); }

.tbl-actions { display: flex; gap: 8px; align-items: center; }

.btn-edit {
  background: #eff6ff; color: #2563eb;
  border: 1px solid #bfdbfe; border-radius: 6px;
  padding: 6px 12px; font-size: 0.78rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 5px;
  transition: background 0.2s;
}
.btn-edit:hover { background: #dbeafe; }

.btn-delete {
  background: #fff1f1; color: var(--red);
  border: 1px solid #fecaca; border-radius: 6px;
  padding: 6px 12px; font-size: 0.78rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 5px;
  transition: background 0.2s;
}
.btn-delete:hover { background: #fee2e2; }

.loading-row {
  text-align: center; padding: 40px !important;
  color: var(--text-lt); font-size: 0.9rem;
}
.loading-row i { margin-right: 8px; color: var(--red); }

/* =========================================
   FORMULAIRE AJOUT/MODIF
   ========================================= */
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
  max-width: 860px;
}

.form-card h2 {
  font-size: 1.1rem; font-weight: 800;
  color: var(--black); margin-bottom: 24px;
  display: flex; align-items: center; gap: 10px;
}
.form-card h2 i { color: var(--red); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
  font-size: 0.8rem; font-weight: 700;
  color: var(--text-lt);
}
.form-group label small { font-weight: 400; margin-left: 4px; }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--grey-line);
  border-radius: 8px; font-size: 0.88rem;
  outline: none; transition: border-color 0.2s;
  font-family: inherit; resize: vertical;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--red); }

.img-preview-wrap {
  margin-top: 10px;
  border: 2px dashed var(--grey-line);
  border-radius: 8px; padding: 12px;
  display: flex; align-items: center; justify-content: center;
  min-height: 120px; background: var(--grey-bg);
}
#imgPreview {
  max-height: 160px; max-width: 100%;
  border-radius: 8px; object-fit: cover;
}
.no-preview { color: var(--grey-line); font-size: 2rem; }

.form-error {
  color: var(--red); font-size: 0.8rem;
  min-height: 18px; margin: 12px 0 0;
}

.form-actions {
  display: flex; gap: 12px; margin-top: 24px;
}

.btn-save {
  background: var(--red); color: var(--white);
  border: none; border-radius: 8px;
  padding: 12px 28px; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  transition: background 0.2s;
}
.btn-save:hover { background: var(--red-dark); }

.btn-cancel {
  background: var(--grey-bg); color: var(--text);
  border: 1px solid var(--grey-line); border-radius: 8px;
  padding: 12px 24px; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  transition: background 0.2s;
}
.btn-cancel:hover { background: var(--grey-line); }

/* =========================================
   STATISTIQUES
   ========================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
}
.stat-card.red   { background: var(--red); color: var(--white); }
.stat-card.dark  { background: var(--dark2); color: var(--white); }
.stat-card.green { background: var(--green); color: var(--white); }
.stat-card.grey  { background: var(--white); color: var(--text); border: 1px solid var(--grey-line); }

.stat-card i { font-size: 2rem; opacity: 0.8; }
.stat-num  { display: block; font-size: 2rem; font-weight: 900; line-height: 1; }
.stat-label{ display: block; font-size: 0.78rem; opacity: 0.8; margin-top: 4px; }

/* =========================================
   MODAL SUPPRESSION
   ========================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}

.modal {
  background: var(--white);
  border-radius: 14px; padding: 32px 28px;
  max-width: 360px; width: 90%;
  text-align: center; box-shadow: var(--shadow-md);
}

.modal-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: #fff1f1; color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin: 0 auto 16px;
}
.modal h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 8px; }
.modal p  { font-size: 0.85rem; color: var(--text-lt); margin-bottom: 24px; }

.modal-actions { display: flex; gap: 10px; justify-content: center; }

.btn-confirm-delete {
  background: var(--red); color: var(--white);
  border: none; border-radius: 8px;
  padding: 10px 24px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; transition: background 0.2s;
}
.btn-confirm-delete:hover { background: var(--red-dark); }

.btn-modal-cancel {
  background: var(--grey-bg); color: var(--text);
  border: 1px solid var(--grey-line); border-radius: 8px;
  padding: 10px 24px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer;
}

/* =========================================
   TOAST ADMIN
   ========================================= */
.admin-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--black); color: var(--white);
  padding: 12px 22px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  transform: translateY(10px);
  box-shadow: var(--shadow-md); z-index: 9999;
}
.admin-toast.show { opacity: 1; transform: translateY(0); }
.admin-toast.success { background: var(--green); }
.admin-toast.error   { background: var(--red); }

/* =========================================
   RESPONSIVE ADMIN (tablette)
   ========================================= */
@media (max-width: 768px) {
  .admin-sidebar { width: 60px; }
  .admin-logo, .admin-link span, .admin-sidebar-footer { display: none; }
  .admin-link { justify-content: center; padding: 16px; }
  .admin-content { margin-left: 60px; }
  .section { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full-width { grid-column: 1; }
  .admin-header { padding: 14px 16px; }
}

.btn-reset {
  background: #1a1a1a; color: #fff;
  border: none; border-radius: 8px;
  padding: 10px 16px; font-size: 0.85rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  white-space: nowrap; transition: background 0.2s;
}
.btn-reset:hover { background: #333; }

/* ============ UPLOAD IMAGE ============ */
.upload-zone {
  border: 2px dashed var(--grey-line);
  border-radius: 10px;
  padding: 22px;
  text-align: center;
  cursor: pointer;
  background: var(--grey-bg);
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.upload-zone:hover {
  border-color: var(--red);
  background: #fff5f5;
}
.upload-zone i {
  font-size: 2rem;
  color: var(--red);
}
.upload-zone span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-lt);
}

.upload-progress {
  height: 6px;
  background: var(--grey-line);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}
.upload-fill {
  height: 100%;
  background: var(--red);
  border-radius: 6px;
  width: 0%;
  transition: width 0.2s;
}

.url-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 8px;
  color: var(--text-lt);
  font-size: 0.78rem;
}
.url-separator::before,
.url-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--grey-line);
}

/* ============ CONFIG STATUS ============ */
.config-status { margin-bottom: 20px; }

.config-ok, .config-warn, .config-off {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}
.config-ok   { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.config-warn { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.config-off  { background: #fff1f1; color: #E31212; border: 1px solid #fecaca; }
.config-ok i, .config-warn i, .config-off i { font-size: 1.1rem; }
.config-status code {
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
}

/* ============ GRAPHIQUES STATISTIQUES ============ */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.chart-card h3 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--black);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--grey-line);
}

/* Cercles */
.circles-row {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 16px;
}

.circle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  width: 90px;
}

.circle-svg {
  width: 90px;
  height: 90px;
  transform: rotate(-90deg);
}

.circle-bg {
  fill: none;
  stroke: #f0f0f0;
  stroke-width: 10;
}

.circle-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  transition: stroke-dashoffset 1s ease;
}

.circle-pct {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -42%);
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--black);
}

.circle-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
  text-align: center;
}

/* Barres horizontales */
.bars-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bar-item {}

.bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.bar-info span:last-child {
  color: var(--text-light);
}

.bar-track {
  background: #f0f0f0;
  border-radius: 10px;
  height: 10px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 10px;
  width: 0%;
  transition: width 1s ease;
}
