/* ============================================================
   IQBrain College — Admin Dashboard Stylesheet
   ============================================================ */

:root {
  --primary:      #0072BC;
  --primary-dark: #005a96;
  --secondary:    #F7941D;
  --dark:         #1a2236;
  --sidebar-w:    260px;
  --topbar-h:     64px;
  --text:         #2d3748;
  --text-muted:   #718096;
  --border:       #e2e8f0;
  --bg:           #f0f4f8;
  --white:        #ffffff;
  --success:      #38a169;
  --danger:       #e53e3e;
  --warning:      #d69e2e;
  --info:         #3182ce;
  --shadow:       0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 30px rgba(0,0,0,0.12);
  --radius:       10px;
  --font:         'Poppins', -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: var(--font); }

/* -------------------------------------------------------
   Layout
   ------------------------------------------------------- */
.admin-wrapper { display: flex; min-height: 100vh; }

/* -------------------------------------------------------
   Sidebar
   ------------------------------------------------------- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo img { height: 36px; }
.sidebar-logo-text { font-size: 0.9rem; font-weight: 700; color: var(--white); line-height: 1.2; }
.sidebar-logo-text span { display: block; font-size: 0.65rem; font-weight: 400; color: rgba(255,255,255,0.45); letter-spacing: 0.1em; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 0; }

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 14px 20px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.65);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.sidebar-link.active { background: rgba(0,114,188,0.25); color: var(--white); border-left-color: var(--secondary); }
.sidebar-link i { width: 18px; text-align: center; font-size: 0.9em; }
.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--secondary);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
}
.sidebar-footer a { color: rgba(255,255,255,0.55); display: flex; align-items: center; gap: 7px; }
.sidebar-footer a:hover { color: var(--white); }

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

/* Topbar */
.admin-topbar {
  height: var(--topbar-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: 99;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-page-title { font-size: 1.05rem; font-weight: 700; color: var(--dark); }
.topbar-breadcrumb { font-size: 0.78rem; color: var(--text-muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.admin-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--dark);
  transition: all 0.2s;
}
.admin-user-btn:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }
.admin-user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Page Content */
.admin-content { padding: 28px; flex: 1; }

/* -------------------------------------------------------
   Stats Cards
   ------------------------------------------------------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 4px solid;
  transition: all 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.stat-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-card-info { flex: 1; }
.stat-card-value { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.stat-card-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }

.stat-card.blue   { border-color: var(--primary); }
.stat-card.blue .stat-card-icon { background: #e8f4fc; color: var(--primary); }
.stat-card.blue .stat-card-value { color: var(--primary); }
.stat-card.orange { border-color: var(--secondary); }
.stat-card.orange .stat-card-icon { background: #fff5e8; color: var(--secondary); }
.stat-card.orange .stat-card-value { color: var(--secondary); }
.stat-card.green  { border-color: var(--success); }
.stat-card.green .stat-card-icon { background: #ebf8f0; color: var(--success); }
.stat-card.green .stat-card-value { color: var(--success); }
.stat-card.red    { border-color: var(--danger); }
.stat-card.red .stat-card-icon { background: #fff5f5; color: var(--danger); }
.stat-card.red .stat-card-value { color: var(--danger); }

/* -------------------------------------------------------
   Tables
   ------------------------------------------------------- */
.admin-table-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.admin-table-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.admin-table-title { font-weight: 700; font-size: 0.95rem; color: var(--dark); }

.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table thead th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.875rem;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafbfc; }

.actions-group { display: flex; align-items: center; gap: 6px; }

/* -------------------------------------------------------
   Buttons
   ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.3;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }
.btn i { font-size: 0.9em; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-secondary:hover { filter: brightness(0.9); color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { filter: brightness(0.9); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(0.9); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { filter: brightness(0.9); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-outline-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-light { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--border); }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 6px; }

/* -------------------------------------------------------
   Forms
   ------------------------------------------------------- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.83rem; font-weight: 600; margin-bottom: 5px; color: var(--dark); }
.form-label span { color: var(--danger); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--white);
  transition: all 0.2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,114,188,0.1); }
.form-control::placeholder { color: #b0bec5; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* Card */
.admin-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.admin-card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
}
.admin-card-header h5 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 7px;
}
.admin-card-header h5 i { color: var(--primary); }
.admin-card-body { padding: 22px; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border-left: 4px solid;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: #ebf8f0; border-color: var(--success); color: #276749; }
.alert-danger  { background: #fff5f5; border-color: var(--danger);  color: #c53030; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #975a16; }
.alert-info    { background: #ebf4ff; border-color: var(--info);    color: #2b6cb0; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-primary  { background: #e8f4fc; color: var(--primary); }
.badge-success  { background: #ebf8f0; color: var(--success); }
.badge-danger   { background: #fff5f5; color: var(--danger); }
.badge-warning  { background: #fffbeb; color: var(--warning); }
.badge-secondary { background: #fff5e8; color: var(--secondary); }
.badge-dark     { background: var(--dark); color: #fff; }

/* -------------------------------------------------------
   Pagination
   ------------------------------------------------------- */
.admin-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 14px 16px; border-top: 1px solid var(--border); }
.admin-pagination a, .admin-pagination span {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 0.83rem; font-weight: 600; border: 1px solid var(--border);
  color: var(--text); cursor: pointer; transition: all 0.2s;
}
.admin-pagination a:hover { border-color: var(--primary); color: var(--primary); }
.admin-pagination .active { background: var(--primary); border-color: var(--primary); color: #fff; }
.admin-pagination .disabled { opacity: 0.4; pointer-events: none; }

/* -------------------------------------------------------
   Misc
   ------------------------------------------------------- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-sm { font-size: 0.78rem; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-10 { gap: 10px; }

.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* Thumbnail in table */
.table-thumb {
  width: 50px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--border);
}
.table-thumb-placeholder {
  width: 50px;
  height: 38px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 1rem;
}

/* File upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}
.upload-area:hover { border-color: var(--primary); background: #e8f4fc; }
.upload-area i { font-size: 2rem; color: #aaa; margin-bottom: 10px; display: block; }
.upload-area p { font-size: 0.83rem; color: var(--text-muted); margin: 0; }

/* Checkbox toggle */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider::before {
  position: absolute;
  content: '';
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* -------------------------------------------------------
   Toggle Label (new style used in clients/testimonials)
   ------------------------------------------------------- */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  user-select: none;
}
.toggle-input { display: none; }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background: #ccc;
  border-radius: 50px;
  flex-shrink: 0;
  transition: background 0.3s;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.3s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-input:checked + .toggle-switch { background: var(--primary); }
.toggle-input:checked + .toggle-switch::after { transform: translateX(20px); }

/* -------------------------------------------------------
   Form helpers
   ------------------------------------------------------- */
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.req { color: var(--danger); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* -------------------------------------------------------
   Empty state
   ------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 80px 40px;
  color: var(--text-muted);
  background: var(--white);
  border-radius: var(--radius);
  border: 1.5px dashed var(--border);
}
.empty-state i { font-size: 3.5rem; margin-bottom: 18px; opacity: 0.25; display: block; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--dark); }
.empty-state p { font-size: 0.88rem; margin-bottom: 20px; }

/* -------------------------------------------------------
   Invoice admin styles
   ------------------------------------------------------- */
.invoice-status-paid      { color: var(--success); font-weight: 700; }
.invoice-status-sent      { color: var(--info); }
.invoice-status-draft     { color: var(--text-muted); }
.invoice-status-cancelled { color: var(--danger); }

/* -------------------------------------------------------
   Responsive
   ------------------------------------------------------- */
/* Responsive */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
