/* ============================================================
   Bamboo Home Support — Forms Portal
   app.css — Custom styles (Bootstrap 5 base)
   Primary: #2d6a4f | Accent: #52b788 | Surface: #f8f9fa
   ============================================================ */

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

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --primary: #2d6a4f;
  --primary-dark: #1b4332;
  --primary-light: #52b788;
  --primary-xlight: #d8f3dc;
  --accent: #40916c;
  --text: #212529;
  --text-muted: #6c757d;
  --surface: #f8f9fa;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #334155;
  --sidebar-active: #2d6a4f;
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 70px;
  --topbar-height: 60px;
  --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --transition: 0.2s ease;
}

/* ── Reset / Base ──────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  margin: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ── Login Page ────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.login-header {
  background: var(--primary);
  padding: 2rem;
  text-align: center;
  color: #fff;
}

.login-header .brand-icon {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.6rem;
}

.login-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}

.login-header p {
  font-size: 0.8rem;
  opacity: 0.85;
  margin: 0;
}

.login-body-inner {
  padding: 2rem;
}

/* ── Sidebar Layout ────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform var(--transition), width var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.brand-link {
  display: flex;
  align-items: center;
  width: 100%;
  text-decoration: none !important;
  background: #ffffff;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
}

.brand-logo-full {
  max-width: 100%;
  max-height: 82px;
  object-fit: contain;
  display: block;
}

.brand-logo-collapsed {
  display: none;
  width: 42px;
  height: 42px;
  object-fit: contain;
  margin: 0 auto;
}

.sidebar-brand .brand-name {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
}

.sidebar-brand .brand-sub {
  color: var(--sidebar-text);
  font-size: 0.7rem;
  opacity: 0.7;
  display: block;
  margin-top: 2px;
}

.sidebar-brand .brand-logo {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.sidebar-section-label {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.8rem 1.2rem 0.3rem;
}

.sidebar-nav .nav-item {
  list-style: none;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.2rem;
  color: var(--sidebar-text);
  font-size: 0.85rem;
  font-weight: 400;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.sidebar-nav .nav-link i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.sidebar-nav .nav-link:hover i {
  opacity: 1;
}

.sidebar-nav .nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.sidebar-nav .nav-link.active i {
  opacity: 1;
}

.sidebar-footer {
  padding: 0.8rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--sidebar-text);
}

.sidebar-footer .user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-footer .user-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer .user-role {
  font-size: 0.68rem;
  opacity: 0.6;
}

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

/* ── Collapsed Sidebar (Desktop) ───────────────────────────── */
.sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

.sidebar.collapsed .sidebar-brand {
  padding: 1.2rem 0.5rem;
  justify-content: center;
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .brand-text,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role,
.sidebar.collapsed .user-details {
  display: none;
}

.sidebar.collapsed .brand-logo-full {
  display: none;
}

.sidebar.collapsed .brand-logo-collapsed {
  display: block;
}

.sidebar.collapsed .brand-link {
  background: transparent;
  padding: 0;
}

.sidebar.collapsed .brand-logo {
  margin: 0 auto;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.8rem 0;
}

.sidebar.collapsed .nav-link i {
  font-size: 1.1rem;
  margin: 0;
}

.sidebar.collapsed .sidebar-footer {
  padding: 0.8rem 0;
  text-align: center;
}

.sidebar.collapsed .user-info {
  justify-content: center;
}

.sidebar.collapsed .user-avatar {
  margin: 0 auto;
}

.main-wrapper.collapsed {
  margin-left: var(--sidebar-width-collapsed);
}


/* ── Top Bar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  gap: 1rem;
}

.topbar-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  display: block;
  /* Always show toggle button */
}

.topbar-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Content ───────────────────────────────────────────────── */
.content-area {
  flex: 1;
  padding: 1.5rem;
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  border: 1px solid #e9ecef;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--primary-dark);
  padding: 0.85rem 1.25rem;
  border-radius: 10px 10px 0 0 !important;
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-card {
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--card-shadow);
  border: 1px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.stat-green {
  background: #fff;
  border-color: var(--primary-xlight);
}

.stat-green .stat-icon {
  background: var(--primary-xlight);
  color: var(--primary);
}

.stat-green .stat-value {
  color: var(--primary);
}

.stat-blue {
  background: #fff;
  border-color: #dbeafe;
}

.stat-blue .stat-icon {
  background: #dbeafe;
  color: #1d4ed8;
}

.stat-blue .stat-value {
  color: #1d4ed8;
}

.stat-amber {
  background: #fff;
  border-color: #fef3c7;
}

.stat-amber .stat-icon {
  background: #fef3c7;
  color: #d97706;
}

.stat-amber .stat-value {
  color: #d97706;
}

.stat-purple {
  background: #fff;
  border-color: #ede9fe;
}

.stat-purple .stat-icon {
  background: #ede9fe;
  color: #7c3aed;
}

.stat-purple .stat-value {
  color: #7c3aed;
}

.stat-teal {
  background: #fff;
  border-color: #ccfbf1;
}

.stat-teal .stat-icon {
  background: #ccfbf1;
  color: #0d9488;
}

.stat-teal .stat-value {
  color: #0d9488;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.btn-primary:hover {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
}

.btn-outline-primary {
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.btn-outline-primary:hover {
  background: var(--primary) !important;
  color: #fff !important;
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  font-size: 0.7rem;
  font-weight: 500;
}

/* ── Tables ────────────────────────────────────────────────── */
.table {
  font-size: 0.83rem;
}

.table th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface);
  border-bottom: 2px solid #e9ecef;
  white-space: nowrap;
}

.table td {
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background: rgba(45, 106, 79, 0.04);
}

/* Scrollable table wrapper */
.table-responsive {
  border-radius: 0 0 10px 10px;
}

/* ── Search/Filter Bar ─────────────────────────────────────── */
.filter-bar {
  background: #fff;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid #e9ecef;
  box-shadow: var(--card-shadow);
}

/* ── Form Styles ───────────────────────────────────────────── */
.form-label {
  font-weight: 500;
  font-size: 0.83rem;
  color: var(--text);
}

.form-control,
.form-select {
  font-size: 0.85rem;
  border-color: #dee2e6;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.2);
}

/* ── File Upload Zone ──────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--primary-light);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: rgba(216, 243, 220, 0.3);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(216, 243, 220, 0.6);
}

.upload-zone .upload-icon {
  font-size: 2rem;
  color: var(--primary-light);
}

/* ── Form Cards (staff view) ───────────────────────────────── */
.form-card {
  border-radius: 10px;
  border: 1px solid #e9ecef;
  background: #fff;
  transition: transform var(--transition), box-shadow var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.form-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

.form-card .card-body {
  flex: 1;
}

.form-card .form-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.form-card .form-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-dark);
  line-height: 1.4;
}

.form-card .form-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Breadcrumbs ───────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.78rem;
}

.breadcrumb-item.active {
  color: var(--text-muted);
}

.breadcrumb-item+.breadcrumb-item::before {
  color: var(--text-muted);
}

/* ── Version History ───────────────────────────────────────── */
.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--primary-xlight);
  color: var(--primary-dark);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}

.version-badge.current {
  background: var(--primary);
  color: #fff;
}

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  font-size: 0.85rem;
  border-radius: 8px;
}

.alert-success {
  border-left: 4px solid var(--primary);
}

.alert-danger {
  border-left: 4px solid #dc3545;
}

.alert-warning {
  border-left: 4px solid #ffc107;
}

.alert-info {
  border-left: 4px solid #0dcaf0;
}

/* ── Staff Top Nav ─────────────────────────────────────────── */
.staff-navbar {
  background: var(--primary);
  padding: 0.6rem 0;
}

.staff-navbar .navbar-brand {
  color: #fff !important;
  font-weight: 700;
  font-size: 1rem;
}

.staff-navbar .nav-link {
  color: rgba(255, 255, 255, 0.85) !important;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color var(--transition);
}

.staff-navbar .nav-link:hover,
.staff-navbar .nav-link.active {
  color: #fff !important;
}

.staff-navbar .nav-link.active {
  border-bottom: 2px solid rgba(255, 255, 255, 0.6);
}

/* ── Hero Search (staff dashboard) ────────────────────────── */
.hero-search {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: 12px;
  padding: 2rem;
  color: #fff;
  margin-bottom: 1.5rem;
}

.hero-search h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.hero-search p {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-bottom: 1rem;
}

.hero-search .search-input {
  border-radius: 8px 0 0 8px;
  border: none;
  font-size: 0.9rem;
}

.hero-search .search-btn {
  border-radius: 0 8px 8px 0;
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: #fff;
  font-weight: 600;
}

/* ── Category Chips ────────────────────────────────────────── */
.category-chip {
  display: inline-block;
  background: var(--primary-xlight);
  color: var(--primary-dark);
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.category-chip:hover,
.category-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── Scrollbar ─────────────────────────────────────────────── */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    /* Force full width on mobile when open */
  }

  .sidebar.show {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  }

  .sidebar.collapsed .brand-name,
  .sidebar.collapsed .brand-sub,
  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .sidebar-section-label,
  .sidebar.collapsed .nav-link span,
  .sidebar.collapsed .user-name,
  .sidebar.collapsed .user-role,
  .sidebar.collapsed .user-details {
    display: block;
  }

  .sidebar.collapsed .brand-logo-full {
    display: block;
  }

  .sidebar.collapsed .brand-logo-collapsed {
    display: none;
  }

  .sidebar.collapsed .brand-link {
    background: #ffffff;
    padding: 0.5rem 0.8rem;
  }

  .sidebar.collapsed .nav-link {
    justify-content: flex-start;
    padding: 0.6rem 1.2rem;
  }

  .sidebar.collapsed .nav-link i {
    font-size: 0.9rem;
    margin-right: 0.65rem;
  }

  .sidebar.collapsed .sidebar-footer {
    padding: 0.8rem 1.2rem;
    text-align: left;
  }

  .main-wrapper,
  .main-wrapper.collapsed {
    margin-left: 0;
  }

  .topbar-toggle {
    display: block;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1039;
  }

  .sidebar-overlay.show {
    display: block;
  }
}

@media (max-width: 575.98px) {
  .content-area {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-card .stat-value {
    font-size: 1.3rem;
  }
}

/* ── Utility ───────────────────────────────────────────────── */
.text-primary-custom {
  color: var(--primary) !important;
}

.bg-primary-custom {
  background: var(--primary) !important;
}

.fw-500 {
  font-weight: 500;
}

.fs-xs {
  font-size: 0.75rem;
}

.fs-sm {
  font-size: 0.83rem;
}

.gap-05 {
  gap: 0.5rem;
}

/* Smooth page load */
body {
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}