/* ========== RawDex Admin Panel — Dark Cyberpunk Theme ========== */

:root {
  --bg-primary: #050508;
  --bg-secondary: #0a0a12;
  --bg-card: #0f0f1a;
  --bg-card-hover: #14142a;
  --bg-input: #0c0c18;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-dark: #4a3db8;
  --neon-cyan: #00f0ff;
  --neon-pink: #ff006e;
  --neon-green: #00ff88;
  --neon-amber: #ffb700;
  --text-primary: #e8e6f0;
  --text-secondary: #8b8a9e;
  --text-muted: #55546a;
  --border: rgba(108, 92, 231, 0.15);
  --border-strong: rgba(108, 92, 231, 0.35);
  --danger: #ff4757;
  --danger-dark: #c0392b;
  --success: #00ff88;
  --font-display: 'Syne', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'Space Mono', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--accent-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ========== Auth Pages ========== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--neon-cyan), var(--accent));
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
}

.auth-logo .bracket { color: var(--text-muted); }
.auth-logo .accent { color: var(--accent-light); }

.auth-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 32px;
  text-transform: uppercase;
  letter-spacing: 3px;
}

/* ========== Forms ========== */
.form-group {
  margin-bottom: 20px;
}

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

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15), 0 0 20px rgba(108, 92, 231, 0.1);
}

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

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8a9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(108, 92, 231, 0.5);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-success {
  background: linear-gradient(135deg, #00cc6a, #00995e);
  color: #fff;
}

.btn-success:hover {
  box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-dark));
  color: #fff;
}

.btn-danger:hover {
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--accent-light);
  border: 1px solid var(--border-strong);
}

.btn-outline:hover {
  background: rgba(108, 92, 231, 0.1);
  border-color: var(--accent);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 11px;
}

.btn-block {
  width: 100%;
}

/* ========== Alert ========== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
}

.alert.show { display: block; }

.alert-error {
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.3);
  color: var(--danger);
}

.alert-success {
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.3);
  color: var(--neon-green);
}

/* ========== Auth Links ========== */
.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.auth-footer a:hover {
  color: var(--neon-cyan);
}

/* ========== Dashboard Layout ========== */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  padding: 24px 20px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .bracket { color: var(--text-muted); }
.sidebar-logo .accent { color: var(--accent-light); }

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}

.nav-item:hover {
  background: rgba(108, 92, 231, 0.1);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-light);
  border-left: 3px solid var(--accent);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--neon-pink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--neon-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.user-details { overflow: hidden; }

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-mono);
}

.role-admin { color: var(--neon-cyan); }
.role-approved { color: var(--neon-green); }
.role-pending { color: var(--neon-amber); }
.role-rejected { color: var(--neon-pink); }

/* ========== Main Content ========== */
.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ========== Table ========== */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

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

.table .actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ========== Role Badges ========== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-mono);
}

.badge-admin {
  background: rgba(0, 240, 255, 0.1);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.badge-approved {
  background: rgba(0, 255, 136, 0.1);
  color: var(--neon-green);
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.badge-pending {
  background: rgba(255, 183, 0, 0.1);
  color: var(--neon-amber);
  border: 1px solid rgba(255, 183, 0, 0.3);
}

.badge-rejected {
  background: rgba(255, 71, 87, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 71, 87, 0.3);
}

/* ========== Build Cards ========== */
.builds-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.build-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
}

.build-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.build-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.build-icon svg {
  width: 24px;
  height: 24px;
  color: #fff;
}

.build-info {
  flex: 1;
  min-width: 0;
}

.build-version {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.build-meta {
  display: flex;
  gap: 16px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.build-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.build-notes {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

.build-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ========== Upload Section ========== */
.upload-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.upload-section h3 {
  font-family: var(--font-display);
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.upload-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.upload-form .form-group.full-width {
  grid-column: 1 / -1;
}

.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.05);
  color: var(--accent-light);
}

.drop-zone svg {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.drop-zone p {
  font-size: 14px;
}

.drop-zone .file-name {
  font-family: var(--font-mono);
  color: var(--neon-green);
  font-size: 13px;
  margin-top: 8px;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
  display: none;
}

.progress-bar.show { display: block; }

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--neon-cyan));
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

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

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

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

/* ========== Loading ========== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-center {
  display: flex;
  justify-content: center;
  padding: 40px;
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 100%;
}

.modal h3 {
  font-family: var(--font-display);
  margin-bottom: 12px;
}

.modal p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

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

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .dashboard {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 12px;
  }

  .nav-item {
    white-space: nowrap;
    padding: 10px 14px;
  }

  .nav-item.active {
    border-left: none;
    border-bottom: 3px solid var(--accent);
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
  }

  .main-content {
    padding: 20px 16px;
  }

  .upload-form {
    grid-template-columns: 1fr;
  }

  .build-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .build-actions {
    width: 100%;
  }

  .build-actions .btn {
    flex: 1;
  }

  .table-wrapper {
    overflow-x: auto;
  }
}
