/* ============================================================
   SWU PHINMA Facility Report System — Global Stylesheet
   Commercial-grade design system
   ============================================================ */

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

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #7a0e2b;
  --navy-dark:  #4f0a1c;
  --navy-light: #a01838;
  --gold:       #f0c808;
  --gold-dark:  #c9a800;
  --gold-light: #fde047;
  --muted:      #64748b;
  --surface:    #f8fafc;
  --card:       #ffffff;
  --border:     rgba(122,14,43,0.08);
  --border-md:  rgba(122,14,43,0.12);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(122,14,43,.08), 0 1px 4px rgba(122,14,43,.04);
  --shadow-lg:  0 12px 40px rgba(122,14,43,.10), 0 4px 12px rgba(122,14,43,.06);
  --shadow-xl:  0 24px 64px rgba(122,14,43,.14), 0 8px 24px rgba(122,14,43,.08);
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--surface);
  color: var(--navy);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  animation: pageFadeIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

body.page-leaving {
  opacity: 0 !important;
  transform: translateY(-5px) !important;
  transition: opacity 0.18s ease-in, transform 0.18s ease-in !important;
  animation: none !important;
  pointer-events: none;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

/* ── NAVIGATION ── */
nav {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 1px 0 rgba(122,14,43,0.06), 0 4px 16px rgba(122,14,43,0.04);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 15px;
  color: var(--navy);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo img.crest {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.nav-logo .school-name { font-size: 14px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.nav-logo .school-sub  { font-size: 11px; font-weight: 400; color: var(--muted); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  position: relative;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
}

.nav-links a:hover { color: var(--navy); background: rgba(122,14,43,0.05); text-decoration: none; }
.nav-links a.active { color: var(--navy); font-weight: 600; background: rgba(122,14,43,0.06); }

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 5px; left: 14px; right: 14px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }

/* ── HERO ── */
.hero-block {
  position: relative;
  background: var(--navy-dark);
  background-image:
    linear-gradient(160deg, rgba(122,14,43,0.82) 0%, rgba(5,30,56,0.95) 100%),
    url('assets/hero.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow: hidden;
}

.hero-block::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 60% 40%, rgba(240,200,8,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero {
  position: relative;
  z-index: 1;
  color: #fff;
  padding: 130px 24px 90px;
  text-align: center;
  min-height: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero-logo {
  width: 112px; height: 112px;
  margin: 0 auto 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15), 0 20px 40px rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
}

.hero-logo img { width: 80px; height: 80px; border-radius: 50%; object-fit: contain; }

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 4px 24px rgba(0,0,0,0.3);
  margin-bottom: 16px;
  max-width: 700px;
}

.hero p {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.80);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: translateX(-200%);
  transition: transform 0s;
}

.btn:hover::before { transform: translateX(200%); transition: transform 0.7s; }

.btn:hover { opacity: 1; text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); transition-duration: 0.05s; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 14px rgba(122,14,43,0.30), 0 1px 3px rgba(122,14,43,0.20);
}
.btn-primary:hover { background: var(--navy-light); box-shadow: 0 8px 24px rgba(122,14,43,0.35); }

.btn-outline {
  background: var(--gold);
  color: var(--navy);
  box-shadow: 0 4px 14px rgba(240,200,8,0.35);
}
.btn-outline:hover { background: var(--gold-light); box-shadow: 0 8px 24px rgba(240,200,8,0.45); }

.btn-ghost {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: rgba(255,255,255,0.18); }

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-md);
  animation: cardSlideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 7px;
  letter-spacing: -0.01em;
}

.form-label .req { color: #e53e3e; margin-left: 2px; }

input[type=text],
input[type=password],
input[type=email],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid rgba(122,14,43,0.12);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--navy);
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(122,14,43,0.10);
  background: #fafcff;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a0e2b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea { resize: vertical; min-height: 110px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── ALERTS ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  line-height: 1.5;
}

.alert-error   { background: #fff5f5; border: 1.5px solid #fed7d7; color: #c53030; }
.alert-success { background: #f0fff4; border: 1.5px solid #c6f6d5; color: #276749; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.badge-pending  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-progress { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-resolved { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-rejected { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }

/* ── PAGE WRAPPERS ── */
.page-wrap      { max-width: 760px;  margin: 0 auto; padding: 40px 20px; }
.page-wrap-wide { max-width: 1100px; margin: 0 auto; padding: 40px 20px; }

/* ── SPINNER ── */
.spinner {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  margin-right: 7px;
  flex-shrink: 0;
}

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

/* ── HERO SECTION LAYOUT ── */
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-btns .btn { min-width: 160px; padding: 13px 28px; font-size: 14.5px; }

/* ── FEATURE CARDS ── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  max-width: 880px;
  margin: -60px auto 0;
  padding: 80px 24px 80px;
  position: relative;
  z-index: 2;
}

.feature-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  backdrop-filter: blur(12px);
  color: rgba(255,255,255,0.92);
  transition: var(--transition);
}

.feature-card:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
}

.feature-icon { font-size: 26px; margin-bottom: 10px; }
.feature-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: #fff; }
.feature-card p  { font-size: 13px; color: rgba(255,255,255,0.72); line-height: 1.6; }

/* ── FOOTER ── */
.footer {
  text-align: center;
  padding: 36px 20px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  background: rgba(5,20,40,0.6);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.06);
  letter-spacing: 0.01em;
}

/* ── SIDEBAR (admin) ── */
.sidebar .nav-item,
.sidebar .nav-item:hover,
.sidebar .nav-item:focus,
.sidebar .nav-item:focus-visible {
  background: transparent !important;
  color: rgba(255,255,255,0.7) !important;
  outline: none !important;
  box-shadow: none !important;
}

.sidebar .nav-item.active {
  background: rgba(255,255,255,0.10) !important;
  color: #fff !important;
}

.sidebar .nav-item::before,
.sidebar .nav-item::after { display: none !important; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  nav { padding: 0 16px; height: 60px; }
  .nav-links a { padding: 6px 10px; font-size: 12.5px; }
  .hero { padding: 90px 20px 60px; min-height: 500px; }
  .hero h1 { font-size: 2rem; }
  .card { padding: 18px 18px; }
}
