/* =====================================================
   ADMIN PANEL CSS — InfirmiersConnect
   ===================================================== */

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

:root {
  --navy:        #1a3a5c;
  --navy-dark:   #122843;
  --navy-light:  #2a5285;
  --teal:        #00a896;
  --teal-dark:   #007d70;
  --bg:          #f0f4f8;
  --white:       #ffffff;
  --text:        #1a1f2e;
  --text-muted:  #64748b;
  --border:      #e2e8f0;
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --info:        #3b82f6;
  --sidebar-w:   260px;
  --header-h:    64px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

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

/* ---- SIDEBAR ---- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: rgba(255,255,255,.85);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  text-decoration: none;
  color: white;
}
.sidebar-logo svg { flex-shrink: 0; }
.sidebar-logo-text { font-size: 15px; font-weight: 700; line-height: 1.2; }
.sidebar-logo-text small { display: block; font-size: 10px; font-weight: 400; opacity: .6; letter-spacing: 1px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-section { padding: 16px 16px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: rgba(255,255,255,.35); font-weight: 600; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  border-radius: 6px;
  margin: 1px 8px;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .15s;
}
.sidebar-link svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255,255,255,.1); color: white; }
.sidebar-link.active { background: var(--teal); color: white; }
.sidebar-link .badge-count { margin-left: auto; background: var(--teal); color: white; font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600; }
.sidebar-link.active .badge-count { background: rgba(255,255,255,.3); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.6); text-decoration: none; font-size: 13px;
  transition: color .15s;
}
.sidebar-footer a:hover { color: white; }
.sidebar-footer a svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

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

.admin-topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar h1 { font-size: 18px; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-badge { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); padding: 4px 10px; background: var(--bg); border-radius: 20px; border: 1px solid var(--border); }
.topbar-badge svg { width: 13px; height: 13px; stroke: var(--teal); fill: none; stroke-width: 2; }

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

/* ---- STATS CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; stroke: white; fill: none; stroke-width: 2; }
.stat-icon.blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.teal   { background: linear-gradient(135deg, #00a896, #007d70); }
.stat-icon.green  { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.red    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ---- CARDS ---- */
.admin-card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 24px;
}
.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.admin-card-header h2 { font-size: 15px; font-weight: 700; }
.admin-card-body { padding: 20px; }

/* ---- TABLE ---- */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13.5px;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8fafc; }
.admin-table .user-info { display: flex; align-items: center; gap: 10px; }
.admin-table .user-info img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.admin-table .user-name { font-weight: 600; font-size: 13px; }
.admin-table .user-email { font-size: 12px; color: var(--text-muted); }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-role-nurse    { background: #dbeafe; color: #1d4ed8; }
.badge-role-patient  { background: #d1fae5; color: #065f46; }
.badge-role-admin    { background: #ede9fe; color: #5b21b6; }
.badge-active        { background: #d1fae5; color: #065f46; }
.badge-inactive      { background: #fee2e2; color: #991b1b; }
.badge-verified      { background: #d1fae5; color: #065f46; }
.badge-unverified    { background: #fef3c7; color: #92400e; }
.badge-sub-active    { background: #d1fae5; color: #065f46; }
.badge-sub-trialing  { background: #dbeafe; color: #1d4ed8; }
.badge-sub-cancelled { background: #fee2e2; color: #991b1b; }
.badge-sub-none      { background: #f1f5f9; color: #64748b; }
.badge-visible   { background: #d1fae5; color: #065f46; }
.badge-hidden    { background: #fee2e2; color: #991b1b; }

/* ---- BUTTONS ---- */
.btn-admin {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: all .15s;
}
.btn-admin svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.btn-sm-primary   { background: var(--teal); color: white; }
.btn-sm-primary:hover { background: var(--teal-dark); }
.btn-sm-danger    { background: #fee2e2; color: var(--danger); }
.btn-sm-danger:hover { background: #fecaca; }
.btn-sm-warning   { background: #fef3c7; color: #92400e; }
.btn-sm-warning:hover { background: #fde68a; }
.btn-sm-secondary { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.btn-sm-secondary:hover { background: var(--border); color: var(--text); }
.btn-sm-info      { background: #dbeafe; color: #1d4ed8; }
.btn-sm-info:hover { background: #bfdbfe; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label span { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.form-control-admin {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
  background: white;
  transition: border-color .15s;
  font-family: inherit;
}
.form-control-admin:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,168,150,.1); }
textarea.form-control-admin { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--teal); cursor: pointer; }
.form-section-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  padding: 12px 0 8px; margin-bottom: 16px;
  border-bottom: 2px solid var(--teal);
  display: flex; align-items: center; gap: 8px;
}

.btn-save {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; background: var(--navy); color: white;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.btn-save:hover { background: var(--navy-dark); }
.btn-save svg { width: 15px; height: 15px; stroke: white; fill: none; stroke-width: 2; }

/* ---- SEARCH BAR ---- */
.admin-search {
  display: flex; gap: 10px; margin-bottom: 20px; align-items: center; flex-wrap: wrap;
}
.admin-search input, .admin-search select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: white;
  font-family: inherit;
}
.admin-search input { min-width: 220px; }
.admin-search input:focus, .admin-search select:focus { outline: none; border-color: var(--teal); }

/* ---- ALERTS ---- */
.admin-alert {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 20px;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.admin-alert svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.admin-alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.admin-alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.admin-alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---- TABS ---- */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--border); }
.admin-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  text-decoration: none; transition: all .15s;
}
.admin-tab.active, .admin-tab:hover { color: var(--teal); border-bottom-color: var(--teal); }

/* ---- PAGINATION ---- */
.admin-pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; }
.admin-pagination a, .admin-pagination span {
  padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500;
  text-decoration: none; border: 1px solid var(--border); color: var(--text-muted);
  transition: all .15s;
}
.admin-pagination a:hover { background: var(--bg); color: var(--text); }
.admin-pagination .current { background: var(--navy); color: white; border-color: var(--navy); }

/* ---- CHARTS (mini) ---- */
.mini-chart { display: flex; align-items: flex-end; gap: 3px; height: 48px; }
.mini-bar {
  flex: 1; background: var(--teal); border-radius: 3px 3px 0 0; opacity: .7;
  min-height: 4px; transition: opacity .2s;
}
.mini-bar:hover { opacity: 1; }

/* ---- MISC ---- */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; stroke: #cbd5e1; fill: none; stroke-width: 1.5; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---- RATING ---- */
.stars-display { display: flex; gap: 2px; }
.stars-display svg { width: 13px; height: 13px; fill: #f59e0b; stroke: none; }
.stars-display svg.empty { fill: #e2e8f0; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .admin-sidebar { width: 60px; }
  .sidebar-logo-text, .sidebar-link span, .sidebar-section { display: none; }
  .admin-main { margin-left: 60px; }
  .admin-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- LOGIN PAGE ---- */
.admin-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}
.login-box {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 48px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo svg { display: block; margin: 0 auto 10px; }
.login-logo h1 { font-size: 20px; font-weight: 800; color: var(--navy); }
.login-logo p { font-size: 12px; color: var(--text-muted); }
.login-form-group { margin-bottom: 16px; }
.login-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.login-input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--text);
  transition: border-color .15s;
}
.login-input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,58,92,.1); }
.login-btn {
  width: 100%; padding: 11px;
  background: var(--navy); color: white;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s; margin-top: 4px;
}
.login-btn:hover { background: var(--navy-dark); }
.login-error { background: #fee2e2; color: #991b1b; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.login-back { text-align: center; margin-top: 16px; font-size: 12px; color: var(--text-muted); }
.login-back a { color: var(--navy); text-decoration: none; font-weight: 600; }
