/* ============================================================
   SW DIGITAL — Panel Admin CSS
   ============================================================ */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #161616;
  --border: #2a2a2a;
  --border-light: #333333;
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --text-muted: #666666;
  --radius: 8px;
  --sidebar-width: 240px;
  --success: #4ade80;
  --error: #f87171;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.5; }
a { color: inherit; text-decoration: none; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary);
  position: relative;
}
.login-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 60% at 50% 50%, rgba(255,255,255,0.03) 0%, transparent 70%);
}
.login-card {
  position: relative; z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%; max-width: 400px;
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.login-logo img { width: 40px; height: 40px; object-fit: contain; }
.login-logo-text { font-size: 1.4rem; font-weight: 900; letter-spacing: 0.05em; }
.login-logo-text span { color: var(--text-muted); }
.login-header h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.3rem; }
.login-header p { font-size: 0.85rem; color: var(--text-muted); }

.form-group { margin-bottom: 1.2rem; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }
.form-input {
  width: 100%; padding: 0.85rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #fff; font-size: 0.9rem;
  transition: border-color 0.2s; font-family: inherit;
}
.form-input:focus { outline: none; border-color: rgba(255,255,255,0.3); }
.form-input::placeholder { color: var(--text-muted); }
textarea.form-input { resize: vertical; }

.btn-submit {
  width: 100%; padding: 0.9rem;
  background: #fff; color: #0a0a0a;
  border: none; border-radius: var(--radius);
  font-weight: 700; font-size: 0.95rem;
  cursor: pointer; transition: all 0.2s; margin-top: 0.5rem; font-family: inherit;
}
.btn-submit:hover { background: #e8e8e8; }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  display: none; color: var(--error); font-size: 0.85rem; text-align: center; margin-top: 1rem;
  padding: 0.7rem; background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.2); border-radius: var(--radius);
}

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; overflow-y: auto;
}
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; }
.sidebar-logo img { width: 32px; height: 32px; object-fit: contain; }
.sidebar-logo-text { font-size: 1.1rem; font-weight: 900; letter-spacing: 0.05em; }
.sidebar-logo-text span { color: var(--text-muted); }
.sidebar-subtitle { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 0.2rem; }

.sidebar-nav { flex: 1; padding: 1rem 0; }
.sidebar-section-label { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); padding: 1rem 1.5rem 0.5rem; }
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1.5rem;
  font-size: 0.88rem; font-weight: 500; color: var(--text-secondary);
  transition: all 0.2s; border-left: 2px solid transparent;
}
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,0.03); }
.sidebar-link.active { color: #fff; border-left-color: #fff; background: rgba(255,255,255,0.05); }
.sidebar-link .icon { width: 18px; text-align: center; font-size: 1rem; }

.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.sidebar-avatar { width: 32px; height: 32px; background: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; }
.sidebar-user-role { font-size: 0.72rem; color: var(--text-muted); }
.btn-logout { width: 100%; padding: 0.6rem; background: transparent; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); font-size: 0.82rem; cursor: pointer; transition: all 0.2s; font-family: inherit; }
.btn-logout:hover { color: var(--error); border-color: var(--error); }

/* Main */
.admin-main { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; }
.admin-topbar {
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; }
.topbar-subtitle { font-size: 0.8rem; color: var(--text-muted); }
.topbar-actions { display: flex; gap: 0.75rem; }

.btn-sm { padding: 0.5rem 1rem; border-radius: var(--radius); font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit; border: none; }
.btn-primary-sm { background: #fff; color: #0a0a0a; }
.btn-primary-sm:hover { background: #e8e8e8; }
.btn-outline-sm { background: transparent; color: #fff; border: 1px solid var(--border-light) !important; }
.btn-outline-sm:hover { border-color: #fff !important; }

.admin-content { padding: 2rem; flex: 1; }

/* Panels */
.panel { display: none; }
.panel.active { display: block; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.stat-card-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.stat-card-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }

/* Tables */
.data-table { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table-header { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border); }
.data-table-header h3 { font-size: 0.95rem; font-weight: 700; }

table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 0.75rem 1.5rem; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 1px solid var(--border); }
tbody td { padding: 1rem 1.5rem; font-size: 0.88rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Inline edit */
.editable-field {
  background: transparent; border: 1px solid transparent; color: #fff;
  padding: 0.3rem 0.5rem; border-radius: 4px; font-size: 0.88rem; font-family: inherit; width: 100%;
  transition: border-color 0.2s;
}
.editable-field:hover { border-color: var(--border-light); }
.editable-field:focus { outline: none; border-color: rgba(255,255,255,0.3); background: var(--bg-secondary); }

/* Boutons action */
.btn-action { padding: 0.35rem 0.7rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; font-family: inherit; }
.btn-danger { background: rgba(248,113,113,0.1); color: var(--error); border: 1px solid rgba(248,113,113,0.2) !important; }
.btn-danger:hover { background: rgba(248,113,113,0.2); }
.btn-edit { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid var(--border) !important; }
.btn-edit:hover { color: #fff; border-color: rgba(255,255,255,0.3) !important; }

/* Notification */
.notif {
  position: fixed; bottom: 2rem; right: 2rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.88rem; font-weight: 600;
  z-index: 9999;
  transform: translateY(100px); opacity: 0;
  transition: all 0.3s;
}
.notif.show { transform: translateY(0); opacity: 1; }
.notif-success { background: #161616; border: 1px solid var(--success); color: var(--success); }
.notif-error { background: #161616; border: 1px solid var(--error); color: var(--error); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 500; display: none; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.3rem; cursor: pointer; }
.modal-close:hover { color: #fff; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }

@media (max-width: 768px) {
  .admin-main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
