:root {
  --primary-color: #00ff66; /* Vibrant Lime Green */
  --primary-dark: #00cc52;
  --bg-color: #0a0a0a;
  --panel-bg: rgba(25, 25, 25, 0.6);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-main: #ffffff;
  --text-muted: #a0a0a0;
  --error-color: #ff4d4f;
  --font-family: 'Inter', sans-serif;
  --radius: 12px;
}

.light-mode {
  --primary-color: #00c853;
  --primary-dark: #009624;
  --bg-color: #f5f7fa;
  --panel-bg: rgba(255, 255, 255, 0.8);
  --border-color: rgba(0, 0, 0, 0.1);
  --text-main: #1a1a1a;
  --text-muted: #666666;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Glassmorphism utility */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Theme Switcher */
.theme-switch-container {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
}
.theme-btn {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-btn:hover {
  transform: scale(1.05);
}
.theme-btn svg { width: 20px; height: 20px; }
.sun-icon { display: none; }
.light-mode .moon-icon { display: none; }
.light-mode .sun-icon { display: block; }

/* Login Container */
#login-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 40px;
}
.login-header {
  text-align: center;
  margin-bottom: 30px;
}
.logo-img {
  max-width: 150px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 10px rgba(0, 255, 102, 0.3));
}
.light-mode .logo-img { filter: invert(1); }
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-family);
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.light-mode .form-group input { background: rgba(255,255,255,0.5); }
.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}
.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--primary-color);
  color: #000;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s;
}
.light-mode .btn-primary { color: #fff; }
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}
.error-msg {
  color: var(--error-color);
  font-size: 0.85rem;
  margin-bottom: 15px;
  text-align: center;
  min-height: 20px;
}

/* Dashboard */
#dashboard-container {
  padding: 40px;
  max-width: 1200px;
  margin: 0 auto;
}
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo-sm {
  height: 40px;
}
.light-mode .logo-sm { filter: invert(1); }
.btn-secondary {
  padding: 8px 16px;
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
}
.light-mode .btn-secondary:hover { background: rgba(0,0,0,0.05); }

.stats-row {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}
.stat-card {
  flex: 1;
  padding: 20px;
  text-align: center;
}
.stat-card h3 {
  margin: 0 0 10px 0;
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-card p {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.table-container {
  padding: 20px;
  overflow-x: auto;
  position: relative;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: rgba(255,255,255,0.02);
}
.light-mode tr:hover td { background: rgba(0,0,0,0.02); }

.action-btn {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn:hover {
  background: var(--primary-color);
  color: #000;
}
.light-mode .action-btn:hover { color: #fff; }

/* Loading Spinner */
.loading-indicator {
  display: none;
  justify-content: center;
  padding: 40px;
}
.spinner {
  width: 40px;
  height: 40px;
  animation: rotate 2s linear infinite;
}
.spinner .path {
  stroke: var(--primary-color);
  stroke-linecap: round;
  animation: dash 1.5s ease-in-out infinite;
}
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes dash {
  0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
.modal-content {
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  padding: 30px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.close-btn {
  position: absolute;
  top: 20px; right: 20px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}
.close-btn:hover { color: var(--text-main); }
.modal-body-scroll {
  overflow-y: auto;
  margin-top: 20px;
  padding-right: 10px;
}
.detail-item {
  margin-bottom: 15px;
}
.detail-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.detail-value {
  font-size: 1rem;
}
.download-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--primary-color);
  text-decoration: none;
  border: 1px solid var(--primary-color);
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s;
}
.download-link:hover {
  background: var(--primary-color);
  color: #000;
}
.light-mode .download-link:hover { color: #fff; }

/* Sidebar and Navigation Tabs */
.admin-nav-tabs {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 20px;
  position: relative;
  transition: all 0.2s;
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  color: var(--primary-color);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary-color);
}

/* Switches & Toggles */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333;
  transition: .3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--primary-color);
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* Actions & Utility */
.header-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.danger-btn {
  background: transparent;
  color: var(--error-color);
  border: 1px solid var(--error-color);
}
.danger-btn:hover {
  background: var(--error-color);
  color: #fff;
}

/* Builder Editor styling */
.builder-panel {
  padding: 30px;
  margin-bottom: 30px;
}
.field-item-row {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 15px;
  position: relative;
}
.light-mode .field-item-row { background: rgba(0,0,0,0.01); }
.field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  font-weight: 600;
}
.field-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}
.options-editor-box {
  margin-top: 15px;
  padding: 15px;
  border-left: 2px solid var(--primary-color);
  background: rgba(255,255,255,0.01);
}
.option-editor-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.option-editor-row input {
  flex: 1;
}

/* Mini select & text styling inside tables/builder */
.admin-input, .admin-select, .admin-textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  box-sizing: border-box;
  font-family: var(--font-family);
  font-size: 0.95rem;
}
.light-mode .admin-input, .light-mode .admin-select, .light-mode .admin-textarea {
  background: rgba(255,255,255,0.6);
}
.admin-input:focus, .admin-select:focus, .admin-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}
.action-btn-sm {
  padding: 4px 8px;
  font-size: 0.8rem;
}
.field-actions-cluster {
  display: flex;
  gap: 8px;
}
.admin-select-wrapper {
  margin-bottom: 25px;
  max-width: 400px;
}
.checkbox-option-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.95rem;
}

