/* Horizon National Digital Banking – Professional & Fully Responsive Styles */
:root {
  --primary: #0a4d8c;
  --primary-dark: #063a6b;
  --primary-light: #1a6bb5;
  --accent: #00c853;
  --accent-dark: #00a844;
  --danger: #e53935;
  --warning: #fb8c00;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1a2332;
  --text-muted: #5a6a7a;
  --border: #e1e8ef;
  --shadow: 0 4px 20px rgba(10, 77, 140, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --header-h: 110px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

img, svg, canvas {
  max-width: 100%;
  height: auto;
}

/* ========== LOGIN ========== */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0a4d8c 0%, #063a6b 50%, #0d2b4a 100%);
  padding: 16px;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

@media (min-width: 480px) {
  .login-card {
    padding: 40px 36px;
  }
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo h1 {
  font-size: clamp(1.35rem, 4vw, 1.6rem);
  color: var(--primary);
  font-weight: 700;
  letter-spacing: -0.5px;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* prevents iOS zoom */
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 77, 140, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  min-height: 44px; /* touch target */
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}

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

.btn-secondary {
  background: #e8f0fe;
  color: var(--primary);
}

.btn-secondary:hover {
  background: #d0e0fc;
}

.btn-success {
  background: var(--accent);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

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

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
  min-height: 36px;
}

/* ========== APP SHELL ========== */
.app-header {
  background: linear-gradient(135deg, #0a4d8c 0%, #1a6bb5 100%);
  color: white;
  padding: 14px 16px 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.app-header .top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 12px;
}

.app-header .greeting {
  font-size: clamp(1.15rem, 4vw, 1.35rem);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header .user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.app-header .icon-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tabs a {
  color: rgba(255,255,255,0.75);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-tabs a.active,
.nav-tabs a:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* ========== DASHBOARD ========== */
.main-content {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 80px;
}

@media (min-width: 600px) {
  .main-content {
    max-width: 560px;
    padding: 12px 0 80px;
  }
}

@media (min-width: 768px) {
  .main-content {
    max-width: 720px;
    padding: 20px 16px 80px;
  }
  .app-header {
    border-radius: 0 0 20px 20px;
    padding: 16px 24px 12px;
  }
}

@media (min-width: 1024px) {
  .main-content {
    max-width: 860px;
  }
}

.section-label {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.9);
  margin: 8px 0 12px;
  padding: 0 16px;
  font-weight: 500;
}

.account-card {
  background: linear-gradient(145deg, #0d5aa7 0%, #0a4d8c 100%);
  border-radius: 18px;
  padding: 20px 18px;
  color: white;
  margin: 0 12px 20px;
  box-shadow: 0 8px 24px rgba(10, 77, 140, 0.35);
  position: relative;
}

@media (min-width: 480px) {
  .account-card {
    margin: 0 16px 20px;
    padding: 22px 20px;
  }
}

.account-card .acc-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.account-card .acc-label {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-bottom: 2px;
}

.account-card .acc-number {
  font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 0.5px;
  word-break: break-all;
}

.account-card .balance {
  font-size: clamp(1.4rem, 5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.5px;
  text-align: right;
}

.account-card .balance-label {
  font-size: 0.75rem;
  opacity: 0.8;
  text-align: right;
  margin-top: 2px;
}

.account-card .default-badge {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 0.75rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 4px;
}

.quick-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0 12px 24px;
  flex-wrap: wrap;
}

@media (min-width: 400px) {
  .quick-actions {
    gap: 16px;
    margin: 0 16px 28px;
  }
}

.action-btn {
  background: white;
  border: none;
  border-radius: 14px;
  width: 84px;
  height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  color: var(--text);
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

@media (min-width: 400px) {
  .action-btn {
    width: 90px;
    height: 90px;
    font-size: 0.85rem;
    gap: 8px;
  }
}

.action-btn:hover,
.action-btn:active {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(10, 77, 140, 0.15);
}

.action-btn .icon {
  width: 34px;
  height: 34px;
  background: #e8f0fe;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--primary);
}

/* Transactions section */
.tx-section {
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 18px 12px 40px;
  min-height: 280px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.04);
}

@media (min-width: 480px) {
  .tx-section {
    padding: 20px 16px 40px;
  }
}

.tx-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
  padding: 0 4px;
}

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

.tx-table th {
  text-align: left;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

.tx-table td {
  padding: 12px 4px;
  border-bottom: 1px solid #f0f4f8;
  font-size: 0.85rem;
  vertical-align: middle;
  word-break: break-word;
}

@media (min-width: 480px) {
  .tx-table th {
    font-size: 0.75rem;
    padding: 8px 6px;
  }
  .tx-table td {
    padding: 14px 6px;
    font-size: 0.9rem;
  }
}

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

/* Make table columns flexible on very small screens */
.tx-table th:nth-child(1),
.tx-table td:nth-child(1) { width: 22%; }
.tx-table th:nth-child(2),
.tx-table td:nth-child(2) { width: 28%; }
.tx-table th:nth-child(3),
.tx-table td:nth-child(3) { width: 22%; }
.tx-table th:nth-child(4),
.tx-table td:nth-child(4) { width: 28%; }

.flag-us {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: lowercase;
  white-space: nowrap;
}

@media (min-width: 480px) {
  .badge {
    padding: 3px 10px;
    font-size: 0.75rem;
  }
}

.badge-credit {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-debit {
  background: #ffebee;
  color: #c62828;
}

.badge-pending {
  background: #fff3e0;
  color: #ef6c00;
}

/* ========== GENERIC PAGES ========== */
.page-header {
  background: white;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h1 {
  font-size: clamp(1.05rem, 3.5vw, 1.2rem);
  font-weight: 700;
}

.back-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--primary);
  padding: 6px;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px;
  box-shadow: var(--shadow);
}

@media (min-width: 480px) {
  .card {
    padding: 20px;
    margin: 16px;
  }
}

.card h3 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  font-weight: 650;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px;
}

@media (min-width: 480px) {
  .stat-grid {
    gap: 12px;
    margin: 16px;
  }
}

@media (min-width: 768px) {
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-card .value {
  font-size: clamp(1.15rem, 4vw, 1.4rem);
  font-weight: 700;
  margin-top: 4px;
  word-break: break-word;
}

/* Forms */
.form-card {
  margin: 12px;
}

@media (min-width: 480px) {
  .form-card {
    margin: 16px;
  }
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.form-actions .btn {
  flex: 1;
  min-width: 120px;
}

/* Investment */
.holding-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.holding-item:last-child {
  border-bottom: none;
}

.positive { color: #2e7d32; }
.negative { color: #c62828; }

/* ========== ADMIN (responsive) ========== */
.admin-layout {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

@media (min-width: 768px) {
  .admin-layout {
    flex-direction: row;
  }
}

.admin-sidebar {
  width: 100%;
  background: var(--primary-dark);
  color: white;
  padding: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 90;
}

@media (min-width: 768px) {
  .admin-sidebar {
    width: 220px;
    min-height: 100vh;
    padding: 20px 0;
  }
}

.admin-sidebar .brand {
  padding: 16px 20px;
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (min-width: 768px) {
  .admin-sidebar .brand {
    padding: 0 20px 24px;
    margin-bottom: 16px;
  }
}

/* Mobile admin menu toggle */
.admin-menu-toggle {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .admin-menu-toggle {
    display: none;
  }
}

.admin-nav {
  display: none;
  flex-direction: column;
  padding-bottom: 12px;
}

.admin-nav.open {
  display: flex;
}

@media (min-width: 768px) {
  .admin-nav {
    display: flex !important;
  }
}

.admin-sidebar a {
  display: block;
  padding: 12px 20px;
  color: rgba(255,255,255,0.8);
  font-size: 0.95rem;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.admin-main {
  flex: 1;
  background: var(--bg);
  overflow-x: auto;
  min-width: 0; /* critical for flex children */
}

.admin-topbar {
  background: white;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .admin-topbar {
    padding: 14px 24px;
  }
}

.table-wrap {
  overflow-x: auto;
  margin: 12px;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 480px) {
  .table-wrap {
    margin: 16px;
  }
}

.data-table {
  width: 100%;
  min-width: 560px; /* forces horizontal scroll on very small screens */
  background: white;
  border-radius: var(--radius);
  border-collapse: collapse;
  box-shadow: var(--shadow);
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

@media (min-width: 640px) {
  .data-table th,
  .data-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
  }
}

.data-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  white-space: nowrap;
}

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

/* Status badges for admin */
.status-active { color: #2e7d32; font-weight: 600; }
.status-suspended { color: #c62828; font-weight: 600; }
.status-pending { color: #ef6c00; font-weight: 600; }

/* Footer note */
.compliance-note {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 16px 12px;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.45;
}

@media (min-width: 480px) {
  .compliance-note {
    font-size: 0.75rem;
    padding: 20px 16px;
  }
}

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 12px; }
.mb-2 { margin-bottom: 12px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a2332;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity 0.3s;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
}

/* MFA modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  max-height: 90vh;
  overflow-y: auto;
}

@media (min-width: 400px) {
  .modal {
    padding: 28px;
  }
}

.modal h3 {
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* Extra small phones */
@media (max-width: 359px) {
  .action-btn {
    width: 76px;
    height: 76px;
    font-size: 0.75rem;
  }
  .account-card .balance {
    font-size: 1.25rem;
  }
  .quick-actions {
    gap: 8px;
  }
}

/* Large desktop polish */
@media (min-width: 1200px) {
  .main-content {
    max-width: 960px;
  }
  .card, .form-card, .table-wrap {
    margin-left: auto;
    margin-right: auto;
    max-width: 900px;
  }
}
