/* ============================================================
   St. Peter Specialized Hospital — Academic Follow-Up System
   Theme: PeterDuty Brand (#00A89D Teal & #F26524 Coral) +
          Project Management Sleek Dark Sidebar & Modern Card Layout
   ============================================================ */

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

:root {
  --primary:        #00A89D;
  --primary-dark:   #008C82;
  --primary-light:  #E0F7F5;
  --accent:         #F26524;
  --accent-dark:    #D9531E;
  --accent-light:   #FFF0E8;

  --sidebar-bg:     #0f172a;
  --sidebar-border: #1e293b;
  --sidebar-hover:  #1e293b;
  --sidebar-text:   #94a3b8;
  --sidebar-active: #00A89D;

  --body-bg:        #F5F7FA;
  --card-bg:        #FFFFFF;
  --border:         #E2E8F0;
  --border-subtle:  #F1F5F9;

  --text-main:      #1E293B;
  --text-muted:     #64748B;
  --text-light:     #94A3B8;

  --success:        #10B981;
  --success-light:  #ECFDF5;
  --warning:        #F59E0B;
  --warning-light:  #FFFBEB;
  --danger:         #EF4444;
  --danger-light:   #FEF2F2;
  --info:           #0284C7;
  --info-light:     #E0F2FE;

  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --radius-full:    9999px;

  --shadow-card:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover:   0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);

  --header-h:       64px;
  --sidebar-w:      260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--body-bg);
  color: var(--text-main);
  min-height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--primary-dark); }

.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.25rem 1.25rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-header .logo-container {
  width: 44px; height: 44px;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 3px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.sidebar-header .logo-container img { width: 100%; height: 100%; object-fit: contain; }

.sidebar-header .brand-info h2 { font-size: 1.05rem; font-weight: 700; color: #FFFFFF; line-height: 1.25; }
.sidebar-header .brand-info small { display: block; font-size: 0.72rem; color: var(--accent); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 1.25rem 0.85rem; }

.nav-section-title {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: #475569; padding: 0 0.85rem; margin: 1rem 0 0.4rem;
}
.nav-section-title:first-child { margin-top: 0; }

.nav-link {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.65rem 0.9rem; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: 0.88rem; font-weight: 500;
  margin-bottom: 3px; transition: all 0.2s ease;
}
.nav-link i.nav-icon { width: 20px; text-align: center; font-size: 1rem; color: #64748b; }
.nav-link:hover { background: var(--sidebar-hover); color: #FFFFFF; }
.nav-link:hover i.nav-icon { color: var(--accent); }

.nav-link.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #FFFFFF; font-weight: 600;
  box-shadow: 0 4px 12px rgba(242, 101, 36, 0.35);
}
.nav-link.active i.nav-icon { color: #FFFFFF; }

.nav-link .nav-badge {
  margin-left: auto; font-size: 0.7rem; font-weight: 700;
  padding: 2px 7px; border-radius: var(--radius-full);
  background: var(--danger); color: #FFFFFF;
}

.sidebar-footer {
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--sidebar-border);
  background: rgba(15, 23, 42, 0.7);
}

.sidebar-user { display: flex; align-items: center; gap: 0.75rem; }
.user-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #ffffff; font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
.user-details .user-name { font-size: 0.84rem; font-weight: 600; color: #FFFFFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-details .user-role { font-size: 0.72rem; color: #94A3B8; margin-top: 2px; }

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

.topbar {
  height: var(--header-h); background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  padding: 0 1.75rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 40; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-left .page-title { font-size: 1.15rem; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 0.65rem; }
.topbar-left .page-title i { color: var(--accent); font-size: 1.1rem; }
.topbar-right { display: flex; align-items: center; gap: 1.15rem; }
.topbar-date { font-size: 0.82rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.45rem; }
.topbar-date i { color: var(--primary); }

.topbar-action-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--body-bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); cursor: pointer; position: relative; transition: all 0.2s;
}
.topbar-action-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.topbar-action-btn .badge-dot {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px;
  background: var(--danger); border-radius: var(--radius-full); border: 1.5px solid #FFFFFF;
}

.page-body { padding: 1.75rem; flex: 1; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.section-title { font-size: 1.25rem; font-weight: 700; color: var(--text-main); }
.section-subtitle { font-size: 0.84rem; color: var(--text-muted); margin-top: 2px; }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.stat-card {
  background: #FFFFFF; border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem; box-shadow: var(--shadow-card); position: relative; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--primary); }
.stat-card.stat-accent::before  { background: var(--accent); }
.stat-card.stat-success::before { background: var(--success); }
.stat-card.stat-warning::before { background: var(--warning); }
.stat-card.stat-danger::before  { background: var(--danger); }

.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.stat-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.stat-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.stat-card.stat-accent .stat-icon  { background: var(--accent-light);  color: var(--accent); }
.stat-card.stat-success .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.stat-warning .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.stat-danger .stat-icon  { background: var(--danger-light);  color: var(--danger); }
.stat-value { font-size: 1.85rem; font-weight: 800; color: var(--text-main); line-height: 1.2; }
.stat-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.35rem; }

/* ── Cards & Tables ── */
.card { background: #FFFFFF; border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); overflow: hidden; margin-bottom: 1.5rem; }
.card-header { padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 0.5rem; }
.card-title i { color: var(--accent); }
.card-body { padding: 1.4rem; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { background: #F8FAFC; padding: 0.8rem 1.15rem; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
td { padding: 0.95rem 1.15rem; border-bottom: 1px solid var(--border-subtle); font-size: 0.88rem; color: var(--text-main); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #F8FAFC; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.55rem 1.15rem; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease;
  line-height: 1.4; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 168, 157, 0.2); }
.btn-primary:hover { background: var(--primary-dark); color: #FFFFFF; box-shadow: 0 4px 12px rgba(0, 168, 157, 0.35); }
.btn-accent, .btn-orange { background: var(--accent); color: #FFFFFF; }
.btn-accent:hover, .btn-orange:hover { background: var(--accent-dark); color: #FFFFFF; box-shadow: 0 4px 12px rgba(242, 101, 36, 0.35); }
.btn-outline { background: #FFFFFF; color: var(--text-main); border-color: var(--border); }
.btn-outline:hover { background: var(--body-bg); border-color: var(--text-muted); color: var(--text-main); }
.btn-success { background: var(--success); color: #FFFFFF; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #FFFFFF; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.78rem; gap: 0.35rem; }
.btn-block { width: 100%; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.22rem 0.65rem; border-radius: var(--radius-full); font-size: 0.74rem; font-weight: 600; line-height: 1.3; }
.badge-teal { background: var(--primary-light); color: var(--primary-dark); }
.badge-orange { background: var(--accent-light); color: var(--accent-dark); }
.badge-green { background: var(--success-light); color: #065F46; }
.badge-yellow { background: var(--warning-light); color: #92400E; }
.badge-red { background: var(--danger-light); color: #991B1B; }
.badge-gray { background: #F1F5F9; color: #475569; }

/* ── Forms ── */
.form-group { margin-bottom: 1.15rem; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-main); margin-bottom: 0.4rem; }
.form-control {
  width: 100%; padding: 0.6rem 0.9rem; font-family: inherit; font-size: 0.88rem;
  color: var(--text-main); background: #FFFFFF; border: 1px solid var(--border);
  border-radius: var(--radius-sm); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242, 101, 36, 0.15); }

/* ── Modals & Alerts ── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 200; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop.open { display: flex; animation: modalFadeIn 0.2s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #FFFFFF; border-radius: var(--radius-lg); width: min(100%, 580px); max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 40px rgba(0,0,0,0.25); }
.modal-header { padding: 1.15rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--text-main); }
.modal-close { background: none; border: none; font-size: 1.4rem; color: var(--text-muted); cursor: pointer; line-height: 1; }
.modal form, .modal-body { padding: 1.4rem; }

.alert { padding: 0.85rem 1.15rem; border-radius: var(--radius-sm); font-size: 0.86rem; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.65rem; }
.alert-success { background: var(--success-light); border: 1px solid rgba(16, 185, 129, 0.3); color: #065F46; }
.alert-warning { background: var(--warning-light); border: 1px solid rgba(245, 158, 11, 0.3); color: #92400E; }
.alert-danger { background: var(--danger-light); border: 1px solid rgba(239, 68, 68, 0.3); color: #991B1B; }

/* ── Academic Specific Elements ── */
.cal-pill { padding: 0.22rem 0.65rem; border-radius: var(--radius-full); font-size: 0.74rem; font-weight: 700; display: inline-flex; align-items: center; gap: 0.35rem; }
.cal-pill.intake   { background: #DEF7EC; color: #03543F; }
.cal-pill.exam     { background: #FDE8E8; color: #9B1C1C; }
.cal-pill.rotation { background: #E0F7F5; color: #008C82; }
.cal-pill.holiday  { background: #FEF08A; color: #854D0E; }
.cal-pill.other    { background: #F1F5F9; color: #475569; }

.grade-score { font-weight: 800; font-size: 0.95rem; }
.grade-a { color: #10B981; }
.grade-b { color: #00A89D; }
.grade-c { color: #F59E0B; }
.grade-f { color: #EF4444; }

/* Rotations Grid */
.rotations-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.rotation-card {
  background: #FFFFFF; border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1.25rem; box-shadow: var(--shadow-card); transition: all 0.2s; position: relative;
}
.rotation-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--accent); }

/* Utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.fw-bold { font-weight: 700; }
.text-sm { font-size: 0.82rem; }
.text-muted { color: var(--text-muted); }

/* Tabs Navigation */
.tab-nav { display: flex; gap: 0.5rem; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab-btn { padding: 0.65rem 1.25rem; font-weight: 600; font-size: 0.88rem; color: var(--text-muted); border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; transition: all 0.15s ease; }
.tab-btn:hover { color: var(--primary); text-decoration: none; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.tab-badge { background: var(--border-subtle); color: var(--text-muted); padding: 2px 7px; border-radius: var(--radius-full); font-size: 0.72rem; }
.tab-btn.active .tab-badge { background: var(--primary-light); color: var(--primary-dark); }

/* ── Mobile & Ward Tablet Responsive Navigation ── */
.sidebar-toggle-btn {
  display: none;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 1.05rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-right: 0.75rem;
  transition: all 0.15s ease;
}
.sidebar-toggle-btn:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  z-index: 99;
}
.sidebar-backdrop.open {
  display: block;
}

@media (max-width: 1024px) {
  .sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .topbar-date {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: 1fr !important;
  }
  .topbar {
    padding: 0 1rem;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .section-header .flex {
    width: 100%;
    flex-wrap: wrap;
  }
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}


