/* === BASE RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-darkest: #0a0a1a;
  --bg-dark: #0f0f23;
  --bg-card: #1a1a2e;
  --bg-card-hover: #22223a;
  --border: #2a2a4e;
  --border-light: #3a3a5e;
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-gold: #ffd700;
  --accent-red: #e94560;
  --accent-green: #00d4aa;
  --accent-blue: #4a9eff;
  --accent-purple: #a855f7;
  --accent-orange: #f59e0b;
  --sidebar-width: 250px;
  --font: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-darkest);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === LAYOUT === */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px;
  border-bottom: 2px solid var(--accent-gold);
  text-align: center;
}

.sidebar-brand h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 2px;
}

.sidebar-brand .subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  gap: 12px;
}

.nav-item:hover {
  background: rgba(255, 215, 0, 0.05);
  color: var(--text-primary);
  text-decoration: none;
  border-left-color: var(--accent-gold);
}

.nav-item.active {
  background: rgba(255, 215, 0, 0.1);
  color: var(--accent-gold);
  border-left-color: var(--accent-gold);
}

.nav-item .icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-footer .user-email {
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 8px;
  word-break: break-all;
}

.sidebar-footer a {
  color: var(--accent-red);
  font-size: 12px;
}

/* === MAIN CONTENT === */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  transition: border-color 0.15s;
}

.card:hover {
  border-color: var(--border-light);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* === STAT CARDS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.stat-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent-gold);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.stat-card .stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-card.green .stat-value { color: var(--accent-green); }
.stat-card.red .stat-value { color: var(--accent-red); }
.stat-card.blue .stat-value { color: var(--accent-blue); }
.stat-card.purple .stat-value { color: var(--accent-purple); }
.stat-card.orange .stat-value { color: var(--accent-orange); }

/* === RATES ROW === */
.rates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.rate-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.rate-card .rate-value {
  font-size: 28px;
  font-weight: 700;
}

.rate-card .rate-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* === TABLES === */
.table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th {
  background: var(--bg-dark);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

table a {
  color: var(--accent-blue);
}

/* === BADGES === */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-green { background: rgba(0, 212, 170, 0.15); color: var(--accent-green); }
.badge-red { background: rgba(233, 69, 96, 0.15); color: var(--accent-red); }
.badge-yellow { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }
.badge-blue { background: rgba(74, 158, 255, 0.15); color: var(--accent-blue); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.badge-gold { background: rgba(255, 215, 0, 0.15); color: var(--accent-gold); }
.badge-gray { background: rgba(156, 163, 175, 0.15); color: var(--text-secondary); }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  text-decoration: none;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-gold {
  background: var(--accent-gold);
  color: #000;
}
.btn-gold:hover { background: #ffdf33; }

.btn-red {
  background: var(--accent-red);
  color: #fff;
}
.btn-red:hover { background: #ff5a75; }

.btn-green {
  background: var(--accent-green);
  color: #000;
}
.btn-green:hover { background: #00eabb; }

.btn-blue {
  background: var(--accent-blue);
  color: #fff;
}
.btn-blue:hover { background: #6ab0ff; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

/* === FORMS === */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-darkest);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

select.form-control {
  appearance: auto;
  cursor: pointer;
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* === GRID === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* === PAGINATION === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding: 16px 0;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.pagination a:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  text-decoration: none;
}

.pagination .active {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
}

.pagination .disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* === FILTERS BAR === */
.filters-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.filters-bar .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 140px;
}

.filters-bar .btn {
  height: 40px;
}

/* === ALERTS === */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-danger {
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid rgba(233, 69, 96, 0.3);
  color: var(--accent-red);
}

.alert-success {
  background: rgba(0, 212, 170, 0.1);
  border: 1px solid rgba(0, 212, 170, 0.3);
  color: var(--accent-green);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-orange);
}

/* === DOMAIN HEALTH STATUS === */
.health-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.health-green { background: var(--accent-green); box-shadow: 0 0 6px rgba(0, 212, 170, 0.5); }
.health-yellow { background: var(--accent-orange); box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.health-red { background: var(--accent-red); box-shadow: 0 0 6px rgba(233, 69, 96, 0.5); }

/* === LOGIN PAGE === */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-darkest);
}

.login-box {
  width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
}

.login-box h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.login-box .subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 32px;
}

.login-box .form-group {
  text-align: left;
}

.login-box .btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 15px;
  margin-top: 8px;
}

/* === PROGRESS BAR === */
.progress-bar-wrapper {
  background: var(--bg-darkest);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  width: 100%;
}

.progress-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s;
}

.progress-bar.green { background: var(--accent-green); }
.progress-bar.gold { background: var(--accent-gold); }
.progress-bar.red { background: var(--accent-red); }

/* === TIER BADGES === */
.tier-1 { color: var(--accent-gold); font-weight: 700; }
.tier-2 { color: var(--accent-blue); font-weight: 700; }
.tier-3 { color: var(--accent-purple); font-weight: 700; }

/* === MODAL === */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar-brand h1 { font-size: 16px; letter-spacing: 0; }
  .sidebar-brand .subtitle { display: none; }
  .nav-item span:not(.icon) { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-footer { display: none; }
  .main-content { margin-left: 60px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 15px;
}

/* === COUNTRY FLAG CODES === */
.country-code {
  font-weight: 600;
  color: var(--accent-blue);
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-darkest); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* === TEMPLATE PREVIEW === */
.template-preview-frame {
  width: 100%;
  height: 500px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

/* === EDITOR === */
.code-editor {
  width: 100%;
  min-height: 400px;
  background: var(--bg-darkest);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent-green);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  padding: 16px;
  resize: vertical;
}
