@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #080810;
  --card: #0e0e1a;
  --card2: #13131f;
  --border: #1e1e30;
  --red: #e63946;
  --red-dark: #c1121f;
  --red-glow: rgba(230, 57, 70, 0.12);
  --white: #ffffff;
  --gray: #8888aa;
  --gray2: #44445a;
  --success: #2ecc71;
  --fail: #e63946;
  --text: #e0e0f0;
  --purple: #6c63ff;
  --card-gradient: linear-gradient(135deg, #0e0e1a 0%, #13131f 100%);
  --glass: rgba(255,255,255,0.03);
  --glass-border: rgba(255,255,255,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── BACKGROUND ── */
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url('forest-raccoon.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.04;
  z-index: 0;
  pointer-events: none;
}

.layout, .login-page { position: relative; z-index: 1; }

/* ── LOADER ── */
#loader {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 60%, #1a0510 0%, #080810 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

#loader.hide {
  opacity: 0;
  visibility: hidden;
}

.loader-logo {
  animation: logoPulse 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(230,57,70,0.5));
}

.loader-title {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--white);
  margin-top: 20px;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.loader-title span { color: var(--red); }

.loader-bar-wrap {
  width: 220px;
  height: 2px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  margin-top: 32px;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--red-dark), var(--red), #ff6b6b);
  border-radius: 10px;
  animation: loadBar 2.2s ease forwards;
  box-shadow: 0 0 10px rgba(230,57,70,0.6);
}

.loader-sub {
  margin-top: 14px;
  font-size: 0.72rem;
  color: var(--gray2);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.loader-dots {
  display: flex;
  gap: 6px;
  margin-top: 20px;
}

.loader-dots span {
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1) rotate(-2deg); filter: drop-shadow(0 0 20px rgba(230,57,70,0.4)); }
  50% { transform: scale(1.08) rotate(2deg); filter: drop-shadow(0 0 40px rgba(230,57,70,0.7)); }
}

@keyframes loadBar {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* ── PAGE TRANSITION ── */
.page-wrap {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a0a0a 0%, #0a0a0a 70%);
}

.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  text-align: center;
}

.login-box .logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.login-box h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 14px;
  color: var(--white);
  letter-spacing: 1px;
}

.login-box h1 span { color: var(--red); }

.login-box p.sub {
  font-size: 0.8rem;
  color: var(--gray);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--gray);
  margin-bottom: 8px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--red);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(230,57,70,0.3);
}

.btn-secondary {
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--red);
  color: var(--red);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
  border-radius: 7px;
}

.btn-danger {
  background: rgba(230,57,70,0.15);
  color: var(--red);
  border: 1px solid rgba(230,57,70,0.3);
}

.btn-danger:hover {
  background: var(--red);
  color: white;
}

.error-msg {
  background: rgba(230,57,70,0.1);
  border: 1px solid rgba(230,57,70,0.3);
  color: var(--red);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ── LAYOUT ── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #0e0e1a 0%, #080810 100%);
  border-right: 1px solid var(--glass-border);
  padding: 28px 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 28px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
}

.sidebar-logo h2 span { color: var(--red); }

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
}

.nav-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gray2);
  padding: 0 12px;
  margin-bottom: 8px;
  margin-top: 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--gray);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--card2);
  color: var(--white);
}

.nav-item.active {
  background: var(--red-glow);
  color: var(--red);
  border: 1px solid rgba(230,57,70,0.2);
}

.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.avatar {
  width: 32px;
  height: 32px;
  background: var(--red-glow);
  border: 1px solid rgba(230,57,70,0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--red);
  font-weight: 700;
}

.user-info-text p {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--white);
}

.user-info-text span {
  font-size: 0.72rem;
  color: var(--gray2);
}

/* ── MAIN ── */
.main {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.topbar h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
}

.topbar p {
  font-size: 0.82rem;
  color: var(--gray);
  margin-top: 2px;
}

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-gradient);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 22px;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover { border-color: rgba(230,57,70,0.2); }
.stat-card:hover::before { opacity: 1; }

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
}

.stat-card .stat-value.red { color: var(--red); }
.stat-card .stat-value.green { color: var(--success); }

/* ── CARD ── */
.card {
  background: var(--card-gradient);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: rgba(230,57,70,0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
}

.card-sub {
  font-size: 0.78rem;
  color: var(--gray);
  margin-top: 2px;
}

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead tr {
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray2);
  font-weight: 600;
}

tbody tr {
  border-bottom: 1px solid #1a1a1a;
  transition: background 0.15s;
}

tbody tr:hover { background: var(--card2); }

tbody td {
  padding: 12px 14px;
  color: var(--text);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(46,204,113,0.1);
  color: var(--success);
  border: 1px solid rgba(46,204,113,0.2);
}

.badge-fail {
  background: rgba(230,57,70,0.1);
  color: var(--red);
  border: 1px solid rgba(230,57,70,0.2);
}

.badge-pending {
  background: rgba(255,193,7,0.1);
  color: #ffc107;
  border: 1px solid rgba(255,193,7,0.2);
}

.badge-admin {
  background: rgba(230,57,70,0.1);
  color: var(--red);
  border: 1px solid rgba(230,57,70,0.2);
}

.badge-user {
  background: rgba(136,136,136,0.1);
  color: var(--gray);
  border: 1px solid rgba(136,136,136,0.2);
}

/* ── PLATFORM GRID ── */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.platform-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.platform-item:hover {
  border-color: var(--red);
}

.platform-item.selected {
  background: var(--red-glow);
  border-color: rgba(230,57,70,0.5);
}

.platform-item input[type="checkbox"] {
  display: none;
}

.platform-check {
  width: 16px;
  height: 16px;
  border: 2px solid var(--gray2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.platform-item.selected .platform-check {
  background: var(--red);
  border-color: var(--red);
}

.platform-check::after {
  content: '✓';
  color: white;
  font-size: 10px;
  display: none;
}

.platform-item.selected .platform-check::after { display: block; }

.platform-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.platform-cat {
  font-size: 0.68rem;
  color: var(--gray2);
}

/* ── SELECT ALL ── */
.select-all-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

/* ── PROGRESS ── */
.progress-wrap {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  display: none;
}

.progress-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar-wrap {
  background: var(--border);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red-dark), var(--red));
  border-radius: 10px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.78rem;
  color: var(--gray);
}

/* ── RESULT TABLE ── */
.result-row-success td:last-child { color: var(--success); }
.result-row-fail td:last-child { color: var(--red); }

/* ── SPINNER ── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── EMPTY ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray);
}

.empty-state svg { margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 1rem; color: var(--gray); margin-bottom: 8px; }
.empty-state p { font-size: 0.82rem; }

/* ── ALERT ── */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success {
  background: rgba(46,204,113,0.1);
  border: 1px solid rgba(46,204,113,0.2);
  color: var(--success);
}

.alert-error {
  background: rgba(230,57,70,0.1);
  border: 1px solid rgba(230,57,70,0.2);
  color: var(--red);
}

/* ── DIVIDER ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── URL BADGE ── */
.url-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gray);
  font-size: 0.8rem;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray2); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .main { margin-left: 200px; padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── LIGHT MODE ── */
body.light {
  --bg: #f4f4f4;
  --card: #ffffff;
  --card2: #f0f0f0;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --gray: #555555;
  --gray2: #888888;
}

body.light .nav-item { color: #444; }
body.light .nav-item:hover { background: #e8e8e8; color: #111; }
body.light .sidebar { background: #fff; border-color: #e0e0e0; }
body.light .sidebar-logo h2 { color: #111; }
body.light table thead th { color: #888; }
body.light .url-cell { color: #555; }

/* ── THEME TOGGLE ── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--card2);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--gray);
  transition: all 0.2s;
  user-select: none;
}

.theme-toggle:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── MAIL RESULTS ── */
.mail-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 600;
}

.mail-badge-sent {
  background: rgba(46,204,113,0.1);
  color: #2ecc71;
  border: 1px solid rgba(46,204,113,0.2);
}

.mail-badge-fail {
  background: rgba(230,57,70,0.1);
  color: #e63946;
  border: 1px solid rgba(230,57,70,0.2);
}

.section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--red);
  font-weight: 600;
  margin: 20px 0 10px;
}
