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

:root {
  /* Much lighter blue theme */
  --bg-primary: #bfdbfe;
  --bg-secondary: #93c5fd;
  --bg-gradient: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 40%, #93c5fd 100%);
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(59, 130, 246, 0.25);
  --text-primary: #1e40af;
  --text-secondary: #1e3a8a;
  --text-muted: #3b82f6;
  --brand-primary: #3b82f6;
  --brand-gradient: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  --brand-glow: rgba(59, 130, 246, 0.3);
  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;
  --accent-pink: #db2777;
  --danger: #dc2626;
  --danger-glow: rgba(220, 38, 38, 0.2);
  --success: #16a34a;
  --shadow-sm: 0 2px 4px rgba(59, 130, 246, 0.1);
  --shadow-md: 0 4px 12px rgba(59, 130, 246, 0.15);
  --shadow-lg: 0 10px 30px rgba(59, 130, 246, 0.2);
  --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.25);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Main content area */
main.container {
  padding-top: 24px;
  padding-bottom: 24px;
}

/* Header Styles */
header.container {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 24px;
  backdrop-filter: blur(12px);
  background: rgba(219, 234, 254, 0.95);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.header-branding {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo {
  height: 52px;
  width: auto;
  margin-right: -8px;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.brand {
  font-weight: 800;
  font-size: 32px;
  color: #1e40af;
  letter-spacing: -0.5px;
  transition: transform 0.3s ease;
  white-space: nowrap;
}

.tagline {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.4;
}

.attention-ripple {
  position: relative;
  display: inline-block;
  background: linear-gradient(120deg, var(--brand-primary), var(--accent-purple), var(--accent-pink), var(--brand-primary));
  background-size: 220% 220%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: rippleSweep 2.4s ease;
  text-shadow: 0 4px 24px var(--brand-glow);
}

@keyframes rippleSweep {
  0% { background-position: 0% 50%; filter: drop-shadow(0 0 0 var(--brand-glow)); }
  50% { background-position: 100% 50%; filter: drop-shadow(0 8px 18px var(--brand-glow)); }
  100% { background-position: 0% 50%; filter: drop-shadow(0 0 0 var(--brand-glow)); }
}

.brand:hover {
  transform: scale(1.05);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  flex: 1;
  justify-content: flex-end;
}

.header-actions .search {
  margin-left: 0;
  flex: 1;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.3s ease;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 999px;
  transition: all 0.3s ease;
}

.menu-toggle span + span {
  margin-top: 4px;
}

.menu-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow), var(--shadow-md);
}

/* Search Bar */
.search {
  margin-left: auto;
  display: flex;
  gap: 12px;
  align-items: center;
}

.search input {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 18px;
  color: var(--text-primary);
  min-width: 300px;
  font-size: 15px;
  transition: all 0.3s ease;
  outline: none;
}

.search input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: #ffffff;
}

.search input::placeholder {
  color: var(--text-muted);
}

/* Numeric inputs (e.g., filters) */
input[type="number"] {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

input[type="number"]:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px var(--brand-glow);
  background: #ffffff;
}

input[type="number"]::placeholder {
  color: var(--text-muted);
}

/* Buttons */
button, .btn {
  background: var(--brand-gradient);
  border: none;
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

button:hover, .btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow), var(--shadow-md);
  text-decoration: none;
}

button:active, .btn:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.danger {
  background: var(--danger);
  box-shadow: var(--shadow-sm);
}

.btn.danger:hover {
  box-shadow: 0 0 20px var(--danger-glow), var(--shadow-md);
}

.btn.success {
  background: var(--success);
  box-shadow: var(--shadow-sm);
}

.btn.success:hover {
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3), var(--shadow-md);
}

/* Auth Area */
.auth {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  border: 1px solid var(--card-border);
}

/* Theme Selector */
.theme-selector {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
  font-weight: 500;
}

.theme-selector:hover {
  border-color: var(--brand-primary);
  background: #ffffff;
}

/* Cards */
main .card, .modal-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 32px;
  margin: 32px 0;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  animation: fadeIn 0.5s ease;
}

main .card:first-child {
  margin-top: 32px;
}

main .card:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

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

/* Card Headers */
.card h2, .modal-card h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Bar (flex container for headers) */
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* Form Inputs */
input[type="text"],
input[type="password"],
input[type="file"] {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 18px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.3s ease;
  outline: none;
  min-width: 250px;
  margin-right: 12px;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: #ffffff;
}

input[type="file"] {
  padding: 10px;
  cursor: pointer;
}

/* Style the "Choose Files" button */
input[type="file"]::file-selector-button {
  background: var(--brand-gradient);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 12px;
}

input[type="file"]::file-selector-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow), var(--shadow-md);
}

/* Select */
select {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
}

select:hover {
  border-color: var(--brand-primary);
}

/* Label */
label {
  color: var(--text-secondary);
  font-weight: 500;
  margin-right: 8px;
}

/* Code blocks */
code {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--card-border);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--text-primary);
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 14px;
}

pre {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
  line-height: 1.6;
}

/* Text Utilities */
.muted {
  color: var(--text-muted);
}

/* Article List */
.list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Article Row/Card */
.row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 24px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-gradient);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.row:hover {
  border-color: rgba(147, 197, 253, 0.5);
  background: rgba(59, 130, 246, 0.3);
  transform: translateX(8px);
  box-shadow: var(--shadow-md);
}

.row:hover::before {
  transform: scaleY(1);
}

.row .grow {
  flex: 1;
  min-width: 0;
}

.row h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.row h3 a {
  color: inherit;
  text-decoration: none;
  transition: all 0.3s ease;
}

.row h3 a:hover {
  color: var(--accent-blue);
  text-decoration: none;
}

.row p {
  margin: 8px 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.row .right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Checkbox Styling */
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--brand-primary);
}

/* Topic Chips */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 20px;
  color: var(--accent-blue);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.chip:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

/* Badge for blocked status */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 12px;
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.success {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}

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

.page-btn {
  background: rgba(59, 130, 246, 0.25);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  min-width: 44px;
  text-align: center;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--brand-primary);
  background: rgba(96, 165, 250, 0.35);
  transform: translateY(-2px);
}

.page-btn.active {
  background: var(--brand-gradient);
  color: white;
  border-color: transparent;
  cursor: default;
  box-shadow: var(--shadow-glow);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ellipsis {
  color: var(--text-muted);
  padding: 8px;
  font-weight: 500;
}

/* Upload Result */
#uploadResult {
  margin-top: 20px;
  padding: 16px;
  background: rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

/* Footer */
.foot {
  border-top: 1px solid var(--card-border);
  margin-top: 48px;
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Links */
a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

/* Empty State */
.list p.muted {
  text-align: center;
  padding: 48px 24px;
  font-size: 18px;
  color: var(--text-muted);
}

/* Document Viewer */
.viewer {
  margin-top: 24px;
}

.viewer iframe {
  width: 100%;
  height: 85vh;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow-lg);
}

/* Viewer Navigation Buttons */
.viewer .bar {
  margin-bottom: 24px;
  padding-top: 8px;
}

.viewer .btn {
  margin-right: 8px;
}

/* Security section */
.security-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  transition: all 0.3s ease;
  font-size: 14px;
}

.security-row:hover {
  border-color: rgba(147, 197, 253, 0.5);
  background: rgba(59, 130, 246, 0.3);
}

.security-row .ip {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 15px;
}

.security-row .details {
  color: var(--text-secondary);
  line-height: 1.4;
}

.security-row .details span {
  display: block;
}

/* Table for security data */
.security-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.security-table th {
  background: rgba(59, 130, 246, 0.25);
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--card-border);
}

.security-table td {
  padding: 12px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-secondary);
}

.security-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.2);
}

.security-table code {
  font-size: 13px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  header.container {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .header-top {
    width: 100%;
    gap: 12px;
    align-items: flex-start;
  }

  .header-branding {
    align-items: flex-start;
  }
  
  .logo {
    height: 40px;
  }
  
  .brand {
    font-size: 24px;
  }
  
  .tagline {
    font-size: 13px;
    margin-left: 0;
    text-align: left;
  }

  .header-actions {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-left: 0;
    width: 100%;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
  }

  header.container.menu-open .header-actions {
    display: flex;
  }

  .header-actions .search {
    width: 100%;
  }
  
  .menu-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .search {
    width: 100%;
    margin-left: 0;
  }
  
  .search input {
    min-width: 0;
    width: 100%;
  }
  
  .header-controls {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .header-controls select,
  .header-controls button {
    width: 100%;
  }
  
  main .card, .modal-card {
    padding: 20px;
    margin: 16px 0;
    border-radius: 16px;
  }
  
  .card h2, .modal-card h2 {
    font-size: 22px;
  }
  
  .row {
    flex-direction: column;
    gap: 16px;
  }
  
  .row h3 {
    font-size: 18px;
  }
  
  .row .right {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  
  .bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  input[type="text"],
  input[type="password"],
  input[type="file"] {
    width: 100%;
    min-width: 0;
    margin-right: 0;
    margin-bottom: 12px;
  }
  
  button, .btn {
    width: 100%;
    padding: 12px 20px;
  }
  
  .modal-card {
    max-width: 95%;
    padding: 20px;
    margin: 8px;
  }
  
  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .modal-actions button {
    width: 100%;
  }
  
  .chips {
    gap: 6px;
  }
  
  .chip {
    font-size: 12px;
    padding: 4px 10px;
  }
  
  .pagination {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .page-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .security-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .security-table {
    font-size: 13px;
    display: block;
    overflow-x: auto;
  }

  .security-table th,
  .security-table td {
    padding: 8px;
  }
  
  form {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  form button[type="submit"] {
    margin-top: 8px;
  }
  
  /* Analytics mobile styles */
  .analytics-summary {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .stat-label {
    font-size: 12px;
  }
  
  .analytics-table {
    font-size: 13px;
    display: block;
    overflow-x: auto;
  }
  
  .analytics-table th,
  .analytics-table td {
    padding: 8px;
  }
  
  #visitsChart {
    max-height: 200px;
  }
}

/* ===================================
   THEME VARIATIONS
   =================================== */

/* Grey Theme */
body.theme-grey {
  --bg-primary: #f3f4f6;
  --bg-secondary: #d1d5db;
  --bg-gradient: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 40%, #d1d5db 100%);
  --card-bg: #ffffff;
  --card-border: #d1d5db;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --brand-primary: #9ca3af;
  --brand-gradient: linear-gradient(135deg, #9ca3af 0%, #e5e7eb 100%);
  --brand-glow: rgba(156, 163, 175, 0.55);
  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;
  --accent-pink: #db2777;
  --danger: #b91c1c;
  --danger-glow: rgba(185, 28, 28, 0.2);
  --success: #15803d;
  --shadow-sm: 0 2px 4px rgba(148, 163, 184, 0.45);
  --shadow-md: 0 4px 12px rgba(148, 163, 184, 0.7);
  --shadow-lg: 0 12px 32px rgba(148, 163, 184, 0.8);
  --shadow-glow: 0 0 26px rgba(148, 163, 184, 0.9);
}

body.theme-grey header.container {
  background: #e5e7eb;
  color: #111827;
  box-shadow: 0 3px 12px rgba(148, 163, 184, 0.9);
}

body.theme-grey .brand {
  color: #111827;
}

body.theme-grey .search input {
  background: #f9fafb;
  color: #111827;
}

body.theme-grey .search input:focus {
  background: #ffffff;
  border-color: #9ca3af;
}

body.theme-grey button, body.theme-grey .btn {
  background: linear-gradient(135deg, #6b7280 0%, #d1d5db 100%);
  color: #111827;
}

body.theme-grey input[type="text"],
body.theme-grey input[type="password"],
body.theme-grey input[type="number"],
body.theme-grey select {
  background: #f9fafb;
  color: #111827;
}

body.theme-grey input[type="text"]:focus,
body.theme-grey input[type="password"]:focus {
  background: #ffffff;
}

body.theme-grey .row {
  background: #f3f4f6;
}

body.theme-grey .row:hover {
  background: #e5e7eb;
}

body.theme-grey .chip {
  background: #e5e7eb;
  border-color: #d1d5db;
  color: #111827;
}

body.theme-grey .chip:hover {
  background: #ffffff;
}

body.theme-grey code {
  background: #e5e7eb;
  color: #111827;
}

body.theme-grey pre {
  background: #111827;
  color: #e5e7eb;
}

body.theme-grey .page-btn {
  background: #f9fafb;
  color: #111827;
}

body.theme-grey .page-btn.active {
  background: linear-gradient(135deg, #9ca3af 0%, #e5e7eb 100%);
}

body.theme-grey .theme-selector {
  background: #f9fafb;
  color: #111827;
}

body.theme-grey .theme-selector:hover {
  background: #ffffff;
}

/* Teal/Green Theme */
body.theme-teal {
  --bg-primary: #d1fae5;
  --bg-secondary: #a7f3d0;
  --bg-gradient: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 50%, #a7f3d0 100%);
  --card-bg: rgba(16, 185, 129, 0.08);
  --card-border: rgba(16, 185, 129, 0.25);
  --text-primary: #064e3b;
  --text-secondary: #065f46;
  --text-muted: #047857;
  --brand-primary: #10b981;
  --brand-gradient: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --brand-glow: rgba(16, 185, 129, 0.4);
  --accent-blue: #0d9488;
  --accent-purple: #059669;
  --accent-pink: #14b8a6;
  --danger: #dc2626;
  --danger-glow: rgba(220, 38, 38, 0.2);
  --success: #059669;
  --shadow-sm: 0 2px 4px rgba(16, 185, 129, 0.15);
  --shadow-md: 0 4px 12px rgba(16, 185, 129, 0.2);
  --shadow-lg: 0 10px 30px rgba(16, 185, 129, 0.25);
  --shadow-glow: 0 0 30px rgba(16, 185, 129, 0.4);
}

body.theme-teal header.container {
  background: rgba(167, 243, 208, 0.9);
  backdrop-filter: blur(12px);
  color: #064e3b;
}

body.theme-teal .brand {
  color: #064e3b;
}

body.theme-teal .search input,
body.theme-teal input[type="text"],
body.theme-teal input[type="password"],
body.theme-teal input[type="number"],
body.theme-teal select,
body.theme-teal .theme-selector {
  background: rgba(236, 253, 245, 0.7);
  color: #064e3b;
}

body.theme-teal .row {
  background: rgba(209, 250, 229, 0.4);
}

body.theme-teal .row:hover {
  background: rgba(167, 243, 208, 0.5);
}

body.theme-teal .chip {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #047857;
}

/* Reddish/Orange Theme */
body.theme-orange {
  --bg-primary: #fed7aa;
  --bg-secondary: #fdba74;
  --bg-gradient: linear-gradient(135deg, #fff7ed 0%, #ffedd5 40%, #fed7aa 100%);
  --card-bg: rgba(249, 115, 22, 0.08);
  --card-border: rgba(249, 115, 22, 0.25);
  --text-primary: #7c2d12;
  --text-secondary: #9a3412;
  --text-muted: #c2410c;
  --brand-primary: #f97316;
  --brand-gradient: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
  --brand-glow: rgba(249, 115, 22, 0.4);
  --accent-blue: #ea580c;
  --accent-purple: #dc2626;
  --accent-pink: #f59e0b;
  --danger: #dc2626;
  --danger-glow: rgba(220, 38, 38, 0.2);
  --success: #16a34a;
  --shadow-sm: 0 2px 4px rgba(249, 115, 22, 0.15);
  --shadow-md: 0 4px 12px rgba(249, 115, 22, 0.2);
  --shadow-lg: 0 10px 30px rgba(249, 115, 22, 0.25);
  --shadow-glow: 0 0 30px rgba(249, 115, 22, 0.4);
}

body.theme-orange header.container {
  background: rgba(253, 186, 116, 0.9);
  backdrop-filter: blur(12px);
  color: #7c2d12;
}

body.theme-orange .brand {
  color: #7c2d12;
}

body.theme-orange .search input,
body.theme-orange input[type="text"],
body.theme-orange input[type="password"],
body.theme-orange input[type="number"],
body.theme-orange select,
body.theme-orange .theme-selector {
  background: rgba(255, 247, 237, 0.7);
  color: #7c2d12;
}

body.theme-orange .row {
  background: rgba(255, 237, 213, 0.5);
}

body.theme-orange .row:hover {
  background: rgba(254, 215, 170, 0.6);
}

body.theme-orange .chip {
  background: rgba(249, 115, 22, 0.15);
  border-color: rgba(249, 115, 22, 0.3);
  color: #c2410c;
}

/* Blue/White Theme */
body.theme-white {
  --bg-primary: #eff6ff;
  --bg-secondary: #dbeafe;
  --bg-gradient: linear-gradient(135deg, #ffffff 0%, #f0f9ff 50%, #e0f2fe 100%);
  --card-bg: #ffffff;
  --card-border: #bfdbfe;
  --text-primary: #1e3a8a;
  --text-secondary: #1e40af;
  --text-muted: #3b82f6;
  --brand-primary: #2563eb;
  --brand-gradient: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  --brand-glow: rgba(59, 130, 246, 0.3);
  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;
  --accent-pink: #db2777;
  --danger: #dc2626;
  --danger-glow: rgba(220, 38, 38, 0.2);
  --success: #16a34a;
  --shadow-sm: 0 2px 4px rgba(59, 130, 246, 0.1);
  --shadow-md: 0 4px 12px rgba(59, 130, 246, 0.15);
  --shadow-lg: 0 10px 30px rgba(59, 130, 246, 0.2);
  --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.25);
}

body.theme-white header.container {
  background: rgba(219, 234, 254, 0.95);
  backdrop-filter: blur(12px);
  color: #1e3a8a;
  border-bottom: 1px solid #bfdbfe;
}

body.theme-white .brand {
  color: #1e3a8a;
}

body.theme-white .search input,
body.theme-white input[type="text"],
body.theme-white input[type="password"],
body.theme-white input[type="number"],
body.theme-white select,
body.theme-white .theme-selector {
  background: #f0f9ff;
  color: #1e3a8a;
  border-color: #bfdbfe;
}

body.theme-white .search input:focus,
body.theme-white input[type="text"]:focus,
body.theme-white input[type="password"]:focus {
  background: #ffffff;
  border-color: #3b82f6;
}

body.theme-white button,
body.theme-white .btn {
  color: #ffffff;
}

body.theme-white .row {
  background: #f0f9ff;
  border-color: #bfdbfe;
}

body.theme-white .row:hover {
  background: #e0f2fe;
}

body.theme-white .chip {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #1e40af;
}

body.theme-white .chip:hover {
  background: rgba(59, 130, 246, 0.2);
}

body.theme-white code {
  background: #dbeafe;
  color: #1e40af;
}

body.theme-white .page-btn {
  background: #f0f9ff;
  color: #1e3a8a;
  border-color: #bfdbfe;
}

body.theme-white .page-btn.active {
  color: #1e3a8a;
  font-weight: 700;
}

/* ===================================
   ANALYTICS DASHBOARD
   =================================== */

.analytics-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.analytics-table th {
  background: var(--card-bg);
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--card-border);
}

.analytics-table td {
  padding: 12px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-secondary);
}

.analytics-table tbody tr:hover {
  background: var(--card-bg);
}

.analytics-table .number {
  font-weight: 600;
  color: var(--brand-primary);
}

.analytics-table .timestamp {
  font-size: 13px;
  color: var(--text-muted);
}

.table-scroll {
  overflow: auto;
  max-height: 360px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
}

.table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0;
}


/* Modal/Dialog overlay - transparent with blur only */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: transparent;
  backdrop-filter: blur(8px);
  z-index: 1000;
}

.modal-overlay.visible {
  display: flex;
}

/* Modal content - pure white background */
.modal-card {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
}

/* Modal message content - preserve formatting */
.modal-card #ffModalMessage {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.6;
  color: #374151;
  max-height: calc(90vh - 200px);
  overflow-y: auto;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 13px;
}

/* Input and actions just align with existing form + button styles */
.modal-input {
  width: 100%;
  margin-top: 8px;
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feedback-form textarea,
.feedback-form input[type="text"],
.feedback-form input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font: inherit;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}

.feedback-form textarea:focus,
.feedback-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.15);
}

.feedback-form textarea {
  resize: vertical;
  min-height: 120px;
}

.feedback-list-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.feedback-types {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.feedback-type {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text);
}

.feedback-type.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.15);
  background: rgba(66, 133, 244, 0.08);
}

.feedback-type:hover {
  border-color: var(--accent);
}

.feedback-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  align-items: end;
}

.feedback-field input {
  width: 100%;
}

.feedback-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.feedback-actions .muted {
  min-height: 20px;
}

.feedback-group {
  border-top: 1px solid var(--card-border);
  padding-top: 8px;
  margin-top: 8px;
}

.pill {
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}

.pill-muted {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--card-border);
}

.donate-pulse {
  position: relative;
  overflow: hidden;
  animation: donatePulse 1.8s ease-in-out infinite;
  color: #fff !important;
  background: var(--brand-gradient) !important;
  border: none !important;
}

@keyframes donatePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 138, 0, 0.4); }
  70% { box-shadow: 0 0 0 18px rgba(255, 138, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 138, 0, 0); }
}

/* Donate page */
.donate-hero {
  display: grid;
  gap: 16px;
}

.donate-amount {
  display: flex;
  gap: 8px;
  align-items: center;
}

.donate-amount input {
  width: 160px;
  text-align: right;
}

.confetti {
  position: fixed;
  width: 8px;
  height: 14px;
  background: var(--accent);
  top: -10px;
  left: 50%;
  opacity: 0.9;
  animation: confettiFall linear forwards;
  transform: rotate(15deg);
}

@keyframes confettiFall {
  to {
    transform: translateY(110vh) rotate(300deg);
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .donate-amount {
    flex-direction: column;
    align-items: stretch;
  }
}
.feedback-status {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
}

@media (max-width: 640px) {
  .feedback-types {
    grid-template-columns: 1fr;
  }
  .feedback-row {
    grid-template-columns: 1fr;
  }
}
