/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #eff6ff;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg-page: #f3f4f6;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.06);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition: .2s ease;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { font-family: var(--font); background: var(--bg-page); color: var(--text-primary); min-height: 100vh; line-height: 1.5; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: var(--font); cursor: pointer; }

/* === TOPBAR === */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 900;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.topbar-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
  flex-shrink: 0;
}
.topbar-brand span { color: var(--text-primary); }
.topbar-contact {
  display: flex;
  gap: 20px;
  align-items: center;
  flex: 1;
}
.topbar-contact a {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.topbar-contact a:hover { color: var(--brand); }
.topbar-contact i { font-size: 15px; color: var(--brand); }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* === BUTTONS === */
.btn-primary {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-danger:hover { background: var(--danger-dark); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--bg-page); color: var(--text-primary); }
.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

/* === ALERT === */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert.success { background: var(--success-bg); color: #166534; border: 1px solid var(--success-border); }
.alert.error { background: var(--error-bg); color: #991b1b; border: 1px solid var(--error-border); }
.alert i { flex-shrink: 0; margin-top: 1px; }

/* === FORM ELEMENTS === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-group input::placeholder { color: var(--text-muted); }

/* === MODAL === */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s ease;
  position: relative;
}
@keyframes modalIn {
  from { transform: translateY(-20px) scale(.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-head h2 { font-size: 20px; font-weight: 600; color: var(--text-primary); }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-page); }
.modal-footer { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-secondary); }
.modal-footer a { color: var(--brand); font-weight: 500; cursor: pointer; }
.modal-footer a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* === HERO SLIDER === */
.hero-slider {
  position: relative;
  width: 100%;
  height: 520px;
  overflow: hidden;
}
.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .9s ease;
}
.slide.active { opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,.6) 0%, rgba(0,0,0,.15) 60%, transparent 100%);
}
.slide-content {
  position: absolute;
  top: 50%;
  left: 8%;
  transform: translateY(-50%);
  color: #fff;
  max-width: 500px;
}
.slide-content h2 { font-size: 40px; font-weight: 700; line-height: 1.2; margin-bottom: 14px; text-shadow: 0 2px 8px rgba(0,0,0,.3); }
.slide-content p { font-size: 17px; opacity: .9; line-height: 1.6; }
.slide-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  cursor: pointer;
  transition: all var(--transition);
}
.dot.active { background: #fff; width: 24px; border-radius: 4px; }

/* === AUTH PAGE (login.php) === */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #f3f4f6 50%, #faf5ff 100%);
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-text { font-size: 24px; font-weight: 700; color: var(--brand); }
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.auth-title { font-size: 22px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.auth-sub { font-size: 14px; color: var(--text-secondary); margin-bottom: 22px; }

/* === DASHBOARD LAYOUT === */
.dash-wrapper {
  display: flex;
  min-height: calc(100vh - 64px);
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}
.sidebar-avatar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}
.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-avatar-info { overflow: hidden; }
.sidebar-avatar-info .name {
  font-size: 14px;
  font-weight: 500;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-avatar-info .role {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}
.sidebar-section { margin-bottom: 24px; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
  padding: 0 10px;
  margin-bottom: 4px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 14px;
  font-weight: 400;
  transition: all var(--transition);
  cursor: pointer;
}
.sidebar-link i { font-size: 17px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.sidebar-link.active { background: rgba(37,99,235,.18); color: #93c5fd; }
.sidebar-spacer { flex: 1; }
.sidebar-bottom { border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; }

/* === MAIN CONTENT === */
.dash-main {
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
}
.page-header { margin-bottom: 26px; }
.page-header h1 { font-size: 22px; font-weight: 600; color: var(--text-primary); }
.page-header p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue { background: #eff6ff; color: var(--brand); }
.stat-icon.green { background: #f0fdf4; color: var(--success); }
.stat-icon.amber { background: #fffbeb; color: #d97706; }
.stat-icon.purple { background: #faf5ff; color: #7c3aed; }
.stat-info .label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat-info .value { font-size: 22px; font-weight: 600; color: var(--text-primary); margin-top: 2px; }
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.content-card h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.info-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.info-row .info-label { color: var(--text-muted); width: 130px; flex-shrink: 0; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.info-row .info-value { color: var(--text-primary); font-weight: 500; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.badge.green { background: var(--success-bg); color: #166534; border: 1px solid var(--success-border); }
.badge.blue { background: var(--brand-light); color: #1d4ed8; border: 1px solid #bfdbfe; }

/* Mobile hamburger */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  padding: 6px;
  cursor: pointer;
  margin-right: 4px;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 800;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 850;
    transform: translateX(-105%);
    transition: transform .28s ease;
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .mobile-menu-btn { display: flex; align-items: center; }
  .dash-main { padding: 20px 16px; }
}

@media (max-width: 640px) {
  .topbar-contact { display: none; }
  .topbar-inner { gap: 12px; }
  .hero-slider { height: 320px; }
  .slide-content h2 { font-size: 26px; }
  .slide-content p { font-size: 14px; }
  .auth-card { padding: 28px 20px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-header h1 { font-size: 18px; }
}

@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr; }
}
