/* ============================================================
   StealthMole Partnership System - Custom Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ───────────────────────────────────────── */
:root {
  --bg-base:      #0f172a;
  --bg-surface:   #1e293b;
  --bg-elevated:  #263348;
  --border:       #334155;
  --border-light: #475569;
  --text-primary:   #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted:     #64748b;
  --accent-purple:  #a855f7;
  --accent-blue:    #3b82f6;
  --accent-red:     #ef4444;
  --accent-green:   #22c55e;
  --accent-yellow:  #f59e0b;
  --glow-purple: 0 0 24px rgba(168, 85, 247, 0.3);
  --glow-red:    0 0 24px rgba(244, 63, 94, 0.3);
  --transition: all 0.2s ease;
}

/* ─── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans', sans-serif;
  background-color: var(--bg-base);
  color: var(--text-secondary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Syne', 'Inter', sans-serif;
  color: var(--text-primary);
  line-height: 1.2;
}

.mono {
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 0.875rem;
}

/* ─── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

/* ─── Layout ──────────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }

/* ─── Card / Surface ──────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.card-sm { padding: 1.25rem; }

/* ─── Form Elements ───────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  letter-spacing: 0.01em;
}

label .required {
  color: var(--accent-red);
  margin-left: 3px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  padding: 0.6875rem 1rem;
  transition: var(--transition);
  outline: none;
  appearance: none;
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.125rem;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-select option { background: var(--bg-surface); }

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

.field-error {
  display: none;
  font-size: 0.8125rem;
  color: var(--accent-red);
  margin-top: 0.3125rem;
}
.field-error.show { display: block; }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.5rem;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--accent-purple);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #9333ea;
  box-shadow: var(--glow-purple);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
}

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-icon { padding: 0.5rem; border-radius: 6px; }
.btn-full { width: 100%; }

/* ─── Alerts / Banners ────────────────────────────────────── */
.alert {
  border-radius: 8px;
  padding: 0.875rem 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.alert-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.alert-icon { flex-shrink: 0; font-size: 1rem; margin-top: 1px; }

/* ─── Status Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-review {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.badge-approved {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.badge-rejected {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ─── Data Table ──────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

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

thead tr {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

thead th:hover { color: var(--text-secondary); }
thead th.sort-active { color: var(--accent-purple); }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: rgba(168, 85, 247, 0.04); }

tbody td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  vertical-align: middle;
}

.td-primary { color: var(--text-primary); font-weight: 500; }

/* ─── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-lg { max-width: 780px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; }

.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ─── Detail Grid ─────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 540px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-item { }
.detail-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.25rem; }
.detail-value { color: var(--text-primary); font-size: 0.9375rem; word-break: break-all; }

/* ─── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 0;
}

.pagination-info { font-size: 0.875rem; color: var(--text-muted); }

.pagination-controls { display: flex; align-items: center; gap: 0.375rem; }

.page-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent-purple); color: var(--accent-purple); }
.page-btn.active { background: var(--accent-purple); border-color: var(--accent-purple); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Search & Filter Bar ─────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 0.5625rem 0.875rem 0.5625rem 2.25rem;
  outline: none;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--accent-purple); box-shadow: 0 0 0 3px rgba(168,85,247,.12); }
.search-input::placeholder { color: var(--text-muted); }

/* ─── Header Nav ──────────────────────────────────────────── */
.admin-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-area { display: flex; align-items: center; gap: 0.75rem; }

.logo-badge {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  color: white;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  border-radius: 8px;
  letter-spacing: 0.04em;
  box-shadow: var(--glow-purple);
}

/* ─── Loading Spinner ─────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(168,85,247,0.3);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ─── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 1rem; opacity: 0.3; }
.empty-state h4 { color: var(--text-secondary); margin-bottom: 0.5rem; }

/* ─── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.875rem 1.125rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 260px;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  animation: slideInRight 0.25s ease;
  pointer-events: all;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error   { border-left: 3px solid var(--accent-red); }
.toast.info    { border-left: 3px solid var(--accent-blue); }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Misc Utilities ──────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.gap-sm { gap: 0.5rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

.hidden { display: none !important; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.w-full { width: 100%; }

/* ─── Partnership Form Page Specific ─────────────────────── */
.apply-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  background: radial-gradient(ellipse at top, rgba(168,85,247,0.08) 0%, transparent 55%),
              var(--bg-base);
}

.apply-page .form-card {
  width: 100%;
  max-width: 540px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 8px 48px rgba(0,0,0,0.4), var(--glow-red);
}

.brand-header { text-align: center; margin-bottom: 2rem; }

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.brand-logo .logo-mark {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #a855f7, #3b82f6);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.25rem; color: white;
  font-family: 'Syne', sans-serif;
  box-shadow: 0 0 24px rgba(168,85,247,0.4);
  flex-shrink: 0;
}

.brand-logo .logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ─── Admin Dashboard Specific ────────────────────────────── */
.admin-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-main {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
}
.stat-card .stat-num {
  font-family: 'DM Mono', monospace;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-card .stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ─── Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(ellipse at 70% 30%, rgba(168,85,247,0.06) 0%, transparent 60%),
              var(--bg-base);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 8px 48px rgba(0,0,0,0.4);
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .apply-page .form-card { padding: 1.75rem 1.25rem; }
  .admin-main { padding: 1.25rem 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { max-width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .pagination { flex-direction: column; align-items: flex-start; }
}
