/* PPG Admin — UI components: side nav, toolbar, notify modal
 * Vanilla CSS — no framework dependency.
 * Works alongside Tailwind (loaded in index.html).
 */

/* ─── CSS variables ─────────────────────────────────────── */
:root {
  --nav-width: 240px;
  --nav-collapsed-width: 56px;
  --header-bg: rgba(15, 23, 42, 0.8);
  --nav-bg: rgba(15, 23, 42, 0.7);
  --nav-hover: rgba(255, 255, 255, 0.1);
  --nav-active-bg: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --nav-text: #94a3b8;
  --nav-text-active: #fff;
  --nav-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --top-nav-height: 72px;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  --accent-glow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* ─── Premium Background Mesh ────────────────────────────── */
body {
  position: relative;
  background: #0f172a !important;
  /* Deep base */
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.4) 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(124, 58, 237, 0.4) 0%, transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(37, 99, 235, 0.3) 0%, transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(124, 58, 237, 0.3) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(30, 64, 175, 0.2) 0%, transparent 50%);
  filter: blur(60px);
  animation: mesh-float 15s ease-in-out infinite alternate;
}

@keyframes mesh-float {
  0% {
    transform: scale(1) translate(0, 0);
  }

  100% {
    transform: scale(1.1) translate(2%, 2%);
  }
}

/* ─── App shell (side-nav + main-content side by side) ──── */
.app-shell {
  display: flex;
  min-height: calc(100vh - var(--top-nav-height));
  background: transparent;
}

/* ─── Side navigation ───────────────────────────────────── */
.side-nav {
  width: var(--nav-width);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--nav-text);
  flex-shrink: 0;
  overflow: hidden;
  transition: var(--nav-transition);
  position: sticky;
  top: var(--top-nav-height);
  height: calc(100vh - var(--top-nav-height));
  overflow-y: auto;
  z-index: 40;
  border-right: 1px solid var(--glass-border);
}

.side-nav.collapsed {
  width: var(--nav-collapsed-width);
}

/* nav section label (hidden when collapsed) */
.nav-section-label {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  padding: 1rem 0.875rem 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s ease;
}

.side-nav.collapsed .nav-section-label {
  opacity: 0;
  height: 0;
  padding: 0;
}

/* individual nav item */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.875rem;
  cursor: pointer;
  border-radius: 6px;
  margin: 1px 6px;
  white-space: nowrap;
  overflow: hidden;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--nav-text);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  border: none;
  background: none;
  width: calc(100% - 12px);
  text-align: left;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: var(--nav-hover);
  color: var(--nav-text-active);
  transform: translateX(4px);
  outline: none;
}

.nav-item:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-text-active);
}

/* icon inside nav item */
.nav-icon {
  font-size: 1.1rem;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
}

/* nav item text (hidden when collapsed) */
.nav-label {
  transition: opacity 0.15s ease;
  overflow: hidden;
  white-space: nowrap;
}

.side-nav.collapsed .nav-label {
  opacity: 0;
  width: 0;
}

/* chevron for expandable items */
.nav-chevron {
  margin-left: auto;
  font-size: 0.7rem;
  transition: transform 0.2s ease, opacity 0.15s ease;
}

.side-nav.collapsed .nav-chevron {
  opacity: 0;
  width: 0;
}

.nav-item[aria-expanded="true"] .nav-chevron {
  transform: rotate(90deg);
}

/* sub-menu items */
.nav-submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.22s ease;
}

.nav-submenu.open {
  max-height: 200px;
}

.side-nav.collapsed .nav-submenu {
  max-height: 0 !important;
}

.nav-subitem {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.875rem 0.45rem 2.75rem;
  margin: 1px 6px;
  font-size: 0.8rem;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  border: none;
  background: none;
  width: calc(100% - 12px);
  text-align: left;
  transition: background 0.13s ease, color 0.13s ease;
}

.nav-subitem:hover,
.nav-subitem:focus-visible {
  background: var(--nav-hover);
  color: #fff;
  outline: none;
}

.nav-subitem:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

.nav-subitem.active {
  color: #60a5fa;
  font-weight: 600;
}

/* ─── Main content area ─────────────────────────────────── */
/* ─── Typography & Main Content ─────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  background: transparent;
  padding: 2rem;
  color: #f1f5f9;
}

h1,
h2,
h3,
h4 {
  color: #fff !important;
  letter-spacing: -0.02em;
}

.text-slate-600 {
  color: #94a3b8 !important;
}

.text-slate-700 {
  color: #cbd5e1 !important;
}

.text-slate-800 {
  color: #f1f5f9 !important;
}

.text-slate-500 {
  color: #64748b !important;
}

/* view panels */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* ─── Minutes list view ─────────────────────────────────── */
.minutes-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 1.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: var(--glass-shadow);
}

.minutes-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px -10px rgba(0, 0, 0, 0.3);
}

.minutes-card:focus-within {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.minutes-date-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #2563eb;
  background: #eff6ff;
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 0.4rem;
}

.minutes-status-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: 0.5rem;
}

.badge-published {
  color: #059669;
  background: #ecfdf5;
}

.badge-draft {
  color: #d97706;
  background: #fffbeb;
}

/* ─── Minutes detail toolbar ────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 12px 12px 0 0;
}

.toolbar-spacer {
  flex: 1;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease;
  white-space: nowrap;
}

.toolbar-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

.toolbar-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.toolbar-btn.btn-primary {
  background: var(--nav-active-bg);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: var(--accent-glow);
}

.toolbar-btn.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(37, 99, 235, 0.6);
}

.toolbar-btn.btn-danger {
  background: #fff;
  border-color: #fca5a5;
  color: #dc2626;
}

.toolbar-btn.btn-danger:hover {
  background: #fef2f2;
}

.toolbar-btn[data-admin-only] {
  border-color: #a78bfa;
  color: #7c3aed;
}

.toolbar-btn[data-admin-only]:hover {
  background: #f5f3ff;
  border-color: #7c3aed;
}

/* ─── Notify modal ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1.25rem;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 4px;
}

.modal-close-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.modal-close-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.modal-field {
  margin-bottom: 1rem;
}

.modal-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 0.4rem;
}

.modal-input,
.modal-select,
.modal-textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #1e293b;
  background: #f8fafc;
  transition: border-color 0.13s ease;
}

.modal-input:focus,
.modal-select:focus,
.modal-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
}

.modal-textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.8rem;
  color: #475569;
  min-height: 60px;
  white-space: pre-wrap;
}

.modal-error {
  font-size: 0.78rem;
  color: #dc2626;
  margin-top: 0.25rem;
  display: none;
}

.modal-error.visible {
  display: block;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

/* ─── Hamburger toggle button (in top nav) ──────────────── */
.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.85);
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 1.3rem;
  line-height: 1;
  transition: background 0.13s;
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: rgba(255, 255, 255, .12);
}

.hamburger-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

/* ─── Responsive tweaks ─────────────────────────────────── */
@media (max-width: 768px) {
  .side-nav {
    position: fixed;
    top: var(--top-nav-height);
    left: 0;
    height: calc(100vh - var(--top-nav-height));
    width: var(--nav-width);
    transform: translateX(0);
    transition: transform 0.22s ease, width 0.22s ease;
    z-index: 50;
  }

  .side-nav.collapsed {
    transform: translateX(-100%);
    width: var(--nav-width);
  }

  .side-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--top-nav-height);
    background: rgba(0, 0, 0, .4);
    z-index: 49;
  }

  .side-nav-backdrop.visible {
    display: block;
  }

  .main-content {
    width: 100%;
  }
}

@media (min-width: 769px) {
  .side-nav-backdrop {
    display: none !important;
  }
}

/* ─── Global Dark Input Overrides (glassmorphism) ───────── */
/* Target all form controls regardless of Tailwind classes or missing type attributes */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="color"]):not([type="image"]),
select,
textarea {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f1f5f9 !important;
  border-radius: 10px !important;
  transition: all 0.2s ease;
  caret-color: #f1f5f9 !important;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="date"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder {
  color: rgba(148, 163, 184, 0.7) !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  outline: none !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(99, 153, 255, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

/* select arrow colour */
select option {
  background: #1e293b;
  color: #f1f5f9;
}

/* Override Tailwind bg-* on form inputs */
.bg-blue-800 {
  background: rgba(30, 58, 138, 0.5) !important;
  backdrop-filter: blur(8px);
}