/* XChange Admin Styles (dashboard and shared admin UI)
   Depends on variables and base styles in ../styles.css */

/* Layout */
.admin-content {
  max-width: 1600px !important;
  margin: 0 auto;
  padding: 2rem 30px 60px 30px;
  min-height: calc(100vh - 140px);
}

/* Page Header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.page-title { font-size: 2rem; color: var(--slate-800); margin: 0; }
@media (max-width: 768px) { .page-header { flex-direction: column; gap: 1rem; align-items: stretch; } }

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid #001b42;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 27, 66, 0.03), transparent);
  transition: left 0.5s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 27, 66, 0.15);
  border-left-color: #003366;
}

.stat-card:hover::before {
  left: 100%;
}

.stat-card:hover .stat-number {
  transform: scale(1.05);
  color: #003366;
}

.stat-card:hover .stat-revenue {
  transform: scale(1.02);
  color: #1d4ed8; /* Slightly darker blue on hover */
}

/* Professional stat card colors */
.stat-card .stat-number {
  font-size: 2.2em;
  font-weight: 700;
  color: #001b42;
  margin: 0;
  transition: all 0.3s ease;
}

.stat-card .stat-revenue {
  font-size: 1.8em;
  font-weight: 600;
  color: #2563eb; /* Bright blue that stands out but complements navy */
  margin: 0;
  transition: all 0.3s ease;
}

.stat-card .stat-label {
  font-size: 0.9em;
  color: #718096;
  margin: 5px 0 0 0;
}

.stat-card .stat-breakdown {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
  margin-top: 15px;
  font-size: 0.85em;
  color: #4a5568;
}

.stat-card h3 {
  margin: 0 0 8px 0;
  color: var(--slate-600);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--slate-800);
  margin: 0;
}

.stat-card .stat-change {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 4px;
}

/* Data Table Card */
.data-table {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Chart Container */
.chart-container {
  padding: 24px;
  height: 400px;
  position: relative;
}

/* Chart Header with Time Range Selector */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 0 24px;
  border-bottom: 1px solid var(--slate-200);
  background: var(--slate-50);
}

.chart-header h2 {
  margin: 0;
  padding: 0 0 24px 0;
  color: var(--slate-800);
}

.time-range-selector {
  display: flex;
  gap: 4px;
  background: white;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.range-btn {
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-600);
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.range-btn:hover {
  background: var(--slate-100);
  color: var(--slate-800);
}

.range-btn.active {
  background: #001b42;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 27, 66, 0.2);
}

@media (max-width: 768px) {
  .chart-header {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  
  .time-range-selector {
    justify-content: center;
  }
  
  .range-btn {
    flex: 1;
    text-align: center;
  }
}

.data-table h2 {
  padding: 24px;
  margin: 0;
  border-bottom: 1px solid var(--slate-200);
  background: var(--slate-50);
}

.data-table-body {
  padding: 24px;
}

/* Table */
.table-container {
  overflow-x: auto;
}

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

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--slate-200);
}

.table th {
  background: var(--slate-50);
  font-weight: 600;
  color: var(--slate-700);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table td {
  color: var(--slate-600);
  font-size: 14px;
}

.table tbody tr:hover {
  background: #ededed;
}

/* Responsive table tweaks */
@media (max-width: 768px) {
  .table { font-size: 0.875rem; }
  .table th,
  .table td { padding: 8px; }
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pending { background: var(--orange-100); color: var(--orange-700); }
.status-paid    { background: var(--green-100);  color: var(--green-700); }
.status-failed  { background: var(--red-100);    color: var(--red-700); }
.status-expired { background: var(--slate-100);  color: var(--slate-700); }
.status-cancelled { background: var(--red-50); color: var(--red-600); border: 1px solid var(--red-200); }

/* Generic badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-success { background: var(--green-100); color: var(--green-700); }
.badge-danger  { background: var(--red-100);   color: var(--red-700); }
.badge-primary { background: var(--indigo-100); color: var(--indigo-700); }
.badge-warning { background: var(--orange-100); color: var(--orange-700); }
.badge-secondary { background: var(--slate-200); color: var(--slate-700); }
/* Blue/info badge variant */
.badge-info { background: var(--blue-100); color: var(--blue-700); }

/* Payment method badge */
.method-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--purple-100);
  color: var(--purple-700);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

/* Utilities */
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 14px; }

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Table action buttons */
.table-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-start;
}

.table-actions .btn {
  min-width: 32px;
  padding: 6px 8px;
  font-size: 12px;
  color: #1f2937 !important;
}

.table-actions .btn:hover {
  color: #111827 !important;
}

.link {
  color: var(--indigo-600);
  text-decoration: none;
}
.link:hover { text-decoration: underline; }

/* Small utilities used across admin pages */
.link-strong { font-weight: 600; }
.text-xs { font-size: 12px; }
.text-xxs { font-size: 11px; }
.muted { color: var(--slate-500); }
.text-red-600 { color: var(--red-600); }
.text-red-500 { color: var(--red-500); }
.text-slate-600 { color: var(--slate-600); }
.btn-compact { font-size: 12px; padding: 4px 8px; min-height: 0; }
.badge-type { background: var(--indigo-100); color: var(--indigo-700); }
.empty-state { text-align: center; padding: 40px; }
/* Extra utilities */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-32 { margin-top: 32px; }
.ml-3 { margin-left: 12px; }
.break-all { word-break: break-all; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn svg { flex-shrink: 0; }
.btn-primary { background: var(--indigo-600); color: white; }
.btn-primary:hover { background: var(--indigo-700); transform: translateY(-1px); }
.btn-secondary { background: var(--slate-100); color: var(--slate-900); border: 1px solid var(--slate-300); }
.btn-secondary:hover { background: var(--slate-200); color: var(--slate-900); }
/* Additional button variants */
.btn-sm { padding: 8px 12px; font-size: 12px; }
.btn-success { background: var(--green-600); color: white; }
.btn-success:hover { background: var(--green-700); transform: translateY(-1px); }
.btn-warning { background: var(--orange-600); color: white; }
.btn-warning:hover { background: var(--orange-700); transform: translateY(-1px); }
.btn-danger { background: var(--red-600); color: white; }
.btn-danger:hover { background: var(--red-700); transform: translateY(-1px); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--slate-800); }
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.form-control[readonly] { background: var(--slate-50); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .form-row { grid-template-columns: 1fr; } }
.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-group .form-label { margin: 0; }
.form-actions { display: flex; gap: 16px; justify-content: flex-end; margin-top: 24px; }

/* Filters */
.filters {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.filter-form { width: 100%; }

.filter-row {
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}

.filter-field {
  display: flex;
  flex-direction: column;
  min-width: 200px;
  flex: 1;
}

.filter-field:first-child {
  flex: 2;
  min-width: 300px;
}

.filter-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
  display: block;
}

.filter-input {
  padding: 10px 12px;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  font-size: 14px;
  background: white;
  transition: all 0.2s;
  height: 42px;
}

.filter-input:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-shrink: 0;
}

.filters .btn { height: 42px; }

@media (max-width: 768px) {
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-field { min-width: unset; }
  .filter-actions { justify-content: stretch; }
  .filters .btn { flex: 1; justify-content: center; }
}

/* Settings: tabs, grid, cards */
.settings-tabs { display: flex; background: white; border-radius: 12px 12px 0 0; box-shadow: var(--shadow); margin-bottom: 0; }
.tab-button { padding: 16px 24px; background: none; border: none; cursor: pointer; color: var(--slate-600); font-weight: 600; border-bottom: 3px solid transparent; transition: all 0.2s; }
.tab-button:hover { background: var(--slate-50); color: var(--slate-800); }
.tab-button.active { color: var(--indigo-600); border-bottom-color: var(--indigo-500); background: var(--indigo-50); }
.tab-content { background: white; border-radius: 0 0 12px 12px; box-shadow: var(--shadow); padding: 32px; margin-bottom: 24px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.settings-card { background: var(--slate-50); padding: 24px; border-radius: 12px; border: 1px solid var(--slate-200); }
.settings-card h3 { margin: 0 0 16px 0; color: var(--slate-800); border-bottom: 2px solid var(--indigo-500); padding-bottom: 8px; }

.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--slate-200); }
.setting-row:last-child { border-bottom: none; }

.setting-info h4 { margin: 0 0 4px 0; color: var(--slate-800); font-size: 16px; }
.setting-info p { margin: 0; color: var(--slate-500); font-size: 14px; }

.setting-control { display: flex; gap: 8px; align-items: center; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 60px; height: 34px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--slate-300); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--indigo-500); }
input:checked + .slider:before { transform: translateX(26px); }

/* Status indicators */
.status-indicator { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; font-size: 14px; font-weight: 600; }
.status-active { background: var(--green-100); color: var(--green-700); }
.status-inactive { background: var(--slate-100); color: var(--slate-600); }

/* Section titles */
.section-title { margin: 0 0 24px 0; }

/* Breadcrumb */
.breadcrumb { margin-bottom: 24px; font-size: 14px; color: var(--slate-500); }
.breadcrumb a { color: var(--indigo-600); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* Registration Details layout */
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
@media (max-width: 768px) { .details-grid { grid-template-columns: 1fr; } }
.details-card { background: white; padding: 24px; border-radius: 12px; box-shadow: var(--shadow); }
.details-card h3 { margin: 0 0 16px 0; color: var(--slate-800); border-bottom: 2px solid var(--indigo-500); padding-bottom: 8px; }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--slate-100); }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-weight: 600; color: var(--slate-600); }
.detail-value { color: var(--slate-800); }

/* Delegates and payment tables wrappers */
.delegates-table { background: white; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 24px; }
.delegates-table h3 { padding: 24px; margin: 0; border-bottom: 1px solid var(--slate-200); background: var(--slate-50); }

/* Email History Styles */
.email-history-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.email-history-item {
    padding: 15px;
    border-bottom: 1px solid #f3f4f6;
    background: white;
}

.email-history-item:last-child {
    border-bottom: none;
}

.email-history-item:hover {
    background: #f9fafb;
}

.email-history-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.email-type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #e0f2fe;
    color: #0284c7;
}

.email-date {
    font-size: 0.75rem;
    color: #6b7280;
    margin-left: auto;
}

.email-subject {
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.email-recipient {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 4px;
}

.email-error {
    font-size: 0.75rem;
    color: #dc2626;
    background: #fef2f2;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #fecaca;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
} 
.modal-content { background: white; margin: 5% auto; padding: 24px; border-radius: 12px; max-width: 500px; width: 90%; position: relative; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { margin: 0; color: var(--slate-800); }
.close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--slate-400); }
.close:hover { color: var(--slate-700); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
}

.pagination a,
.pagination span {
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--slate-600);
  border: 1px solid var(--slate-200);
}

.pagination a:hover { background: var(--slate-100); }
.pagination .current { background: var(--indigo-500); color: white; border-color: var(--indigo-500); }

/* Summary Cards (Delegates dietary overview) */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: white;
  padding: 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--green-500);
}

.summary-card h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-card .count {
  font-size: 18px;
  font-weight: 700;
  color: var(--slate-800);
}

.summary-card .amount {
  font-size: 24px;
  font-weight: 800;
  color: var(--slate-800);
  margin: 4px 0;
}

/* Payments summary grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.summary-grid .summary-card .count {
  font-size: 14px;
  color: var(--slate-500);
  font-weight: 600;
}

/* Admin Navigation (from includes/admin_nav.php) */
.admin-top-bar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1600px !important;
  margin: 0 auto;
  padding: 0 30px;
}

.admin-logo {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.user-role-badge {
  background: rgba(255,255,255,0.2);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.logout-btn {
  color: white;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background-color 0.2s;
  border: 1px solid rgba(255,255,255,0.3);
}

.logout-btn:hover {
  background: rgba(255,255,255,0.1);
}

.admin-nav-bar {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.admin-nav-container {
  max-width: 1600px !important;
  margin: 0 auto;
  padding: 0 30px;
}

.main-nav {
  display: flex;
  gap: 0;
}

.nav-link {
  color: #64748b;
  text-decoration: none;
  padding: 16px 20px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  position: relative;
}

.nav-link:hover {
  color: #334155;
  background: #f8fafc;
}

.nav-link.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  background: #eff6ff;
}

@media (max-width: 768px) {
  .admin-top-nav { padding: 0 15px; }
  .admin-logo { font-size: 1.3rem; }
  .user-info { gap: 8px; }
  .user-name { display: none; }
  .main-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav-link { white-space: nowrap; padding: 16px 16px; font-size: 0.9rem; }
  .admin-nav-container { padding: 0 15px; }
}

/* Dashboard-specific utility classes */
.stat-layout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 15px 0;
}

.stat-right-align {
  text-align: right;
}

/* Chart and data table styles */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.time-range-selector {
  display: flex;
  gap: 8px;
}

.range-btn {
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-decoration: none;
  color: #64748b;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.range-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.range-btn.active {
  background: #001b42;
  color: white;
  border-color: #001b42;
}

.chart-container {
  position: relative;
  height: 300px;
  margin: 20px 0;
}

/* Table styles */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

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

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.table th {
  background: #f8fafc;
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
}

.table td {
  color: #4b5563;
}

/* Status badges */
.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-paid {
  background: #dcfce7;
  color: #166534;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-cancelled {
  background: #fee2e2;
  color: #dc2626;
}

.status-failed {
  background: #fef2f2;
  color: #991b1b;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .chart-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .time-range-selector {
    justify-content: center;
  }
  
  .stat-layout {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .stat-right-align {
    text-align: center;
  }
}
