/* =========================================================
   ASTRADA AUTHENTICATION & PORTAL STYLESHEET
   The Data Layer for Autonomous Finance
   ========================================================= */

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

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

:root {
  --navy: #1C1C3F;
  --navy-deep: #0D0D24;
  --navy-light: #2A2A55;
  --navy-card: rgba(22, 22, 54, 0.72);
  --cream: #F9F7F4;
  --red-orange: #FD4308;
  --red-hover: #E53B06;
  --white: #FFFFFF;
  --muted: #8888AA;
  --text-light: rgba(255, 255, 255, 0.65);
  --text-dim: rgba(255, 255, 255, 0.4);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-hover: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glow: rgba(253, 67, 8, 0.38);
  --glow-soft: rgba(253, 67, 8, 0.12);
  --bank: #6B9FFF;
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.2);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.2);
  --font-heading: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-ui: 'Overpass', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --max-w: 1200px;
}

html, body {
  min-height: 100%;
}

body {
  font-family: var(--font-heading);
  background: var(--navy-deep);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Subtle Film Grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: 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.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease, opacity 0.2s ease;
}

/* Ambient Radial Glows */
.ambient-glow-top {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(ellipse at center, var(--glow) 0%, rgba(253, 67, 8, 0.08) 45%, transparent 70%);
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  animation: glowPulse 7s ease-in-out infinite alternate;
}

.ambient-glow-bottom {
  position: fixed;
  bottom: -200px;
  right: -100px;
  width: 700px;
  height: 600px;
  background: radial-gradient(circle, rgba(107, 159, 255, 0.08) 0%, transparent 65%);
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}

@keyframes glowPulse {
  0% { opacity: 0.55; transform: translateX(-50%) scale(0.95); }
  100% { opacity: 0.85; transform: translateX(-50%) scale(1.05); }
}

/* ===== TOP NAV ===== */
.nav {
  position: relative;
  z-index: 50;
  padding: 16px 24px;
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 24px;
  background: rgba(13, 13, 36, 0.65);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo-img {
  height: 24px;
  width: auto;
  display: block;
}

.nav-tagline {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding-left: 12px;
  border-left: 1px solid var(--glass-border);
}

.nav-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  color: #4ade80;
}

.nav-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--white);
  background: var(--glass);
}

/* ===== MAIN CONTAINER ===== */
.auth-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 60px;
  position: relative;
  z-index: 10;
}

/* Glass Card */
.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--navy-card);
  backdrop-filter: blur(28px) saturate(1.8);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 40px 36px;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.7), 0 0 60px var(--glow-soft);
  position: relative;
  animation: cardFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Top Card Badge / Logo */
.auth-card-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-symbol {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, rgba(253, 67, 8, 0.15), rgba(28, 28, 63, 0.4));
  border: 1px solid rgba(253, 67, 8, 0.3);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 0 25px var(--glow-soft);
}

.auth-logo-symbol svg {
  width: 28px;
  height: 28px;
}

.auth-card-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--white);
  margin-bottom: 8px;
}

.auth-card-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* Tab Switcher */
.auth-tabs {
  display: flex;
  background: rgba(13, 13, 36, 0.75);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  margin-bottom: 28px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.auth-tab-btn.active {
  background: var(--navy-light);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.auth-tab-btn:hover:not(.active) {
  color: var(--white);
}

/* Flash Messages */
.flash-alert {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  margin-bottom: 22px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.4;
  animation: slideDown 0.3s ease;
}

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

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

.flash-alert.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

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

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 8px;
}

.form-control-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 16px;
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 46px;
  background: rgba(13, 13, 36, 0.65);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 14.5px;
  color: var(--white);
  outline: none;
  transition: all 0.2s ease;
}

.form-input::placeholder {
  color: rgba(136, 136, 170, 0.55);
}

.form-input:focus {
  border-color: var(--red-orange);
  background: rgba(13, 13, 36, 0.85);
  box-shadow: 0 0 0 3px rgba(253, 67, 8, 0.2);
}

.form-input:focus + .input-icon,
.form-control-wrap:focus-within .input-icon {
  color: var(--red-orange);
}

.toggle-password-btn {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s;
}

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

/* Meta row: remember & forgot */
.form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 24px;
}

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

.remember-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  background: rgba(13, 13, 36, 0.65);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.remember-checkbox:checked {
  background: var(--red-orange);
  border-color: var(--red-orange);
}

.remember-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.forgot-link {
  color: var(--muted);
  transition: color 0.2s;
}

.forgot-link:hover {
  color: var(--red-orange);
}

/* Primary Button */
.btn-astrada {
  width: 100%;
  height: 50px;
  background: var(--red-orange);
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 20px var(--glow);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.btn-astrada:hover {
  background: var(--red-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(253, 67, 8, 0.55);
}

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

.btn-astrada .btn-arrow {
  transition: transform 0.2s ease;
}

.btn-astrada:hover .btn-arrow {
  transform: translateX(4px);
}

/* Demo Credentials Helper Pill */
.demo-credentials-box {
  margin-top: 26px;
  padding: 14px 16px;
  background: rgba(28, 28, 63, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.demo-credentials-info {
  color: var(--muted);
  line-height: 1.4;
}

.demo-credentials-info strong {
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 12px;
}

.btn-autofill {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-light);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-autofill:hover {
  background: rgba(253, 67, 8, 0.15);
  border-color: rgba(253, 67, 8, 0.4);
  color: var(--white);
}

/* ===== FOOTER ===== */
.auth-footer {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--glass-border);
  padding: 24px 20px;
  margin-top: auto;
}

.auth-footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 12px;
}

.auth-footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.auth-footer-links a:hover {
  color: var(--white);
}

/* ===== DASHBOARD STYLES ===== */
.dashboard-container {
  max-width: var(--max-w);
  margin: 30px auto;
  padding: 0 24px;
  position: relative;
  z-index: 10;
  width: 100%;
}

.dashboard-hero {
  background: linear-gradient(135deg, rgba(28, 28, 63, 0.6), rgba(13, 13, 36, 0.8));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 36px 40px;
  backdrop-filter: blur(24px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.user-badge-group {
  display: flex;
  align-items: center;
  gap: 18px;
}

.user-avatar {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--red-orange), #ff7a45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--white);
  box-shadow: 0 4px 20px var(--glow);
}

.user-info h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.user-info p {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-role-badge {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(253, 67, 8, 0.15);
  color: var(--red-orange);
  border: 1px solid rgba(253, 67, 8, 0.3);
}

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

.stat-card {
  background: var(--navy-card);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 24px;
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(253, 67, 8, 0.3);
}

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

.stat-title {
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--white);
  margin-bottom: 6px;
}

.stat-meta {
  font-size: 13px;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 6px;
}

.api-key-box {
  background: rgba(13, 13, 36, 0.7);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}

.api-key-value {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: #ff9a70;
  word-break: break-all;
}

/* Transactions Table */
.data-card {
  background: var(--navy-card);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 28px;
  backdrop-filter: blur(20px);
  margin-bottom: 36px;
}

.data-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.data-card-title {
  font-size: 18px;
  font-weight: 700;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.custom-table th {
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--glass-border);
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-light);
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--white);
}

.badge-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-ui);
}

.badge-tag.card-visa {
  background: rgba(107, 159, 255, 0.15);
  color: #8bb3ff;
}

.badge-tag.card-mc {
  background: rgba(253, 67, 8, 0.15);
  color: #ff7d52;
}

.badge-tag.status-reconciled {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

/* Responsive */
@media (max-width: 640px) {
  .auth-card {
    padding: 30px 22px;
  }
  .nav-tagline {
    display: none;
  }
  .dashboard-hero {
    padding: 24px;
    flex-direction: column;
    align-items: flex-start;
  }
  .custom-table {
    display: block;
    overflow-x: auto;
  }
}

/* Action & Inspect Buttons */
.btn-action-small,
.btn-inspect,
.custom-table td button,
.custom-table button.btn-action-small {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  height: 28px;
  padding: 0 12px;
  box-sizing: border-box;
  border-radius: 7px;
  border: 1px solid rgba(107, 159, 255, 0.28);
  background: linear-gradient(180deg, rgba(28, 36, 68, 0.9) 0%, rgba(14, 18, 40, 0.95) 100%);
  color: #dbe4f0;
  font-family: var(--font-ui, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}
.btn-action-small:hover,
.btn-inspect:hover,
.custom-table td button:hover,
.custom-table button.btn-action-small:hover {
  color: #ffffff;
  background: linear-gradient(180deg, rgba(50, 75, 140, 0.95) 0%, rgba(26, 38, 78, 0.98) 100%);
  border-color: rgba(107, 159, 255, 0.65);
  box-shadow: 0 0 14px rgba(107, 159, 255, 0.35), 0 3px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}
.btn-action-small:active,
.btn-inspect:active,
.custom-table td button:active,
.custom-table button.btn-action-small:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  background: rgba(22, 30, 60, 0.95);
  border-color: rgba(107, 159, 255, 0.4);
}
.btn-action-small svg,
.btn-inspect svg {
  width: 12px;
  height: 12px;
  color: #6B9FFF;
  stroke: #6B9FFF;
  flex-shrink: 0;
  transition: transform 0.18s ease, color 0.18s ease;
}
.btn-action-small:hover svg,
.btn-inspect:hover svg {
  color: #a5c4ff;
  stroke: #a5c4ff;
  transform: scale(1.12);
}

