@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  /* Color Palette - Premium White Base Theme */
  --bg-base: #f3f6f5;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #fafcfb;
  --border-color: rgba(5, 150, 105, 0.15);
  --border-color-hover: rgba(217, 119, 6, 0.35);
  
  --text-primary: #121e1a;
  --text-secondary: #4a5c54;
  --text-muted: #7b8e85;

  /* Accents - Calibrated for Light Background contrast */
  --color-emerald: #059669;
  --color-emerald-glow: rgba(5, 150, 105, 0.08);
  --color-gold: #d97706;
  --color-gold-glow: rgba(217, 119, 6, 0.08);
  --color-danger: #dc2626;
  --color-danger-glow: rgba(220, 38, 38, 0.08);
  --color-info: #2563eb;

  /* Status Colors */
  --status-planned: #d97706;
  --status-live: #059669;
  --status-completed: #6b7280;

  /* Dimensions */
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 24px;
  --shadow-sm: 0 2px 8px rgba(18, 30, 26, 0.04);
  --shadow-md: 0 10px 35px rgba(18, 30, 26, 0.06);
  --shadow-lg: 0 20px 60px rgba(18, 30, 26, 0.12);
  --glass-blur: 16px;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: rgba(5, 150, 105, 0.18);
  border-radius: var(--border-radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(217, 119, 6, 0.35);
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(5, 150, 105, 0.03) 0%, transparent 45%),
    radial-gradient(circle at 90% 80%, rgba(217, 119, 6, 0.03) 0%, transparent 45%);
}

/* Header & Navigation */
header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

.nav-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.logo-block svg {
  border-radius: var(--border-radius-sm);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.05));
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--color-emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--color-gold) 0%, #d97706 100%);
  color: #ffffff;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  background: rgba(18, 30, 26, 0.04);
  border: 1px solid rgba(5, 150, 105, 0.08);
  padding: 0.25rem;
  border-radius: 30px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--color-emerald);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

/* User Role Toggler */
.role-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.role-badge.admin-active {
  border-color: var(--color-gold);
  background: rgba(217, 119, 6, 0.03);
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.05);
}

.role-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.role-badge.admin-active .role-dot {
  background: var(--color-gold);
  box-shadow: 0 0 8px var(--color-gold);
}

.role-badge.view-active .role-dot {
  background: var(--color-emerald);
  box-shadow: 0 0 8px var(--color-emerald);
}

/* Main Workspace */
main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Dashboard Analytics Grid */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(5, 150, 105, 0.35);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--color-emerald), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 700;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-footer {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Dashboard Section Layout */
.section-panel {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.section-panel.active {
  display: block;
}

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

/* Dashboard Layout Grid */
.dashboard-layout {
  display: block;
}

/* Form Validation Error Styles */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea,
.form-group.has-error .state-selector-wrapper {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15) !important;
}

.form-group.has-error label {
  color: #b91c1c !important;
}

.error-message {
  color: #dc2626;
  font-size: 0.75rem;
  margin-top: 0.35rem;
  display: block;
  font-weight: 500;
}

/* Cards & Containers */
.glass-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
}

.glass-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(18, 30, 26, 0.05);
  padding-bottom: 1rem;
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
}

.panel-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--color-emerald);
  border-radius: 2px;
}

/* Campaign Columns Grid */
.campaign-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.board-column {
  background: rgba(5, 150, 105, 0.02);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  border: 1px solid rgba(5, 150, 105, 0.06);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 500px;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(18, 30, 26, 0.05);
}

.column-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.column-count {
  background: rgba(18, 30, 26, 0.05);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  color: var(--text-secondary);
}

.column-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  overflow-y: auto;
}

/* Campaign Item Card (Tracker Grid) */
.campaign-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.campaign-card:hover {
  transform: translateY(-2px);
  border-color: rgba(5, 150, 105, 0.35);
  background: var(--bg-surface-elevated);
  box-shadow: var(--shadow-md);
}

.campaign-card.glowing-active {
  border-color: var(--color-emerald);
  box-shadow: 0 0 15px rgba(5, 150, 105, 0.12);
  background: rgba(5, 150, 105, 0.01);
}

.campaign-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.campaign-code {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--color-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-pill {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(18, 30, 26, 0.04);
  border: 1px solid rgba(18, 30, 26, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: 12px;
  color: var(--text-secondary);
}

.campaign-dates {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.campaign-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.audience-count {
  font-weight: 600;
  color: var(--color-emerald);
}

/* Floating Notification / Overlap Warning */
.overlap-warning-badge {
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.15);
  color: var(--color-danger);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  animation: pulseWarning 2s infinite ease-in-out;
}

@keyframes pulseWarning {
  0% { opacity: 0.95; border-color: rgba(220, 38, 38, 0.15); }
  50% { opacity: 1; border-color: rgba(220, 38, 38, 0.45); }
  100% { opacity: 0.95; border-color: rgba(220, 38, 38, 0.15); }
}

.overlap-indicator {
  display: flex;
  gap: 0.5rem;
  flex-direction: column;
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="email"],
select,
textarea {
  background: var(--bg-surface);
  border: 1px solid rgba(5, 150, 105, 0.25);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s ease;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-emerald);
  box-shadow: 0 0 10px rgba(5, 150, 105, 0.1);
  background: var(--bg-surface-elevated);
}

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

/* Readonly fields styling */
input:read-only {
  background: rgba(18, 30, 26, 0.03);
  border-color: rgba(18, 30, 26, 0.08);
  color: var(--text-secondary);
  cursor: not-allowed;
}

/* Suggested slot box */
.suggested-slot-box {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.suggested-slot-text {
  font-size: 0.75rem;
  color: #92400e;
  line-height: 1.4;
}

.suggested-slot-text strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.apply-slot-btn {
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.apply-slot-btn:hover {
  background: var(--color-gold);
  color: #ffffff;
}

/* Custom States Selector */
.state-selector-wrapper {
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: var(--border-radius-sm);
  background: var(--bg-surface-elevated);
  padding: 1rem;
}

.state-search {
  margin-bottom: 0.75rem;
}

.state-list-scroll {
  max-height: 160px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  padding: 0.25rem;
}

.state-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.state-checkbox-label:hover {
  color: var(--text-primary);
}

.state-checkbox-label input {
  accent-color: var(--color-emerald);
}

.selected-states-summary {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(18, 30, 26, 0.05);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.selected-states-count {
  font-weight: 600;
  color: var(--color-gold);
}

/* Button UI */
.primary-btn {
  background: var(--color-emerald);
  border: 1px solid var(--color-emerald);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
}

.primary-btn:hover {
  background: #047857;
  border-color: #047857;
  box-shadow: 0 4px 15px rgba(5, 150, 105, 0.25);
}

.secondary-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-sm);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.secondary-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: rgba(5, 150, 105, 0.35);
}

.text-danger {
  color: var(--color-danger) !important;
  border-color: rgba(220, 38, 38, 0.25) !important;
}

.text-danger:hover {
  background: rgba(220, 38, 38, 0.03) !important;
  border-color: var(--color-danger) !important;
}

/* Settings View: States List */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.state-settings-table-wrapper {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface);
}

.state-settings-table {
  width: 100%;
  border-collapse: collapse;
}

.state-settings-table th, 
.state-settings-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(18, 30, 26, 0.05);
  font-size: 0.9rem;
}

.state-settings-table th {
  background: var(--bg-base);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.state-settings-table td input {
  padding: 0.4rem 0.6rem;
  max-width: 160px;
}

/* Settings Edit Panel styles */
.settings-table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Backup and PIN card actions */
.settings-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Modals & Dialog System */
dialog {
  border: 1px solid rgba(5, 150, 105, 0.25);
  border-radius: var(--border-radius-lg);
  background: var(--bg-surface);
  padding: 2.25rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  margin: auto;
  outline: none;
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  max-height: 90vh;
  overflow-y: auto;
}

dialog::backdrop {
  background: rgba(18, 30, 26, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

@keyframes scaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(18, 30, 26, 0.05);
  padding-bottom: 0.75rem;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-primary);
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-modal-btn:hover {
  background: rgba(18, 30, 26, 0.04);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(18, 30, 26, 0.05);
}

/* Campaign details layout inside modal */
.details-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  font-weight: 600;
}

.detail-value {
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
}

.detail-value.code {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-gold);
}

.detail-value.creative-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.15);
  color: var(--color-info);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  width: max-content;
}

.states-badges-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.state-item-badge {
  background: rgba(5, 150, 105, 0.06);
  border: 1px solid rgba(5, 150, 105, 0.12);
  color: var(--color-emerald);
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Admin Lock Notification Overlay */
.admin-lock-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  gap: 1rem;
}

.admin-lock-icon {
  font-size: 3rem;
  color: var(--color-gold);
  animation: wobble 2.5s infinite ease-in-out;
}

@keyframes wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

.admin-lock-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.admin-lock-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 320px;
}

/* Excel Spreadsheet-style Table in Modal */
.performance-table-wrapper {
  overflow-x: auto;
  border: 1px solid #d1d5db;
  border-radius: var(--border-radius-sm);
  margin-top: 0.5rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.performance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: #ffffff;
}

.performance-table th {
  background: #3b82f6;
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  padding: 0.6rem 0.8rem;
  text-align: left;
  border: 1px solid #2563eb;
}

.performance-table td {
  padding: 0.55rem 0.8rem;
  border: 1px solid #e5e7eb;
  color: #374151;
}

.performance-table tr:nth-child(even) {
  background: #f9fafb;
}

.performance-table td.metric-name {
  font-weight: 600;
  color: #1f2937;
}

.performance-table td.highlight-count {
  font-weight: 700;
  color: #2563eb;
  text-align: right;
}

.performance-table td.highlight-pct {
  font-weight: 700;
  color: #059669;
  text-align: right;
}

.performance-table td.remark {
  color: #6b7280;
  font-size: 0.8rem;
}

.performance-table tr.total-row {
  background: #f3f4f6 !important;
  font-weight: 700;
}

.performance-table tr.total-row td {
  border-top: 2px solid #9ca3af;
  border-bottom: 2px solid #9ca3af;
  color: #111827;
}

/* Post Campaign Input Section */
.post-campaign-section {
  background: rgba(37, 99, 235, 0.03);
  border: 1px dashed rgba(37, 99, 235, 0.25);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
  margin-bottom: 1.25rem;
}

/* Analytics Dashboard Layout */
.analytics-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: var(--border-radius-md);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.analytics-filter-bar .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 160px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  min-height: 350px;
  display: flex;
  flex-direction: column;
}

.chart-container-canvas {
  position: relative;
  flex: 1;
  width: 100%;
  height: 280px;
}

.analytics-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface);
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
}

.analytics-table th, 
.analytics-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(18, 30, 26, 0.05);
  font-size: 0.85rem;
}

.analytics-table th {
  background: var(--bg-base);
  font-family: var(--font-heading);
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.analytics-table tbody tr {
  cursor: pointer;
  transition: background 0.2s ease;
}

.analytics-table tbody tr:hover {
  background: rgba(5, 150, 105, 0.03);
}

/* Fallback charts styling */
.chart-fallback-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
  border: 1px dashed rgba(5, 150, 105, 0.15);
  border-radius: var(--border-radius-md);
  background: rgba(5, 150, 105, 0.01);
}

/* Footer Section */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Mobile Responsiveness Overrides */
@media (max-width: 768px) {
  .nav-wrapper {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    align-items: center;
    text-align: center;
  }
  
  .logo-block {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  
  .logo-text {
    font-size: 1.3rem;
  }
  
  .logo-tag {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
  }
  
  .nav-controls {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
    align-items: center;
  }
  
  .nav-tabs {
    width: 100%;
    display: flex;
    justify-content: space-between;
    border-radius: 12px;
  }
  
  .tab-btn {
    flex: 1;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0.5rem 0.25rem;
    gap: 0.25rem;
    border-radius: 8px;
  }
  
  .role-badge {
    width: 100%;
    justify-content: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    border-radius: 10px;
  }
  
  main {
    padding: 1rem 0.75rem;
    gap: 1.25rem;
  }
  
  .analytics-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .kpi-card {
    padding: 1.25rem;
  }
  
  .kpi-card h3 {
    font-size: 1.75rem !important;
  }
  
  .analytics-filter-bar {
    padding: 1rem;
    gap: 0.75rem;
    flex-direction: column;
    align-items: stretch;
  }
  
  .analytics-filter-bar .form-group {
    width: 100%;
    min-width: 100%;
    margin-bottom: 0;
  }
  
  .analytics-filter-bar .form-group select,
  .analytics-filter-bar .form-group input {
    width: 100%;
  }
  
  .analytics-filter-bar button {
    width: 100%;
    justify-content: center;
    padding: 0.6rem;
  }
  
  dialog {
    padding: 1.25rem !important;
    width: 95% !important;
    max-width: 95% !important;
    margin: 20px auto !important;
  }
  
  .performance-table-wrapper {
    margin-top: 0.5rem;
  }
  
  .performance-table {
    font-size: 0.75rem;
  }
  
  .performance-table th, 
  .performance-table td {
    padding: 0.4rem 0.5rem;
  }
  
  .details-grid {
    gap: 1rem;
  }
  
  .form-row-2 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .glass-panel {
    padding: 1.25rem;
  }
  
  .panel-title {
    font-size: 1.1rem;
  }
}

/* ==========================================================================
   Print Stylesheet
   ========================================================================== */

#campaign-print-container {
  display: none;
}

@media print {
  /* Default A4 page settings */
  @page {
    size: A4 portrait;
    margin: 15mm;
  }
  
  /* Reset backgrounds and colors for clean printing */
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important; /* Override flex layouts for natural pagination */
    height: auto !important;
    min-height: 0 !important;
  }
  
  /* Hide UI elements by default */
  header,
  nav,
  .nav-controls,
  .analytics-filter-bar,
  .secondary-btn,
  .primary-btn,
  .role-badge,
  .admin-lock-overlay,
  .scheduler-panel-wrapper,
  .dashboard-layout,
  dialog,
  #campaign-print-container,
  main > .analytics-grid {
    display: none !important;
  }
  
  /* Display only the Analytics Panel during global reports print */
  .app-container {
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    display: block !important; /* Override flex layouts for natural pagination */
    height: auto !important;
    min-height: 0 !important;
  }
  
  main {
    padding: 0 !important;
    margin: 0 !important;
    display: block !important; /* Override flex layouts for natural pagination */
    height: auto !important;
    min-height: 0 !important;
  }
  
  #section-analytics {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
  }
  
  /* Restructure analytics layout for printing */
  .analytics-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 20px !important;
    page-break-inside: avoid !important;
  }
  
  .kpi-card {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    padding: 10px !important;
    background: #ffffff !important;
    page-break-inside: avoid !important;
  }
  
  .kpi-card::before {
    display: none !important;
  }
  
  .charts-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
    page-break-inside: avoid !important;
  }
  
  .chart-card {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    padding: 15px !important;
    background: #ffffff !important;
    page-break-inside: avoid !important;
  }
  
  .glass-panel {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    background: #ffffff !important;
    page-break-inside: auto !important; /* Allow the logs table to break across pages */
  }
  
  .analytics-table-wrapper {
    overflow: visible !important;
  }
  
  /* Prevent row splitting during printing */
  .analytics-table tr {
    page-break-inside: avoid !important;
  }
  
  .analytics-table th,
  .analytics-table td {
    border: 1px solid #dddddd !important;
    padding: 6px !important;
    font-size: 8pt !important;
  }
  
  /* If printing an individual campaign report */
  body.printing-campaign .app-container {
    display: none !important;
  }
  
  body.printing-campaign #campaign-print-container {
    display: block !important;
  }
  
  /* Campaign PDF Print Styles */
  .print-page {
    width: 100% !important;
    max-width: 100% !important;
    height: 262mm !important; /* Fitted for A4 with 15mm margins (297 - 30 = 267mm max) */
    box-sizing: border-box !important;
    page-break-after: always !important;
    padding: 0 !important;
    margin: 0 !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }
  
  .print-page:last-child {
    page-break-after: avoid !important;
  }
  
  .print-header {
    border-bottom: 3px solid #059669 !important;
    padding-bottom: 8px !important;
    margin-bottom: 15px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  
  .print-title {
    font-size: 18pt !important;
    font-weight: 800 !important;
    color: #111827 !important;
  }
  
  .print-subtitle {
    font-size: 9pt !important;
    color: #4b5563 !important;
  }
  
  .print-section-title {
    font-size: 11pt !important;
    font-weight: 700 !important;
    color: #059669 !important;
    margin-top: 10px !important;
    margin-bottom: 8px !important;
    border-bottom: 1px solid #e5e7eb !important;
    padding-bottom: 3px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
  }
  
  .print-meta-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-bottom: 15px !important;
  }
  
  .print-meta-item {
    border: 1px solid #e5e7eb !important;
    border-radius: 4px !important;
    padding: 8px !important;
    background: #f9fafb !important;
  }
  
  .print-meta-label {
    font-size: 7.5pt !important;
    color: #6b7280 !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
  }
  
  .print-meta-value {
    font-size: 10pt !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin-top: 2px !important;
  }
  
  .whatsapp-bubble-mockup {
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    background: #efeae2 !important;
    padding: 12px !important;
    margin-top: 5px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    max-width: 440px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
  }
  
  .whatsapp-message {
    background: #ffffff !important;
    border-radius: 7.5px !important;
    padding: 8px 10px !important;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.13) !important;
    font-size: 9pt !important;
    line-height: 1.35 !important;
    color: #111827 !important;
  }
  
  .whatsapp-creative-placeholder {
    width: 100% !important;
    height: 140px !important;
    background: #e1e7e4 !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #4b5563 !important;
    font-weight: 600 !important;
    font-size: 10pt !important;
    border: 1px dashed #9ca3af !important;
    margin-bottom: 6px !important;
  }
  
  .whatsapp-creative-image {
    width: 100% !important;
    max-height: 150px !important;
    border-radius: 6px !important;
    object-fit: contain !important;
    margin-bottom: 6px !important;
  }
  
  .print-footer {
    border-top: 1px solid #e5e7eb !important;
    padding-top: 6px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 7.5pt !important;
    color: #9ca3af !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
  }
  
  .print-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 12px !important;
  }
  
  .print-table th,
  .print-table td {
    border: 1px solid #d1d5db !important;
    padding: 5px 6px !important;
    font-size: 8.5pt !important;
  }
  
  .print-table th {
    background: #f3f4f6 !important;
    font-weight: 700 !important;
    text-align: left !important;
  }
  
  .print-table tr.highlight-row {
    background: #f0fdf4 !important;
    font-weight: 700 !important;
  }
  
  .print-table tr.total-row {
    background: #fef2f2 !important;
    font-weight: 700 !important;
  }
  
  .benchmark-card-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin-top: 8px !important;
  }
  
  .benchmark-card {
    border: 1px solid #e5e7eb !important;
    border-radius: 6px !important;
    padding: 10px !important;
    background: #ffffff !important;
  }
  
  .benchmark-title {
    font-size: 8.5pt !important;
    font-weight: 700 !important;
    color: #374151 !important;
    margin-bottom: 6px !important;
    border-bottom: 1.5px solid #d1d5db !important;
    padding-bottom: 3px !important;
  }
  
  .benchmark-row {
    display: flex !important;
    justify-content: space-between !important;
    font-size: 8pt !important;
    margin-bottom: 3px !important;
  }
  
  .benchmark-label {
    color: #4b5563 !important;
  }
  
  .benchmark-value {
    font-weight: 700 !important;
  }
  
  .benchmark-value.pos {
    color: #059669 !important;
  }
  
  .benchmark-value.neg {
    color: #dc2626 !important;
  }
}

/* ==========================================================================
   Global Login Overlay Styles
   ========================================================================== */

#global-login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(18, 30, 26, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  animation: fadeIn 0.4s ease-out forwards;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(5, 150, 105, 0.2);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  background: var(--bg-surface);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
  text-align: center;
}

.login-logo svg {
  margin-bottom: 0.75rem;
}

.login-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  margin-bottom: 0;
  line-height: 1.4;
}

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

#header-logout-btn:hover {
  background: rgba(220, 38, 38, 0.08) !important;
  border-color: rgba(220, 38, 38, 0.4) !important;
  color: #dc2626 !important;
}

