@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --accent: #10b981;
  --accent-light: #ecfdf5;
  --dark: #0f172a;
  --gray-800: #1e293b;
  --gray-600: #475569;
  --gray-400: #94a3b8;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --white: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.92);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #311042 100%);
  color: var(--dark);
  padding: 24px 16px;
  position: relative;
  overflow-x: hidden;
}

/* Background Glowing Orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

.orb-1 {
  width: 320px;
  height: 320px;
  background: #6366f1;
  top: -60px;
  left: -80px;
}

.orb-2 {
  width: 360px;
  height: 360px;
  background: #ec4899;
  bottom: -60px;
  right: -80px;
}

/* Container */
.auth-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
}

/* Card */
.auth-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.4);
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Brand */
.brand {
  text-align: center;
  margin-bottom: 24px;
}

.brand-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #4f46e5, #9333ea);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 26px;
  margin-bottom: 12px;
  box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.35);
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 14px;
  color: var(--gray-600);
  margin-top: 4px;
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.country-code {
  position: absolute;
  left: 38px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  border-right: 1px solid var(--gray-200);
  padding-right: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.form-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--dark);
  outline: none;
  transition: var(--transition);
}

.form-input.phone-input {
  padding-left: 95px;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.password-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  transition: var(--transition);
}

.password-toggle:hover {
  color: var(--gray-800);
}

/* Referral Badge */
.referral-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-light);
  border: 1px dashed var(--accent);
  color: #065f46;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
}

/* Helper text */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--gray-600);
  user-select: none;
}

.forgot-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.forgot-link:hover {
  text-decoration: underline;
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transition: var(--transition);
  margin-top: 6px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Switch link */
.auth-switch {
  text-align: center;
  margin-top: 22px;
  font-size: 14px;
  color: var(--gray-600);
}

.auth-switch a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Toast Message */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--dark);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.toast-success {
  background: #059669;
}

.toast.toast-error {
  background: #dc2626;
}

/* Dashboard Specific Styles */
.dashboard-card {
  max-width: 520px;
  width: 100%;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 20px;
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 24px;
  font-weight: 700;
}

.profile-info h3 {
  font-size: 18px;
  font-weight: 700;
}

.profile-info p {
  font-size: 14px;
  color: var(--gray-600);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--gray-100);
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 4px;
}

.referral-box {
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  border: 1.5px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}

.referral-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.referral-code-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
}

.referral-code-display span {
  font-family: monospace;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--dark);
}

.btn-copy {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-copy:hover {
  background: var(--primary-hover);
}

.btn-share {
  background: #25d366;
  color: var(--white);
  border: none;
  padding: 12px;
  border-radius: var(--radius-md);
  width: 100%;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 12px;
  text-decoration: none;
}

.btn-share:hover {
  background: #20ba59;
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  padding: 12px;
  border-radius: var(--radius-md);
  width: 100%;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

/* ==========================================================
   ADMIN PANEL STYLES
   ========================================================== */
.admin-wrapper {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.admin-card {
  max-width: 960px;
  width: 100%;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--gray-200);
}

.admin-title-group h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-title-group p {
  font-size: 13px;
  color: var(--gray-600);
  margin-top: 4px;
}

.admin-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-800);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  text-decoration: none;
}

.btn-sm:hover {
  background: var(--gray-100);
}

.btn-sm-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.btn-sm-primary:hover {
  background: var(--primary-hover);
}

.btn-sm-danger {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.btn-sm-danger:hover {
  background: #fee2e2;
}

/* Admin Metric Cards */
.admin-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  background: linear-gradient(135deg, var(--white), var(--gray-100));
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-card h4 {
  font-size: 12px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-card .metric-number {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 4px;
}

.metric-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* Filter bar */
.admin-search-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.admin-search-input {
  flex: 1;
  min-width: 240px;
  padding: 10px 14px 10px 38px;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--gray-200);
  outline: none;
  background: var(--white);
  transition: var(--transition);
}

.admin-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Table Container */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background: var(--white);
}

.referral-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.referral-table th {
  background: var(--gray-100);
  color: var(--gray-600);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.referral-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-800);
  vertical-align: middle;
}

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

.referral-table tr:hover {
  background: #f8fafc;
}

.table-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-mini-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #9333ea);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-name-title {
  font-weight: 700;
  color: var(--dark);
}

.ref-tag {
  background: #eef2ff;
  color: #4338ca;
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #c7d2fe;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  background: #dcfce7;
  color: #166534;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-600);
}

.empty-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.btn-delete-row {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
}

.btn-delete-row:hover {
  color: #dc2626;
  background: #fee2e2;
}

.admin-footer-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 12px;
  color: var(--gray-400);
  text-decoration: none;
}

.admin-footer-link:hover {
  color: var(--primary);
  text-decoration: underline;
}
