/* ============================================================
   ZEEA Management Information System — theme
   Green/teal/white, clean government dashboard style.
   ============================================================ */

:root {
  --zeea-green: #14794b;
  --zeea-green-dark: #0b5c3f;
  --zeea-teal: #0e7a67;
  --zeea-teal-dark: #0a5c50;
  --zeea-accent: #1c8e59;
  --zeea-bg: #f4f8f6;
  --zeea-card-border: #e3ece7;
  --zeea-text: #1f2d27;
  --zeea-muted: #5f7268;
  --zeea-sidebar-width: 260px;
  --zeea-sidebar-collapsed: 68px;
  --zeea-topbar-height: 60px;
}

html, body {
  height: 100%;
}

body {
  background: var(--zeea-bg);
  color: var(--zeea-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.95rem;
}

a { color: var(--zeea-teal); }
a:hover { color: var(--zeea-teal-dark); }

/* ---------- Buttons ---------- */
.btn-zeea {
  background: linear-gradient(135deg, var(--zeea-green), var(--zeea-teal));
  border: none;
  color: #fff;
}
.btn-zeea:hover, .btn-zeea:focus {
  background: linear-gradient(135deg, var(--zeea-green-dark), var(--zeea-teal-dark));
  color: #fff;
}
.btn-outline-zeea {
  border: 1px solid var(--zeea-green);
  color: var(--zeea-green);
  background: transparent;
}
.btn-outline-zeea:hover { background: var(--zeea-green); color: #fff; }

/* ---------- Layout ---------- */
.zeea-shell { display: flex; min-height: 100vh; }

.zeea-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--zeea-sidebar-width);
  transition: margin-left .15s ease;
  display: flex;
  flex-direction: column;
}
body.sidebar-collapsed .zeea-main { margin-left: var(--zeea-sidebar-collapsed); }

.zeea-content { padding: 1.25rem 1.5rem 3rem; flex: 1; }

/* ---------- Sidebar ---------- */
.zeea-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--zeea-sidebar-width);
  background: linear-gradient(180deg, var(--zeea-green-dark) 0%, var(--zeea-teal-dark) 100%);
  color: #eaf5ef;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: width .15s ease, transform .15s ease;
  overflow: hidden;
}
body.sidebar-collapsed .zeea-sidebar { width: var(--zeea-sidebar-collapsed); }

.zeea-sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .85rem .9rem;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.12);
  min-height: var(--zeea-topbar-height);
}
.zeea-sidebar .sidebar-brand img {
  width: 40px; height: 40px;
  background: #fff;
  border-radius: 50%;
  padding: 2px;
  flex-shrink: 0;
}
.zeea-sidebar .sidebar-brand .brand-text { line-height: 1.15; }
.zeea-sidebar .sidebar-brand .brand-text strong { font-size: .95rem; display: block; }
.zeea-sidebar .sidebar-brand .brand-text small { font-size: .68rem; opacity: .8; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .5rem 0 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
}

.sidebar-nav .nav-section {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255,255,255,.55);
  padding: .9rem 1rem .25rem;
  white-space: nowrap;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: #d9ece2;
  padding: .55rem .95rem;
  font-size: .9rem;
  white-space: nowrap;
  border-left: 3px solid transparent;
}
.sidebar-nav .nav-link i {
  width: 1.35rem;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav .nav-link.active {
  background: rgba(255,255,255,.14);
  color: #fff;
  border-left-color: #8fe3bd;
  font-weight: 600;
}

.sidebar-nav .nav-sub .nav-link { padding-left: 2.6rem; font-size: .85rem; }

/* Collapsed: icons only */
body.sidebar-collapsed .zeea-sidebar .brand-text,
body.sidebar-collapsed .zeea-sidebar .nav-label,
body.sidebar-collapsed .zeea-sidebar .nav-section,
body.sidebar-collapsed .zeea-sidebar .nav-sub,
body.sidebar-collapsed .zeea-sidebar .nav-caret { display: none; }
body.sidebar-collapsed .sidebar-nav .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .sidebar-nav .nav-link i { width: auto; font-size: 1.15rem; }

/* ---------- Topbar ---------- */
.zeea-topbar {
  height: var(--zeea-topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--zeea-card-border);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.zeea-topbar .btn-icon {
  border: none;
  background: transparent;
  color: var(--zeea-text);
  font-size: 1.2rem;
  padding: .4rem .6rem;
  border-radius: .5rem;
}
.zeea-topbar .btn-icon:hover { background: var(--zeea-bg); }

.deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 600;
  padding: .35rem .7rem;
  border-radius: 2rem;
  text-decoration: none;
  white-space: nowrap;
}
.deadline-badge.status-open { background: #e7f6ee; color: #116941; }
.deadline-badge.status-near { background: #fff6e0; color: #8a6100; }
.deadline-badge.status-due { background: #ffe9d6; color: #9a4b00; }
.deadline-badge.status-overdue { background: #fdeaea; color: #a12626; }
.deadline-badge.status-closed { background: #eef1f0; color: #5f7268; }
.deadline-badge.status-none { background: #eef1f0; color: #5f7268; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--zeea-card-border);
  border-radius: .9rem;
  box-shadow: 0 1px 3px rgba(15, 61, 42, .05);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--zeea-card-border);
  border-radius: .9rem .9rem 0 0 !important;
  font-weight: 600;
}

.kpi-card { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; }
.kpi-card .kpi-icon {
  width: 46px; height: 46px;
  border-radius: .8rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  background: linear-gradient(135deg, var(--zeea-green), var(--zeea-teal));
  flex-shrink: 0;
}
.kpi-card .kpi-value { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.kpi-card .kpi-label { font-size: .8rem; color: var(--zeea-muted); }

/* ---------- Forms & tables ---------- */
.form-label { font-weight: 600; font-size: .85rem; }
.form-control:focus, .form-select:focus {
  border-color: var(--zeea-green);
  box-shadow: 0 0 0 .2rem rgba(20, 121, 75, .15);
}
.table thead th {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--zeea-muted);
  border-bottom-width: 1px;
}

.page-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--zeea-muted); font-size: .85rem; }

/* Focus visibility for accessibility */
a:focus-visible, button:focus-visible, .nav-link:focus-visible {
  outline: 3px solid rgba(20, 121, 75, .45);
  outline-offset: 1px;
}

/* ---------- Auth pages ---------- */
/* Kept for the setup wizard and error pages, which stay single-column. */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(20,121,75,.14), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(14,122,103,.12), transparent 55%),
    var(--zeea-bg);
  padding: 1.5rem;
}
.auth-card { width: 100%; max-width: 430px; }
.auth-card .card { border-radius: 1.1rem; box-shadow: 0 10px 35px rgba(11, 61, 42, .12); }
.auth-logo { width: 84px; height: 84px; object-fit: contain; }

/* ---------- Sign-in screen (login, password reset, MFA) ----------
   Full-bleed background picture with a scrim over it and the sign-in card
   floating on top. layouts/guest.blade.php picks the picture: the first of
   login-bg.jpg / .jpeg / .png / .webp / .svg found in public/assets/img/ wins,
   and it sets --zeea-login-bg inline. Upload a real ZEEA photo under one of
   those names and it takes over — nothing here needs editing. The url() below
   is only the last-resort default. */
.login-page {
  --zeea-login-bg: url("../img/login-bg.svg");
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: var(--zeea-login-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  /* Shown while the image loads, and behind it if it ever fails. */
  background-color: var(--zeea-green-dark);
}

/* Scrim: keeps text and the card readable over any photo that gets dropped in. */
.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  /* Tuned so white brand text stays legible over a BRIGHT photo (sky, sand,
     water). If you swap in a dark picture these can safely come down. */
  background:
    radial-gradient(62% 55% at 50% 42%, rgba(2, 24, 16, .55) 0%, rgba(2, 24, 16, .20) 62%, transparent 100%),
    linear-gradient(180deg,
      rgba(2, 24, 16, .74) 0%,
      rgba(2, 24, 16, .52) 30%,
      rgba(2, 24, 16, .34) 52%,
      rgba(2, 24, 16, .62) 100%);
  pointer-events: none;
}

.login-page > * { position: relative; z-index: 1; }

.login-body {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
}

.login-box { width: 100%; max-width: 440px; }

/* Brand block above the card */
.login-brand { text-align: center; margin-bottom: 1.4rem; color: #fff; }

/* Circular ZEEA seal — never distort, never crop to a square. */
.login-brand img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 8px;
  margin-bottom: .85rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .32);
}
/* The small lines carry a shadow too: the scrim alone is not enough over a
   bright sky, and the picture is user-replaceable. */
.login-brand .eyebrow {
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: .7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .92);
  margin-bottom: .3rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}
.login-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  margin-bottom: .25rem;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .6);
}
.login-brand p {
  font-size: .88rem;
  color: rgba(255, 255, 255, .92);
  margin-bottom: 0;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}

/* Frosted card so the picture still reads through the edges */
.login-box .card {
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .35);
}

.login-foot {
  flex-shrink: 0;
  padding: 1rem 1.25rem 1.5rem;
  text-align: center;
  font-size: .8rem;
  color: rgba(255, 255, 255, .9);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}
.login-foot a { color: #fff; }

@media (max-width: 575.98px) {
  /* iOS ignores fixed attachment and it costs scroll performance on phones. */
  .login-page { background-attachment: scroll; }
  .login-brand img { width: 78px; height: 78px; }
  .login-brand h1 { font-size: 1.25rem; }
  .login-body { padding: 1.75rem 1rem; }
}

/* ---------- Offline indicator ---------- */
.offline-indicator {
  display: none;
  font-size: .78rem;
  font-weight: 600;
  color: #9a4b00;
  background: #fff6e0;
  padding: .3rem .65rem;
  border-radius: 2rem;
}
body.is-offline .offline-indicator { display: inline-flex; align-items: center; gap: .35rem; }

/* ---------- Mobile ---------- */
@media (max-width: 991.98px) {
  .zeea-main, body.sidebar-collapsed .zeea-main { margin-left: 0; }

  .zeea-sidebar {
    transform: translateX(-100%);
    width: var(--zeea-sidebar-width) !important;
  }
  body.sidebar-mobile-open .zeea-sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
  /* Keep labels visible on mobile even if desktop pref is collapsed */
  body.sidebar-collapsed .zeea-sidebar .brand-text,
  body.sidebar-collapsed .zeea-sidebar .nav-label,
  body.sidebar-collapsed .zeea-sidebar .nav-section,
  body.sidebar-collapsed .zeea-sidebar .nav-sub,
  body.sidebar-collapsed .zeea-sidebar .nav-caret { display: initial; }
  body.sidebar-collapsed .sidebar-nav .nav-link { justify-content: flex-start; padding: .55rem .95rem; }

  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1039;
  }
  body.sidebar-mobile-open .sidebar-backdrop { display: block; }

  .zeea-content { padding: 1rem .9rem 3rem; }
}

@media print {
  .zeea-sidebar, .zeea-topbar, .no-print { display: none !important; }
  .zeea-main { margin-left: 0 !important; }
  body { background: #fff; }
}
