/* =============================================================================
   Arca Nexus - Authentication Styles
   ============================================================================= */

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

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

:root {
  --navy: #0A1628;
  --navy-deep: #060E1A;
  --navy-light: #111D33;
  --navy-surface: #162033;
  --teal: #22D3A7;
  --teal-dark: #1AAE8A;
  --teal-glow: rgba(34, 211, 167, 0.15);
  --teal-subtle: rgba(34, 211, 167, 0.06);
  --blue: #3B82F6;
  --blue-dark: #2563EB;
  --red: #EF4444;
  --amber: #F59E0B;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: rgba(34, 211, 167, 0.1);
  --border-strong: rgba(34, 211, 167, 0.2);
  --glass-bg: rgba(22, 32, 51, 0.65);
  --glass-border: rgba(34, 211, 167, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.4);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--navy-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* -- Background --------------------------------------------------------------- */
.auth-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  overflow: hidden;
}

.auth-bg::before {
  content: '';
  position: absolute;
  top: -20%; left: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(34, 211, 167, 0.07) 0%, transparent 70%);
  animation: pulse-glow 8s ease-in-out infinite;
}

.auth-bg::after {
  content: '';
  position: absolute;
  bottom: -20%; right: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
  animation: pulse-glow 10s ease-in-out infinite reverse;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* Grid pattern */
.auth-grid {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(34, 211, 167, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 167, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* -- Layout ------------------------------------------------------------------ */
.auth-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
}

/* -- Logo -------------------------------------------------------------------- */
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
  user-select: none;
}

.auth-logo-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
}

.auth-logo-text {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.auth-logo-sub {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal);
  margin-top: 2px;
}

/* -- Card -------------------------------------------------------------------- */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* -- Tabs -------------------------------------------------------------------- */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.auth-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  width: 60%;
  height: 2px;
  background: var(--teal);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.auth-tab.active {
  color: var(--teal);
}

.auth-tab.active::after {
  transform: scaleX(1);
}

.auth-tab:hover:not(.active) {
  color: var(--text-secondary);
}

/* -- Form -------------------------------------------------------------------- */
.auth-form-wrap {
  padding: 28px 32px 32px;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.form-group {
  margin-bottom: 20px;
}

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

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: var(--navy);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

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

.form-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

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

.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

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

/* -- Button ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  padding: 0 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.02em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: var(--navy-deep);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(34, 211, 167, 0.3);
}

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

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

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.btn-sm {
  height: 36px;
  font-size: 13px;
  padding: 0 16px;
  width: auto;
}

.btn-danger {
  background: linear-gradient(135deg, var(--red) 0%, #DC2626 100%);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

/* Loading spinner inside button */
.btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* -- OTP inputs -------------------------------------------------------------- */
.otp-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 24px 0;
}

.otp-input {
  width: 52px;
  height: 62px;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  font-family: 'Inter', monospace;
  color: var(--teal);
  background: var(--navy);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
  caret-color: var(--teal);
}

.otp-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

.otp-input.filled {
  border-color: var(--teal);
  background: var(--teal-subtle);
}

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

.alert.show {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: fadeIn 0.3s ease;
}

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

.alert-success {
  background: rgba(34, 211, 167, 0.1);
  border: 1px solid rgba(34, 211, 167, 0.2);
  color: #86EFAC;
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93C5FD;
}

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

/* -- Footer text ------------------------------------------------------------- */
.auth-footer {
  text-align: center;
  padding: 16px 32px 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

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

/* -- OTP screen -------------------------------------------------------------- */
.otp-screen-header {
  text-align: center;
  margin-bottom: 8px;
}

.otp-screen-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.otp-screen-header p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.otp-screen-header .email-highlight {
  color: var(--teal);
  font-weight: 600;
}

.otp-timer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px;
}

.otp-timer .timer-value {
  color: var(--amber);
  font-weight: 600;
}

.otp-resend {
  text-align: center;
  margin-top: 12px;
}

.otp-resend button {
  background: none;
  border: none;
  color: var(--teal);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition);
}

.otp-resend button:hover {
  background: var(--teal-subtle);
}

.otp-resend button:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

/* -- Pending screen ---------------------------------------------------------- */
.pending-screen {
  text-align: center;
  padding: 40px 32px;
}

.pending-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.1);
  border: 2px solid rgba(245, 158, 11, 0.2);
  border-radius: 50%;
}

.pending-screen h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.pending-screen p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 340px;
  margin: 0 auto 24px;
}

/* -- Admin panel ------------------------------------------------------------- */
.admin-panel {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

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

.admin-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.admin-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  flex: 1;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--teal);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.users-table-wrap {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.users-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
}

.users-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

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

.users-table tr:hover td {
  background: rgba(34, 211, 167, 0.02);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge.active {
  background: rgba(34, 211, 167, 0.12);
  color: var(--teal);
}

.status-badge.pending_approval {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
}

.status-badge.pending_verification {
  background: rgba(59, 130, 246, 0.12);
  color: var(--blue);
}

.status-badge.disabled {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.role-badge.admin {
  background: rgba(139, 92, 246, 0.15);
  color: #A78BFA;
}

.role-badge.user {
  background: rgba(59, 130, 246, 0.1);
  color: #93C5FD;
}

.action-btns {
  display: flex;
  gap: 6px;
}

/* -- Copyright --------------------------------------------------------------- */
.auth-copyright {
  text-align: center;
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* -- Utility ----------------------------------------------------------------- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }

/* -- Responsive -------------------------------------------------------------- */
@media (max-width: 480px) {
  .auth-form-wrap {
    padding: 24px 20px 28px;
  }

  .otp-input {
    width: 44px;
    height: 54px;
    font-size: 22px;
  }

  .otp-container {
    gap: 6px;
  }

  .admin-stats {
    flex-direction: column;
  }

  .users-table-wrap {
    overflow-x: auto;
  }

  .users-table {
    min-width: 600px;
  }
}

