/* ============================================================
   PHC Doctor Attendance System - Global Stylesheet
   Premium Design with Modern UI/UX
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  #eff6ff;
  --success:        #059669;
  --success-light:  #ecfdf5;
  --danger:         #dc2626;
  --danger-light:   #fef2f2;
  --warning:        #d97706;
  --warning-light:  #fffbeb;
  --purple:         #7c3aed;
  --purple-light:   #f5f3ff;

  --bg:             #f0f4ff;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --text-primary:   #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg:  0 10px 32px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-xl:  0 20px 48px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.06);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================================
   BACKGROUND GRADIENT WRAPPER
   ============================================================ */
.page-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #e0e7ff 0%, #f0f4ff 40%, #e8f5e9 100%);
  padding: 20px 16px 40px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 40%, #0891b2 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-wrapper::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  top: -150px; left: -150px;
  animation: float 8s ease-in-out infinite;
}

.login-wrapper::after {
  content: '';
  position: absolute;
  width: 350px; height: 350px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  bottom: -100px; right: -100px;
  animation: float 6s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%       { transform: translateY(-30px) rotate(5deg); }
}

.login-card {
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(37,99,235,0.35);
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-2);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37,99,235,0.45);
}

.btn-primary:active { transform: translateY(0); }

.btn-success {
  background: linear-gradient(135deg, #10b981, var(--success));
  color: white;
  box-shadow: 0 4px 14px rgba(5,150,105,0.30);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(5,150,105,0.40);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, var(--danger));
  color: white;
  box-shadow: 0 4px 14px rgba(220,38,38,0.30);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220,38,38,0.40);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-full { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 15px; border-radius: var(--radius-md); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  border: 1px solid rgba(226,232,240,0.6);
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-body { padding: 24px; }
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dashboard-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 8px;
}

/* Top Navigation Bar */
.topbar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
  border-bottom: 3px solid var(--primary);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), #0891b2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

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

.stat-card {
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  color: white;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.stat-card:hover::before { transform: scale(1.3); }

.stat-card-phc    { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.stat-card-total  { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.stat-card-present{ background: linear-gradient(135deg, #059669, #047857); }
.stat-card-absent { background: linear-gradient(135deg, #dc2626, #b91c1c); }

.stat-label {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}

.stat-icon {
  position: absolute;
  bottom: 14px; right: 18px;
  font-size: 36px;
  opacity: 0.25;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid rgba(226,232,240,0.5);
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  background: #f1f5f9;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 14px 20px;
  border-bottom: 2px solid var(--border);
  text-align: center;
}

.data-table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.15s;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: #f8faff; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-warning { background: var(--warning-light); color: var(--warning); }

/* ============================================================
   DOCTOR DASHBOARD SPECIFICS
   ============================================================ */
.status-banner {
  background: linear-gradient(135deg, #f8fafc, #eff6ff);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.status-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.status-value {
  font-size: 28px;
  font-weight: 800;
}

.status-value.present { color: var(--success); }
.status-value.absent  { color: var(--danger);  }

.map-wrapper {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  border: 1px solid rgba(226,232,240,0.5);
}

.map-header {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#map {
  width: 100%;
  height: 300px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* ============================================================
   HISTORY PAGE
   ============================================================ */
.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 24px;
  background: var(--surface-2);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.filter-row .form-label {
  margin-bottom: 6px;
}

/* ============================================================
   ALERT / MESSAGE
   ============================================================ */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-top: 16px;
  text-align: center;
  display: none;
}

.alert.show { display: block; animation: fadeIn 0.3s ease; }

.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #a7f3d0; }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #fecaca; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-primary { color: var(--primary) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-center  { text-align: center; }
.fw-bold      { font-weight: 700; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 16px; }
.mb-1  { margin-bottom: 4px; }
.mb-2  { margin-bottom: 8px; }
.mb-3  { margin-bottom: 16px; }
.w-100 { width: 100%; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .topbar { flex-direction: column; gap: 14px; text-align: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .action-grid { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 28px; }
}
