/* CSS Variables */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 2rem 0;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.header h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.header .tagline { opacity: 0.9; font-size: 1.1rem; }
.header-nav { display: flex; justify-content: space-between; align-items: center; }
.header-nav h1 { font-size: 1.5rem; margin: 0; }

/* Detail Header */
.header-detail { text-align: left; padding: 1.5rem 0; }
.header-detail .container { display: flex; flex-direction: column; gap: 0.5rem; }
.header-detail h1 { font-size: 1.75rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1.2rem; border: none; border-radius: 8px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
  text-decoration: none;
}
.btn-back { background: rgba(255,255,255,0.2); color: white; align-self: flex-start; }
.btn-back:hover { background: rgba(255,255,255,0.3); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-outline { background: transparent; border: 2px solid white; color: white; }

/* Stats Bar */
.stats-bar {
  display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
  margin: -1.5rem auto 2rem; position: relative; z-index: 10;
}
.stat-card {
  background: white; padding: 1rem 2rem; border-radius: var(--radius);
  box-shadow: var(--shadow); text-align: center; min-width: 150px;
}
.stat-card .value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 0.85rem; color: var(--gray-600); }

/* Campaigns Grid */
.campaigns-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem; padding-bottom: 2rem;
}

/* Compact Card */
.campaign-card-compact {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
  display: flex; flex-direction: column; gap: 1rem;
}
.campaign-card-compact:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-header { display: flex; flex-direction: column; gap: 0.5rem; }
.card-header .campaign-title { font-size: 1.2rem; font-weight: 700; color: var(--gray-900); }
.card-progress { display: flex; flex-direction: column; gap: 0.5rem; }
.progress-stats { display: flex; justify-content: space-between; font-size: 0.95rem; }
.progress-stats .collected { font-weight: 700; color: var(--primary); }
.progress-stats .percentage { font-weight: 600; color: var(--success); }
.card-progress .progress-target { font-size: 0.85rem; color: var(--gray-600); }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.8rem; color: var(--gray-600); }
.card-action { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--gray-200); }
.view-details { color: var(--primary); font-weight: 600; font-size: 0.9rem; }

/* Campaign Status */
.campaign-status {
  display: inline-block; padding: 0.25rem 0.75rem; border-radius: 50px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; width: fit-content;
}
.campaign-status.active { background: #dcfce7; color: #166534; }
.campaign-status.completed { background: #dbeafe; color: #1e40af; }
.campaign-status.closed { background: var(--gray-200); color: var(--gray-600); }

/* Progress Bar */
.progress-bar { height: 12px; background: var(--gray-200); border-radius: 50px; overflow: hidden; }
.progress-bar.large { height: 16px; }
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--success) 0%, #34d399 100%);
  border-radius: 50px; transition: width 0.5s ease;
}

/* Detail Progress */
.detail-progress {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2rem; margin-top: -1.5rem; position: relative; z-index: 10;
}
.progress-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; }
.progress-amount .collected { font-size: 2rem; font-weight: 700; color: var(--primary); display: block; }
.progress-amount .target { font-size: 0.95rem; color: var(--gray-600); }
.progress-header .progress-percentage { font-size: 2rem; font-weight: 700; color: var(--success); }
.progress-meta {
  display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 1.5rem;
  padding-top: 1.5rem; border-top: 1px solid var(--gray-200);
  font-size: 0.9rem; color: var(--gray-600);
}

/* Donations Section */
.donations-section { padding: 2rem 0; }
.section-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--gray-800); }
.batch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.batch-card {
  background: white; border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow); border: 1px solid var(--gray-200);
}
.batch-name {
  font-weight: 700; color: var(--primary); margin-bottom: 0.75rem;
  padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary); font-size: 1.1rem;
}
.batch-donations { list-style: none; }
.batch-donations li {
  display: flex; justify-content: space-between; padding: 0.4rem 0;
  font-size: 0.9rem; border-bottom: 1px dashed var(--gray-200);
}
.batch-donations li:last-child { border-bottom: none; }
.donation-serial { color: var(--gray-600); }
.donation-amount { font-weight: 600; color: var(--gray-800); }
.donor-name { font-size: 0.8rem; color: var(--gray-500); }
.batch-subtotal {
  margin-top: 0.75rem; padding-top: 0.75rem; border-top: 2px solid var(--gray-300);
  display: flex; justify-content: space-between; font-weight: 700;
}
.batch-subtotal .amount { color: var(--success); }

/* Total Section */
.total-section {
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white; display: flex; justify-content: space-between; align-items: center;
  border-radius: var(--radius); margin-top: 1rem;
}
.total-label { font-size: 1.1rem; font-weight: 600; }
.total-amount { font-size: 1.75rem; font-weight: 700; }

/* Share Section */
.share-section {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; margin-top: 1.5rem;
}
.share-section h3 { margin-bottom: 1rem; color: var(--gray-800); }
.share-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.share-preview { margin-top: 1rem; text-align: center; }
.share-preview img { max-width: 300px; border-radius: 8px; box-shadow: var(--shadow); }

/* Footer */
.footer {
  background: var(--gray-800); color: var(--gray-300);
  padding: 1.5rem 0; text-align: center; margin-top: 2rem;
}

/* Empty State */
.empty-state {
  text-align: center; padding: 4rem 2rem; color: var(--gray-600);
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
}
.empty-state h2 { margin-bottom: 0.5rem; }

/* Login Page */
.login-container {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.login-box {
  background: white; padding: 2.5rem; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; margin: 1rem;
}
.login-box h1 { text-align: center; color: var(--gray-800); margin-bottom: 0.5rem; font-size: 1.5rem; }
.login-box .subtitle { text-align: center; color: var(--gray-600); margin-bottom: 2rem; font-size: 0.9rem; }
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--gray-700); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.75rem 1rem; border: 2px solid var(--gray-200);
  border-radius: 8px; font-size: 1rem; transition: border-color 0.2s;
}
.form-group input:focus { outline: none; border-color: var(--primary); }
.error-message {
  background: #fef2f2; color: var(--danger); padding: 0.75rem 1rem;
  border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; display: none;
}
.error-message.show { display: block; }

/* Admin Styles */
.admin-header { background: var(--gray-800); color: white; padding: 1rem 0; }
.admin-header .container { display: flex; justify-content: space-between; align-items: center; }
.admin-header h1 { font-size: 1.25rem; }
.admin-nav { display: flex; gap: 1rem; align-items: center; }
.admin-nav a { color: var(--gray-300); text-decoration: none; font-size: 0.9rem; }
.admin-nav a:hover { color: white; }
.admin-main { padding: 2rem 0; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.toolbar-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.campaign-list { display: flex; flex-direction: column; gap: 1rem; }
.campaign-item {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
}
.campaign-item-info { flex: 1; }
.campaign-item-info h3 { color: var(--gray-800); margin-bottom: 0.25rem; }
.campaign-item-info p { color: var(--gray-600); font-size: 0.9rem; }
.campaign-item-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* 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; padding: 1rem;
}
.modal {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto;
}
.modal-header {
  padding: 1.5rem; border-bottom: 1px solid var(--gray-200);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { color: var(--gray-800); font-size: 1.25rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-600); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1.5rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 0.75rem; }

/* Toast */
.toast {
  position: fixed; bottom: 2rem; right: 2rem; padding: 1rem 1.5rem;
  border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 1001;
  animation: slideIn 0.3s ease;
}
.toast.success { background: var(--success); color: white; }
.toast.error { background: var(--danger); color: white; }
@keyframes slideIn { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Role Badge */
.role-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.role-badge.admin { background: #fee2e2; color: #dc2626; }
.role-badge.manager { background: #fef3c7; color: #d97706; }
.role-badge.staff { background: #dbeafe; color: #2563eb; }

/* Table Styles */
table { border-collapse: collapse; }
table th, table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--gray-200); }
table tbody tr:hover { background: var(--gray-50); }

/* Share Section */
.share-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.share-section h3 { margin-bottom: 1rem; color: var(--gray-700); }
.share-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.share-quote {
  font-size: 1.25rem;
  font-style: italic;
  color: var(--primary);
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: 8px;
  border-left: 4px solid var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
  .header h1 { font-size: 1.5rem; }
  .header-detail h1 { font-size: 1.3rem; }
  .stats-bar { flex-direction: column; align-items: center; }
  .stat-card { width: 100%; max-width: 300px; }
  .campaigns-grid { grid-template-columns: 1fr; }
  .batch-grid { grid-template-columns: 1fr; }
  .total-section { flex-direction: column; gap: 0.5rem; text-align: center; }
  .progress-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .admin-header .container { flex-direction: column; gap: 1rem; }
  .admin-toolbar { flex-direction: column; align-items: stretch; }
  table { font-size: 0.85rem; }
  table th, table td { padding: 0.5rem; }
}

/* Animation */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.campaign-card-compact, .detail-progress, .batch-card { animation: fadeIn 0.3s ease; }
