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

:root {
  --primary: #001b60;
  --primary-dark: #001040;
  --primary-light: #1380b4;
  --accent: #1380b4;
  --accent-hover: #0f6a96;
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --success: #95c300;
  --warning: #f39c12;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --sidebar-width: 260px;
  --sidebar-collapsed: 68px;
  --text-main: #2d3748;
  --text-muted: #718096;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --radius: 8px;
  --transition: all 0.22s ease;
}

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

body {
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg);
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #001b60 0%, #1380b4 60%, #95c300 100%);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 100;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 64px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: -0.5px;
}

.logo-text {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  opacity: 1;
  transition: opacity 0.18s ease;
}
.logo-text span { display: block; font-weight: 300; font-size: 11px; opacity: 0.65; letter-spacing: 0.5px; }

.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

.sidebar-toggle {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.1); color: #fff; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section {
  padding: 6px 16px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.18s;
}
.sidebar.collapsed .nav-section { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  border-radius: 0;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  font-size: 13.5px;
  font-weight: 400;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active {
  background: rgba(93,173,226,0.18);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-label { opacity: 1; transition: opacity 0.18s; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; }

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-icon { margin: 0; }

.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── MAIN LAYOUT ── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  transition: margin-left 0.22s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.main-wrapper.collapsed { margin-left: var(--sidebar-collapsed); }

.topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border-radius: 30px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, #001b60 0%, #1380b4 60%, #95c300 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.main-content { padding: 28px; flex: 1; }

/* ── CARDS ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue { background: rgba(93,173,226,0.12); color: var(--accent); }
.stat-icon.green { background: rgba(39,174,96,0.12); color: var(--success); }
.stat-icon.orange { background: rgba(243,156,18,0.12); color: var(--warning); }

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }

/* ── TABLES ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-header h2 { font-size: 15px; font-weight: 600; color: var(--text-main); }
.card-header .ml-auto { margin-left: auto; }

.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  padding: 11px 20px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: #f8fafc; }
tbody td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  font-size: 13.5px;
}
tbody tr:last-child td { border-bottom: none; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-green { background: rgba(39,174,96,0.12); color: #1a9e52; }
.badge-red { background: rgba(231,76,60,0.12); color: #c0392b; }
.badge-blue { background: rgba(93,173,226,0.12); color: #2980b9; }
.badge-gray { background: rgba(113,128,150,0.12); color: #4a5568; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: 'Open Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text-main); }
.btn-icon { padding: 7px; border-radius: 6px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── FORMS ── */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 28px;
  max-width: 600px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 18px; }
.form-group.full { grid-column: 1 / -1; }

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Open Sans', sans-serif;
  font-size: 13.5px;
  color: var(--text-main);
  background: #fff;
  transition: var(--transition);
  outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(93,173,226,0.15); }

.checkbox-group { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.checkbox-group label { margin: 0; text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--text-main); font-weight: 400; }

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

/* ── SEARCH BAR ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.search-input-wrap { position: relative; flex: 1; max-width: 360px; }
.search-input-wrap input {
  padding-left: 36px;
  background: var(--bg);
  border-color: transparent;
}
.search-input-wrap input:focus { background: #fff; border-color: var(--accent); }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }

/* ── ALERTS ── */
.messages-wrap { margin-bottom: 20px; }
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: rgba(39,174,96,0.1); color: #1a7a41; border: 1px solid rgba(39,174,96,0.2); }
.alert-error { background: rgba(231,76,60,0.1); color: #a93226; border: 1px solid rgba(231,76,60,0.2); }

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #001b60 0%, #1380b4 100%);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(180deg, #001b60 0%, #1380b4 60%, #95c300 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
}
.login-logo-text { font-size: 18px; font-weight: 700; color: var(--text-main); }
.login-logo-text span { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); letter-spacing: 0.3px; }

.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-card p { color: var(--text-muted); font-size: 13.5px; margin-bottom: 28px; }

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

.btn-login {
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 14px;
  margin-top: 8px;
}

/* ── PAGE HEADER ── */
.page-header {
  margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.page-header p { color: var(--text-muted); font-size: 13.5px; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text-main); font-weight: 500; }

/* ── DELETE CONFIRM ── */
.confirm-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 36px;
  max-width: 480px;
  text-align: center;
}
.confirm-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(231,76,60,0.12);
  color: var(--danger);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.confirm-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.confirm-card p { color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }

/* ── RECENT USERS TABLE (dashboard) ── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .main-wrapper.collapsed { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
