:root{
  --fp-primary:#1e3a8a;
  --fp-primary-dark:#172554;
  --fp-bg:#f5f7ff;
  --fp-card:#ffffff;
  --fp-text:#0f172a;
  --fp-muted:#64748b;
  --fp-border:#e2e8f0;
  --fp-radius:18px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  background:linear-gradient(180deg,#f7f9ff 0%, #f3f6ff 60%, #f7f9ff 100%);
  color:var(--fp-text);
  overflow-x:hidden; /* vertical-only scrolling */
}

.fp-shell{
  min-height:100svh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:
    calc(18px + env(safe-area-inset-top))
    calc(14px + env(safe-area-inset-right))
    calc(22px + env(safe-area-inset-bottom))
    calc(14px + env(safe-area-inset-left));
}

.fp-login{
  width:min(520px,100%);
  margin:0 auto;
  text-align:center;
}

.fp-title{
  font-weight:900;
  font-size:32px;
  color:var(--fp-primary);
  letter-spacing:-0.02em;
  margin-top:10px;
}
.fp-subtitle{
  margin-top:10px;
  font-weight:800;
  font-size:22px;
  color:#1f2937;
}

.fp-card{
  margin-top:22px;
  background:var(--fp-card);
  border:1px solid var(--fp-border);
  border-radius:var(--fp-radius);
  padding:26px 22px;
  box-shadow:0 18px 50px rgba(15,23,42,.08);
  width:100%;
  max-width:100%;
}
.fp-card-title{font-weight:900;font-size:18px}
.fp-card-sub{margin-top:8px;color:var(--fp-muted);font-size:14px;line-height:1.5}
.fp-hint{margin-top:12px;color:var(--fp-muted);font-size:13px}

.fp-btn{
  width:100%;
  padding:16px 16px;
  border-radius:14px;
  border:1px solid var(--fp-border);
  font-weight:900;
  font-size:18px;
  cursor:pointer;
}
.fp-btn-primary{
  border:none;
  color:#fff;
  background:linear-gradient(135deg,var(--fp-primary) 0%, #2563eb 100%);
  box-shadow:0 10px 28px rgba(30,58,138,.25);
}
.fp-btn-secondary{
  background:#fff;
  color:var(--fp-primary);
  border:3px solid var(--fp-primary);
}
.fp-btn-outline{
  border-style:dashed;
}
.fp-btn + .fp-btn{margin-top:12px}

.fp-page{
  width:min(560px,100%);
  margin:0 auto;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  max-width:100%;
}

.fp-header{
  text-align:center;
  padding:6px 6px 12px;
  margin-bottom: 14px; /* keep headings clearly above the form */
  width:100%;
}

.fp-app-title{
  font-size:12px;
  font-weight:900;
  letter-spacing:0.06em;
  text-transform:uppercase;
  color:#334155;
  margin-bottom:10px;
}
.fp-h1{
  margin:0;
  color:var(--fp-primary);
  font-size:34px;
  font-weight:900;
  letter-spacing:-0.02em;
}
.fp-h2{
  margin-top:10px;
  font-size:22px;
  font-weight:900;
  color:#1f2937;
}

#fpDepartmentTitle{
  /* If department is empty, JS hides it. */
}
.fp-h3{
  margin-top:12px;
  font-size:16px;
  color:var(--fp-muted);
}

.fp-app-title{
  font-size:12px;
  font-weight:950;
  letter-spacing:0.08em;
  text-transform:uppercase;
  color:#334155;
  margin-bottom:10px;
}
.fp-user{
  margin-top:14px;
  display:flex;
  justify-content:center;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  color:var(--fp-muted);
  font-size:13px;
}
.fp-link{
  background:transparent;
  border:none;
  color:var(--fp-primary);
  font-weight:900;
  cursor:pointer;
  padding:6px 10px;
  border-radius:12px;
}
.fp-link:hover{background:rgba(30,58,138,.08)}

.fp-form .fp-label{
  display:block;
  text-align:left;
  font-weight:900;
  margin:14px 2px 10px;
  font-size:16px;
}

.fp-label-muted{
  color:#1f2937;
}

/* Make the form feel "native" on phones */
.fp-form{
  padding:18px 16px;
}

.fp-form--mobile{
  border-radius:22px;
}

.fp-form-section-title{
  font-size:12px;
  font-weight:900;
  letter-spacing:0.08em;
  text-transform:uppercase;
  color:#334155;
}

.fp-form-section-title--muted{
  color:#64748b;
}

.fp-action-stack{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:16px;
}

.fp-hidden{
  display:none !important;
}

.fp-form-divider{
  height: 1px;
  background: #e6eaf5;
  margin: 14px 0 6px;
  border-radius: 999px;
}
.fp-select{
  width:100%;
  padding:16px 16px;
  border-radius:14px;
  border:1.5px solid #cbd5e1;
  background:#fff;
  font-size:18px;
}
.fp-search-input{
  margin-bottom:10px;
}
.fp-search-input::placeholder{
  color:#94a3b8;
}
.fp-inline-actions{
  display:flex;
  gap:8px;
  margin-top:2px;
  margin-bottom:8px;
  flex-wrap:wrap;
}
.fp-mini-btn{
  flex:1 1 140px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #cbd5e1;
  background:#eff6ff;
  color:#1e3a8a;
  font-size:13px;
  font-weight:900;
  cursor:pointer;
}
.fp-mini-btn-muted{
  background:#fff;
  color:#475569;
}
.fp-inline-hint{
  font-size:12px;
  color:#64748b;
  margin-bottom:4px;
}
.fp-admin-panel{
  margin-top:12px;
  padding-top:4px;
}

.fp-results{
  margin-top:14px;
  width:100%;
  max-width:100%;
}

.fp-desktop-layout{
  display:block;
  width:100%;
}

.fp-desktop-sidebar,
.fp-desktop-content{
  min-width:0;
}

/* Timetable table grid (mobile-friendly; scroll inside only) */
.fp-tt-table-wrap{
  margin-top: 12px;
  border-radius: 16px;
  border: 1px solid var(--fp-border);
  background: #fff;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.fp-tt-table{
  border-collapse: collapse;
  width: 100%;
  min-width: 820px; /* allow horizontal scroll inside wrap */
}

.fp-tt-table th,
.fp-tt-table td{
  border: 1px solid #cbd5e1;
  padding: 10px 8px;
  vertical-align: middle;
  text-align: center;
}

.fp-tt-table thead th{
  background: #1e3a8a;
  color: #fff;
  font-weight: 950;
  font-size: 12px;
}

.fp-tt-sticky-col{
  position: sticky;
  left: 0;
  z-index: 2;
}

.fp-tt-table thead .fp-tt-sticky-col{
  z-index: 3;
}

.fp-tt-day{
  background: #f8fafc;
  font-weight: 950;
  color: #0f172a;
  font-size: 14px;
  width: 78px;
}

.fp-tt-cell{
  font-weight: 500;
  font-size: 12px;
  background: #ffffff;
  color: #0f172a;
}

.fp-tt-lab{
  /* A single merged lab block */
  background: #ffffff;
}

.fp-tt-group{
  display:inline-block;
  margin-left:6px;
  padding:2px 8px;
  border-radius:999px;
  background: rgba(30, 58, 138, 0.12);
  color: #1e3a8a;
  font-weight: 600;
  font-size: 11px;
  vertical-align: middle;
}

.fp-tt-multi-sep{
  height: 1px;
  background: rgba(148, 163, 184, 0.45);
  margin: 8px 0;
}

.fp-tt-free{
  background: #dcfce7;
  color: #166534;
}

.fp-tt-lunch{
  background: #ffffff;
  color: #0f172a;
}

.fp-tt-busy{
  background: #ffffff;
  color: #0f172a;
}

.fp-tt-lines{
  line-height: 1.25;
}
.fp-tt-line{
  font-weight: 500;
  font-size: 12px;
}

/* Distinct colors per line inside a slot (no bold) */
.fp-tt-line--subject{
  /* Subject: strong purple for quick scanning */
  color:#6d28d9;
  font-weight:500;
}
.fp-tt-line--who{
  /* Faculty/Class: teal */
  color:#0f766e;
}
.fp-tt-line--room{
  /* Room: orange */
  color:#c2410c;
}

/* Ensure table grid colors are not overridden by legacy styles below */
.fp-tt-table td.fp-tt-free{
  background: #dcfce7 !important;
  color: #166534 !important;
}
.fp-tt-table td.fp-tt-lunch{
  background: #ffffff !important;
  color: #0f172a !important;
}
.fp-tt-table td.fp-tt-busy,
.fp-tt-table td.fp-tt-lab{
  background: #ffffff !important;
  color: #0f172a !important;
}
.fp-tt-table th.sp-current-slot-header,
.fp-tt-table td.sp-current-slot-header{
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%) !important;
  color: #ffffff !important;
}
.fp-tt-table td.sp-current-slot-cell{
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%) !important;
  box-shadow: inset 0 0 0 3px #f97316;
}
.sp-current-slot-banner{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.12) 0%, rgba(245, 158, 11, 0.18) 100%);
  border: 1px solid rgba(249, 115, 22, 0.28);
  color: #9a3412;
  font-size: 13px;
  font-weight: 700;
}
.sp-current-slot-banner--muted{
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}
.fp-tt-row{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:10px;
  align-items:start;
  padding-top:10px;
  border-top:1px solid #eef2ff;
}
.fp-tt-row:first-child{
  border-top:none;
  padding-top:0;
}
.fp-tt-row-label{
  font-size:12px;
  font-weight:950;
  color:#334155;
}
.fp-tt-row-body{
  min-width:0;
}
.fp-tt-free{
  color:#64748b;
  font-weight:900;
  font-size:12px;
  padding:10px 12px;
  border-radius:14px;
  background:#f8fafc;
  border:1px solid #e2e8f0;
}
.fp-tt-lunch{
  color:#92400e;
  font-weight:900;
  font-size:12px;
  padding:10px 12px;
  border-radius:14px;
  background:#fff7ed;
  border:1px solid #fed7aa;
}

/* Slot card inside timetable list */
.fp-slot{
  background:rgba(30,58,138,0.04);
  border:1px solid rgba(30,58,138,0.12);
  border-radius:14px;
  padding:10px 12px;
}
.fp-slot-subject{font-size:13px}
.fp-slot-class{font-size:12px}
.fp-slot-room{font-size:12px}
.fp-slot-faculty{font-size:12px}

/* Results card styles (used by facultyPortal.js render) */
.fp-result-card{
  background:#fff;
  border:1px solid var(--fp-border);
  border-radius:var(--fp-radius);
  padding:16px 14px;
  box-shadow:0 14px 40px rgba(15,23,42,.08);
}
.fp-result-card h3{margin:0 0 10px 0}
.fp-result-card h4{
  margin:18px 0 10px;
  font-size:15px;
  color:#1e293b;
}
.fp-avail-badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  font-size:12px;
  margin-top:6px;
}
.fp-avail-badge.available{background:rgba(16,185,129,.14);color:#065f46;border:1px solid rgba(16,185,129,.3)}
.fp-avail-badge.busy{background:rgba(239,68,68,.12);color:#7f1d1d;border:1px solid rgba(239,68,68,.25)}
.fp-avail-detail{margin-top:10px;color:#334155;font-size:13px;line-height:1.5}

/* Clickable availability rows */
.fp-avail-item{
  width:100%;
  text-align:left;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid #f1f5f9;
  background:#fff;
  cursor:pointer;
  font-size:13px;
  color:#0f172a;
}
.fp-avail-item:hover{
  background:#f8fafc;
}
.fp-avail-item + .fp-avail-item{
  margin-top:6px;
}
.fp-data-table-wrap{
  margin-top:12px;
  overflow:auto;
  border:1px solid var(--fp-border);
  border-radius:14px;
  background:#fff;
}
.fp-data-table{
  width:100%;
  border-collapse:collapse;
  min-width:560px;
}
.fp-data-table th,
.fp-data-table td{
  padding:10px 12px;
  border-bottom:1px solid #e2e8f0;
  text-align:left;
  font-size:13px;
  vertical-align:top;
}
.fp-data-table th{
  background:#f8fafc;
  font-weight:900;
  color:#0f172a;
}
.fp-data-table tr:last-child td{
  border-bottom:none;
}
.fp-chip-list{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:8px;
}
.fp-chip{
  display:inline-flex;
  align-items:center;
  padding:5px 9px;
  border-radius:999px;
  background:#eff6ff;
  color:#1e3a8a;
  font-size:12px;
  font-weight:800;
}

/* Timetable */
.fp-tt-back{
  border:none;
  background:transparent;
  color:var(--fp-primary);
  font-weight:900;
  cursor:pointer;
  margin-bottom:10px;
}
.fp-tt-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.fp-tt-controls{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.fp-tt-title{
  margin:0;
  font-size:16px;
  font-weight:950;
}
.fp-zoom-controls{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 8px;
  border:1px solid var(--fp-border);
  border-radius:12px;
  background:#fff;
}
.fp-zoom-btn{
  border:1px solid #cbd5e1;
  background:#f8fafc;
  color:#0f172a;
  border-radius:10px;
  min-width:38px;
  padding:8px 10px;
  font-size:13px;
  font-weight:900;
  cursor:pointer;
}
.fp-zoom-btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}
.fp-zoom-value{
  min-width:48px;
  text-align:center;
  font-size:12px;
  font-weight:900;
  color:#334155;
}
.fp-orientation-toggle{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:13px;
  font-weight:800;
  color:#334155;
  user-select:none;
}
.fp-timetable-wrap{
  margin-top:10px;
  overflow:auto;
  border-radius:14px;
  border:1px solid var(--fp-border);
  background:#fff;
}
.fp-timetable{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:640px;
  table-layout:fixed;
}
.fp-timetable th,
.fp-timetable td{
  padding:10px 8px;
  border-bottom:1px solid #eef2ff;
  border-right:1px solid #eef2ff;
  vertical-align:top;
  font-size:12px;
  word-break:break-word;
}
.fp-timetable th{
  position:sticky;
  top:0;
  background:#f8fafc;
  font-weight:950;
  z-index:1;
}
.fp-day-cell{
  font-weight:950;
  background:#fbfdff;
  white-space:nowrap;
}
.fp-lunch-cell{
  text-align:center;
  color:#64748b;
  font-weight:900;
  background:#fff7ed;
}
.fp-free-cell{
  color:#64748b;
  font-weight:800;
}
.fp-slot-subject{font-weight:600;color:#0f172a}
.fp-slot-class{margin-top:3px;color:#0f766e;font-weight:500}
.fp-slot-room{margin-top:3px;color:#c2410c;font-weight:500}
.fp-slot-faculty{margin-top:3px;color:#6d28d9;font-weight:500}

.fp-tt-table-wrap.fp-tt-zoom-out .fp-tt-table{
  min-width:700px;
}
.fp-tt-table-wrap.fp-tt-zoom-out .fp-tt-table th,
.fp-tt-table-wrap.fp-tt-zoom-out .fp-tt-table td{
  padding:8px 6px;
}
.fp-tt-table-wrap.fp-tt-zoom-out .fp-tt-cell,
.fp-tt-table-wrap.fp-tt-zoom-out .fp-tt-line{
  font-size:11px;
}
.fp-tt-table-wrap.fp-tt-zoom-out .fp-tt-day{
  width:70px;
  font-size:13px;
}

.fp-tt-table-wrap.fp-tt-zoom-normal .fp-tt-table{
  min-width:820px;
}

.fp-tt-table-wrap.fp-tt-zoom-in .fp-tt-table{
  min-width:980px;
}
.fp-tt-table-wrap.fp-tt-zoom-in .fp-tt-table th,
.fp-tt-table-wrap.fp-tt-zoom-in .fp-tt-table td{
  padding:12px 9px;
}
.fp-tt-table-wrap.fp-tt-zoom-in .fp-tt-cell,
.fp-tt-table-wrap.fp-tt-zoom-in .fp-tt-line{
  font-size:13px;
}
.fp-tt-table-wrap.fp-tt-zoom-in .fp-tt-day{
  width:92px;
  font-size:15px;
}

.fp-tt-table-wrap.fp-tt-zoom-in-2 .fp-tt-table{
  min-width:1120px;
}
.fp-tt-table-wrap.fp-tt-zoom-in-2 .fp-tt-table th,
.fp-tt-table-wrap.fp-tt-zoom-in-2 .fp-tt-table td{
  padding:14px 10px;
}
.fp-tt-table-wrap.fp-tt-zoom-in-2 .fp-tt-cell,
.fp-tt-table-wrap.fp-tt-zoom-in-2 .fp-tt-line{
  font-size:14px;
}
.fp-tt-table-wrap.fp-tt-zoom-in-2 .fp-tt-day{
  width:104px;
  font-size:16px;
}

.fp-inst-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.fp-inst-item{
  width:100%;
  text-align:left;
  border:1px solid var(--fp-border);
  background:#fff;
  border-radius:14px;
  padding:14px 14px;
  cursor:pointer;
  font-weight:900;
}
.fp-inst-item small{
  display:block;
  margin-top:4px;
  color:var(--fp-muted);
  font-weight:700;
}

.fp-footer {
  margin-top: auto;
  padding: 32px 0 20px;
  text-align: center;
}

.fp-admin-link {
  display: inline-block;
  color: var(--fp-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 10px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.fp-admin-link:hover {
  color: var(--fp-primary);
  background: rgba(30, 58, 138, 0.05);
  border-color: var(--fp-border);
}

.fp-attribution {
  margin-top: 12px;
  font-size: 13px;
  color: var(--fp-muted);
  font-weight: 500;
}

.fp-attribution strong {
  color: var(--fp-primary);
  font-weight: 700;
}

@media (min-width: 980px){
  .fp-shell{
    align-items:stretch;
    justify-content:flex-start;
    padding:36px 40px 28px;
  }

  .fp-page{
    width:min(1380px,100%);
  }

  .fp-header{
    text-align:left;
    padding:0 4px 20px;
    margin-bottom:18px;
    display:grid;
    grid-template-columns:minmax(0, 1fr) auto;
    gap:12px 20px;
    align-items:end;
  }

  .fp-app-title,
  .fp-h1,
  .fp-h2,
  .fp-h3{
    grid-column:1;
  }

  .fp-app-title{
    font-size:13px;
    margin-bottom:0;
  }

  .fp-h1{
    font-size:42px;
  }

  .fp-h2{
    margin-top:0;
    font-size:24px;
  }

  .fp-h3{
    margin-top:0;
    font-size:15px;
  }

  .fp-user{
    grid-column:2;
    grid-row:1 / span 4;
    margin-top:0;
    justify-content:flex-end;
    align-self:start;
    text-align:right;
    max-width:320px;
  }

  .fp-desktop-layout{
    display:grid;
    grid-template-columns:minmax(320px, 380px) minmax(0, 1fr);
    gap:24px;
    align-items:start;
  }

  .fp-desktop-sidebar{
    position:sticky;
    top:24px;
  }

  .fp-form{
    padding:22px 20px;
  }

  .fp-form .fp-label{
    margin-top:16px;
    margin-bottom:8px;
    font-size:14px;
  }

  .fp-select{
    font-size:16px;
    padding:14px 15px;
  }

  .fp-btn{
    font-size:16px;
    padding:14px 14px;
  }

  .fp-btn + .fp-btn{
    margin-top:0;
  }

  .fp-results{
    margin-top:0;
  }

  .fp-desktop-content{
    display:flex;
    flex-direction:column;
    gap:18px;
  }

  .fp-result-card{
    padding:20px 20px;
  }

  .fp-tt-head{
    align-items:flex-start;
  }

  .fp-tt-controls{
    gap:12px;
  }

  .fp-tt-title{
    font-size:20px;
  }

  .fp-tt-table-wrap{
    border-radius:20px;
  }

  .fp-tt-table{
    min-width:1040px;
  }

  .fp-tt-table th,
  .fp-tt-table td{
    padding:14px 10px;
  }

  .fp-tt-day{
    width:110px;
    font-size:15px;
  }

  .fp-tt-cell,
  .fp-tt-line{
    font-size:13px;
  }

  .fp-footer{
    width:min(1380px,100%);
    margin:24px auto 0;
    padding:24px 4px 10px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:16px;
    text-align:left;
  }

  .fp-attribution{
    margin-top:0;
  }
}

@media (max-width:480px){
  .fp-shell{
    padding:
      calc(10px + env(safe-area-inset-top))
      calc(10px + env(safe-area-inset-right))
      calc(14px + env(safe-area-inset-bottom))
      calc(10px + env(safe-area-inset-left));
  }
  .fp-title{font-size:26px}
  .fp-subtitle{font-size:18px}
  .fp-h1{font-size:26px}
  .fp-h2{font-size:18px}
  .fp-h3{font-size:14px}
  .fp-btn{font-size:16px;padding:14px 12px}
  .fp-select{font-size:16px;padding:14px 12px}
  .fp-card{padding:20px 16px; border-radius: 16px;}
  .fp-form{padding:14px 12px}
  .fp-tt-table{min-width: 700px}
  .fp-tt-table th, .fp-tt-table td { padding: 8px 4px; font-size: 11px; }
  .fp-tt-day { width: 60px; font-size: 12px; }
  .fp-tt-line { font-size: 11px; }
  .fp-tt-group { padding: 1px 6px; font-size: 10px; }
  .fp-tt-back { font-size: 14px; }
  .fp-footer { padding: 24px 0 16px; }
}

/* Landscape: keep single-column layout (no side-by-side). */
@media (orientation: landscape) and (max-height: 520px){
  .fp-page{width:min(560px,100%)}
  .fp-card{margin-top:14px}
  .fp-form{display:block}
}

