/* ================================================================
   CampusTrack UI Design System v2.0
   ================================================================
   Rules: Do NOT change colors, branding, fonts, or theme.
   Only: spacing, cards, tables, forms, hierarchy, consistency.
   ================================================================ */

/* ── 1. SPACING SYSTEM ── */
:root {
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;
  --space-page: 24px;
  --space-card: 20px;
  --space-section: 24px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-elevated: 0 8px 24px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.06);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
}

/* ── 2. CARD DESIGN STANDARD ── */
.ct-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-card);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
  border: 1px solid #f1f5f9;
}
.ct-card:hover {
  box-shadow: var(--shadow-card-hover);
}
.ct-card-header {
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ct-card-header h3, .ct-card-header h4 {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}
.ct-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
}

/* ── 3. STAT CARDS ── */
.ct-stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-xl) var(--space-card);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  transition: all var(--transition-normal);
  border: 1px solid #f1f5f9;
  min-height: 100px;
  cursor: default;
}
.ct-stat-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}
.ct-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ct-stat-icon svg { width: 24px; height: 24px; }
.ct-stat-content {
  flex: 1;
  min-width: 0;
}
.ct-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}
.ct-stat-label {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  margin-top: 2px;
}
.ct-stat-indicator {
  height: 3px;
  border-radius: 2px;
  margin-top: var(--space-sm);
}

/* ── 4. TABLE DESIGN STANDARD ── */
.ct-table-container {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid #f1f5f9;
  overflow: hidden;
}
.ct-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-card);
  gap: var(--space-md);
  flex-wrap: wrap;
}
.ct-table-toolbar .ct-filters {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.ct-table-toolbar .ct-search {
  position: relative;
}
.ct-table-toolbar .ct-search input {
  padding: 8px 12px 8px 36px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: border-color var(--transition-fast);
}
.ct-table-toolbar .ct-search input:focus {
  border-color: #274186;
  box-shadow: 0 0 0 2px rgba(39,65,134,0.1);
}
.ct-table-toolbar .ct-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #94a3b8;
}

.ct-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.ct-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.ct-table thead th {
  background: #f8fafc;
  padding: 12px var(--space-lg);
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.ct-table tbody td {
  padding: 12px var(--space-lg);
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.ct-table tbody tr { transition: background var(--transition-fast); }
.ct-table tbody tr:nth-child(even) { background: #fafbfc; }
.ct-table tbody tr:hover { background: #f0f4ff; }
.ct-table .ct-row-height { height: 44px; }

/* Table action buttons */
.ct-table .ct-action-btn {
  padding: 5px 8px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.ct-table .ct-action-btn:hover { transform: scale(1.05); }

/* Table pagination */
.ct-table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-card);
  border-top: 1px solid #f1f5f9;
  font-size: 13px;
  color: #64748b;
}
.ct-table-pagination .ct-page-btns {
  display: flex;
  gap: 4px;
}
.ct-table-pagination button {
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition-fast);
}
.ct-table-pagination button:hover { background: #f1f5f9; border-color: #cbd5e1; }
.ct-table-pagination button.active { background: #274186; color: #fff; border-color: #274186; }
.ct-table-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── 5. STATUS BADGES ── */
.ct-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.ct-badge-success { background: #dcfce7; color: #166534; }
.ct-badge-danger { background: #fee2e2; color: #991b1b; }
.ct-badge-warning { background: #fef3c7; color: #92400e; }
.ct-badge-info { background: #dbeafe; color: #1e40af; }
.ct-badge-neutral { background: #f1f5f9; color: #475569; }
.ct-badge-purple { background: #f3e8ff; color: #6b21a8; }

/* ── 6. FORM DESIGN STANDARD ── */
.ct-form-section {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-card);
  margin-bottom: var(--space-section);
  border: 1px solid #f1f5f9;
}
.ct-form-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid #f1f5f9;
}
.ct-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}
@media (min-width: 640px) {
  .ct-form-grid { grid-template-columns: 1fr 1fr; }
}
.ct-form-grid.one-col { grid-template-columns: 1fr; }
.ct-form-grid.three-col { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 639px) {
  .ct-form-grid.three-col { grid-template-columns: 1fr; }
}

.ct-form-group { display: flex; flex-direction: column; gap: 4px; }
.ct-form-label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}
.ct-form-label .ct-required { color: #ef4444; margin-left: 2px; }
.ct-form-input {
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: #1e293b;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  background: #fff;
}
.ct-form-input:focus {
  border-color: #274186;
  box-shadow: 0 0 0 2px rgba(39,65,134,0.1);
}
.ct-form-input::placeholder { color: #94a3b8; }
select.ct-form-input { appearance: auto; }

.ct-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding-top: var(--space-xl);
  margin-top: var(--space-lg);
  border-top: 1px solid #f1f5f9;
}

/* ── 7. BUTTONS ── */
.ct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}
.ct-btn svg { width: 16px; height: 16px; }
.ct-btn-primary { background: #274186; color: #fff; }
.ct-btn-primary:hover { background: #26357a; }
.ct-btn-secondary { background: #fff; color: #374151; border-color: #e2e8f0; }
.ct-btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.ct-btn-danger { background: #ef4444; color: #fff; }
.ct-btn-danger:hover { background: #dc2626; }
.ct-btn-success { background: #16a34a; color: #fff; }
.ct-btn-success:hover { background: #15803d; }
.ct-btn-sm { padding: 6px 12px; font-size: 12.5px; }
.ct-btn-lg { padding: 12px 24px; font-size: 15px; }
.ct-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 8. GREETING HEADER ── */
.ct-greeting {
  background: linear-gradient(135deg, #274186 0%, #26357a 50%, #00aeef 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-2xl);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-lg);
}
.ct-greeting-text h2 { font-size: 20px; font-weight: 700; margin: 0; }
.ct-greeting-text p { font-size: 13px; opacity: 0.8; margin-top: 4px; }
.ct-greeting-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.ct-greeting-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.ct-greeting-btn:hover { background: rgba(255,255,255,0.25); }
.ct-greeting-btn.primary { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.4); }

/* ── 9. LIVE FEED ── */
.ct-live-feed {
  max-height: 400px;
  overflow-y: auto;
}
.ct-feed-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid #f8fafc;
}
.ct-feed-item:last-child { border-bottom: none; }
.ct-feed-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.ct-feed-dot.checkin { background: #16a34a; }
.ct-feed-dot.checkout { background: #f59e0b; }
.ct-feed-time {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
  min-width: 55px;
}
.ct-feed-text {
  font-size: 13px;
  color: #334155;
}
.ct-feed-text strong { font-weight: 600; color: #1e293b; }

/* ── 10. PAGE LAYOUT ── */
.ct-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}
.ct-page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}
.ct-page-header p {
  font-size: 14px;
  color: #64748b;
  margin-top: 2px;
}

/* Section spacing */
.ct-section { margin-bottom: var(--space-section); }
.ct-section:last-child { margin-bottom: 0; }

/* ── 11. SIDEBAR IMPROVEMENTS ── */
.sidebar-item {
  margin: 3px 8px !important;
  padding: 10px 16px !important;
  gap: 12px !important;
  border-radius: var(--radius-md) !important;
}
.sidebar-group-label {
  padding: 20px 16px 6px !important;
  margin-top: 4px;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.1) !important;
}

/* ── 12. MOBILE RESPONSIVE ── */
@media (max-width: 639px) {
  :root {
    --space-page: 16px;
    --space-card: 16px;
  }

  .ct-greeting {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-lg);
  }
  .ct-greeting-actions {
    width: 100%;
  }
  .ct-greeting-btn {
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  /* Stats cards: 2 per row on mobile */
  .ct-stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: var(--space-sm) !important;
  }
  .ct-stat-card {
    padding: var(--space-md);
    flex-direction: column;
    text-align: center;
    gap: var(--space-sm);
    min-height: auto;
  }
  .ct-stat-value { font-size: 22px; }
  .ct-stat-label { font-size: 11px; }

  /* Tables: horizontal scroll */
  .ct-table-container { overflow-x: auto; }

  /* Forms: 1 column */
  .ct-form-grid { grid-template-columns: 1fr !important; }

  /* Page padding */
  #adminMainContent > div { padding: var(--space-page) !important; }
}

/* ── 13. SCROLLBAR STYLING ── */
.ct-live-feed::-webkit-scrollbar,
.ct-table-container::-webkit-scrollbar {
  width: 6px;
}
.ct-live-feed::-webkit-scrollbar-track,
.ct-table-container::-webkit-scrollbar-track {
  background: transparent;
}
.ct-live-feed::-webkit-scrollbar-thumb,
.ct-table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
.ct-live-feed::-webkit-scrollbar-thumb:hover,
.ct-table-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ── 14. EMPTY STATES ── */
.ct-empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: #94a3b8;
}
.ct-empty-state svg {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-lg);
  opacity: 0.5;
}
.ct-empty-state p {
  font-size: 14px;
  margin: 0;
}
