/* PB Nonprofit Portal - Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
  --red: #E31B23;
  --red-dark: #B81419;
  --red-light: #FF3D44;
  --black: #1A1A1A;
  --dark: #111111;
  --gray-900: #222222;
  --gray-800: #333333;
  --gray-700: #444444;
  --gray-600: #666666;
  --gray-500: #888888;
  --gray-400: #AAAAAA;
  --gray-300: #CCCCCC;
  --gray-200: #E5E5E5;
  --gray-100: #F5F5F5;
  --white: #FFFFFF;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Montserrat', sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  color: var(--black);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: 1px;
  line-height: 1.2;
}

a { color: var(--red); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--red-dark); }

img { max-width: 100%; height: auto; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--red);
  color: var(--white);
}
.btn-primary:hover { background: var(--red-dark); color: var(--white); }

.btn-secondary {
  background: var(--black);
  color: var(--white);
}
.btn-secondary:hover { background: var(--gray-800); color: var(--white); }

.btn-outline {
  background: transparent;
  color: var(--black);
  border: 2px solid var(--gray-300);
}
.btn-outline:hover { border-color: var(--red); color: var(--red); }

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--black);
  transition: var(--transition);
  background: var(--white);
}

.form-control:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(227, 27, 35, 0.1);
}

textarea.form-control { min-height: 100px; resize: vertical; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.form-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

.form-section-title {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--red);
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-200);
}

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  border: 1px solid var(--gray-200);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.card-header h3 {
  font-size: 20px;
  color: var(--black);
}

/* ===== STATS ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--gray-200);
  text-align: center;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--red);
  line-height: 1;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-prospect { background: #EEF2FF; color: #4F46E5; }
.badge-intake { background: #FFF7ED; color: #C2410C; }
.badge-discovery { background: #FFFBEB; color: #B45309; }
.badge-proposal { background: #F0FDF4; color: #15803D; }
.badge-active { background: #ECFDF5; color: #059669; }
.badge-completed { background: #F0F9FF; color: #0369A1; }
.badge-paid { background: #ECFDF5; color: #059669; }
.badge-unpaid { background: #FEF2F2; color: #DC2626; }
.badge-partial { background: #FFFBEB; color: #D97706; }
.badge-pending { background: var(--gray-100); color: var(--gray-600); }
.badge-submitted { background: #EEF2FF; color: #4F46E5; }
.badge-approved { background: #ECFDF5; color: #059669; }
.badge-delivered { background: #ECFDF5; color: #059669; }
.badge-in_progress { background: #FFF7ED; color: #C2410C; }
.badge-review { background: #FFFBEB; color: #B45309; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

table tr:hover { background: var(--gray-100); }
table tr { cursor: pointer; }

/* ===== PROGRESS BAR ===== */
.progress-bar {
  background: var(--gray-200);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: var(--red);
  border-radius: 20px;
  transition: width 0.5s ease;
}

.progress-label {
  font-size: 12px;
  color: var(--gray-600);
  margin-top: 4px;
}

/* ===== LAYOUT: PORTAL ===== */
.portal-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--dark);
  color: var(--white);
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--gray-800);
  margin-bottom: 16px;
}

.sidebar-logo h2 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--white);
}

.sidebar-logo .logo-accent { color: var(--red); }

.sidebar-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gray-500);
  padding: 16px 24px 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--gray-400);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.sidebar-nav a:hover { color: var(--white); background: rgba(255,255,255,0.05); }
.sidebar-nav a.active { color: var(--white); background: rgba(227, 27, 35, 0.15); border-left: 3px solid var(--red); }

.sidebar-nav a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.main-content {
  padding: 32px;
  background: var(--gray-100);
  overflow-y: auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 32px;
  color: var(--black);
}

/* ===== CHECKLIST ===== */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: var(--transition);
}

.checklist-item:hover { background: var(--gray-100); }

.checklist-item .check-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
}

.checklist-item.submitted .check-icon { border-color: var(--info); color: var(--info); }
.checklist-item.approved .check-icon { border-color: var(--success); background: var(--success); color: var(--white); }
.checklist-item.rejected .check-icon { border-color: var(--danger); color: var(--danger); }

.checklist-item .item-info { flex: 1; }
.checklist-item .item-name { font-weight: 600; font-size: 14px; }
.checklist-item .item-category {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--gray-500);
  letter-spacing: 0.5px;
}

.checklist-item .item-actions { display: flex; gap: 8px; }

/* ===== ACTIVITY LOG ===== */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-text { font-size: 14px; color: var(--gray-700); }
.activity-time { font-size: 12px; color: var(--gray-500); }

/* ===== MESSAGES ===== */
.message-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 16px;
}

.message-item {
  margin-bottom: 16px;
  max-width: 80%;
}

.message-item.admin { margin-left: auto; }

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.5;
}

.message-item.client .message-bubble {
  background: var(--gray-100);
  border-bottom-left-radius: 4px;
}

.message-item.admin .message-bubble {
  background: var(--red);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message-meta {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
}

.message-input {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-200);
}

.message-input input { flex: 1; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  transform: translateY(20px);
  transition: var(--transition);
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 { font-size: 28px; }

.modal-close {
  width: 32px; height: 32px;
  border: none; background: var(--gray-100);
  border-radius: 50%; cursor: pointer;
  font-size: 18px; color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
}

.modal-close:hover { background: var(--gray-200); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.7s;
  animation-fill-mode: forwards;
}

.toast-success { background: var(--success); color: var(--white); }
.toast-error { background: var(--danger); color: var(--white); }
.toast-info { background: var(--info); color: var(--white); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(100%); } }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  font-size: 36px;
  color: var(--black);
}

.login-logo .accent { color: var(--red); }

.login-logo p {
  color: var(--gray-500);
  font-size: 14px;
  margin-top: 4px;
}

/* ===== INTAKE FORM PAGE ===== */
.intake-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px;
}

.intake-header {
  text-align: center;
  margin-bottom: 40px;
}

.intake-header h1 {
  font-size: 42px;
  color: var(--black);
  margin-bottom: 8px;
}

.intake-header p {
  color: var(--gray-600);
  font-size: 16px;
}

.intake-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}

.intake-step {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--gray-200);
  transition: var(--transition);
}

.intake-step.active { background: var(--red); }
.intake-step.done { background: var(--success); }

.form-step { display: none; }
.form-step.active { display: block; }

.form-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-200);
}

/* ===== PUBLIC NAV ===== */
.public-nav {
  background: var(--dark);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.public-nav .logo {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--white);
}

.public-nav .logo .accent { color: var(--red); }

.public-nav .nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.public-nav .nav-links a {
  color: var(--gray-400);
  font-weight: 500;
  font-size: 14px;
}

.public-nav .nav-links a:hover { color: var(--white); }

.public-nav .nav-links .btn-primary {
  padding: 8px 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .portal-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -250px;
    width: 250px;
    z-index: 100;
    transition: var(--transition);
  }

  .sidebar.open { left: 0; }

  .main-content { padding: 16px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }

  .public-nav { padding: 12px 16px; }

  .login-card { padding: 32px 24px; margin: 16px; }

  .intake-page { padding: 24px 16px; }
}

/* ===== LOADING SPINNER ===== */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--gray-500);
  gap: 12px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { color: var(--gray-700); font-size: 20px; margin-bottom: 8px; }
