/* ============================================================
   GlobalTrust Bank - Design System & Global Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* ---- CSS Variables ---- */
:root {
  --navy:        #0A1628;
  --navy-mid:    #0F2044;
  --navy-light:  #1A3060;
  --gold:        #C9A84C;
  --gold-light:  #E5C87A;
  --gold-pale:   #F5EDD6;
  --white:       #FFFFFF;
  --off-white:   #F8F7F4;
  --gray-100:    #F2F1EE;
  --gray-200:    #E5E3DE;
  --gray-300:    #C8C5BD;
  --gray-400:    #9E9A90;
  --gray-500:    #6B6760;
  --gray-700:    #3A3832;
  --gray-900:    #1A1917;
  --green:       #1A7A4A;
  --green-light: #E8F5EE;
  --red:         #B83232;
  --red-light:   #FDECEC;
  --blue:        #1A4A8A;
  --blue-light:  #EBF1FA;
  --shadow-sm:   0 1px 3px rgba(10,22,40,0.08);
  --shadow-md:   0 4px 16px rgba(10,22,40,0.10);
  --shadow-lg:   0 12px 40px rgba(10,22,40,0.14);
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', -apple-system, sans-serif;
  --transition:   0.2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--gray-900);
  background: var(--white);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--navy);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.75rem); }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }

.text-gold   { color: var(--gold); }
.text-navy   { color: var(--navy); }
.text-muted  { color: var(--gray-500); }
.text-sm     { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.text-lg     { font-size: 1.125rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--wide { max-width: 1400px; }
.container--narrow { max-width: 800px; }

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent;
  transition: background var(--transition), box-shadow var(--transition);
  padding: 0;
}

.nav.nav--scrolled {
  background: var(--white);
  box-shadow: var(--shadow-md);
}

.nav.nav--dark {
  background: var(--navy);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 0 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

.nav__logo-mark {
  width: 36px;
  height: 36px;
  background: var(--gold);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy);
  letter-spacing: -0.5px;
}

.nav__logo-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--white);
  line-height: 1.2;
}

.nav__logo-text span {
  display: block;
  font-size: 0.6rem;
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-light);
}

.nav.nav--scrolled .nav__logo-text,
.nav--light .nav__logo-text {
  color: var(--navy);
}

.nav.nav--scrolled .nav__logo-text span,
.nav--light .nav__logo-text span {
  color: var(--gray-500);
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav__link {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  letter-spacing: 0.01em;
}

.nav__link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.08);
}

.nav.nav--scrolled .nav__link,
.nav--light .nav__link {
  color: var(--gray-700);
}

.nav.nav--scrolled .nav__link:hover,
.nav--light .nav__link:hover {
  color: var(--navy);
  background: var(--gray-100);
}

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

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav.nav--scrolled .nav__toggle span { background: var(--navy); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}

.btn--primary {
  background: var(--gold);
  color: var(--navy);
  border: 1.5px solid var(--gold);
}

.btn--primary:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(201,168,76,0.35);
}

.btn--outline {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.4);
}

.btn--outline:hover {
  border-color: var(--white);
  background: rgba(255,255,255,0.08);
}

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

.btn--outline-dark:hover {
  background: var(--navy);
  color: var(--white);
}

.btn--ghost {
  background: transparent;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
}

.btn--ghost:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.btn--danger {
  background: var(--red);
  color: var(--white);
  border: 1.5px solid var(--red);
}

.btn--danger:hover { opacity: 0.9; }

.btn--lg { padding: 0.875rem 2rem; font-size: 0.9375rem; }
.btn--sm { padding: 0.4375rem 1rem; font-size: 0.8125rem; }
.btn--xl { padding: 1rem 2.5rem; font-size: 1rem; }
.btn--full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card--elevated { box-shadow: var(--shadow-md); }
.card--navy { background: var(--navy); border-color: var(--navy-light); }
.card--gold { background: var(--gold); border-color: var(--gold); }

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

.card__body { padding: 1.5rem; }
.card__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-100);
}

/* ---- Forms ---- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-700);
  letter-spacing: 0.01em;
}

.form-input {
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}

.form-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(10,22,40,0.08);
}

.form-input::placeholder { color: var(--gray-400); }
.form-input--error { border-color: var(--red); }
.form-error { font-size: 0.8125rem; color: var(--red); }
.form-hint { font-size: 0.8125rem; color: var(--gray-500); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6760' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* ---- Badges & Tags ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.badge--green  { background: var(--green-light); color: var(--green); }
.badge--red    { background: var(--red-light); color: var(--red); }
.badge--blue   { background: var(--blue-light); color: var(--blue); }
.badge--gold   { background: var(--gold-pale); color: #8B6914; }
.badge--gray   { background: var(--gray-100); color: var(--gray-500); }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-100); }

/* ---- Divider ---- */
.divider {
  height: 1px;
  background: var(--gray-200);
  margin: 1.5rem 0;
}

/* ---- Alerts ---- */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.alert--success { background: var(--green-light); color: var(--green); border: 1px solid #A3D9B8; }
.alert--error   { background: var(--red-light); color: var(--red); border: 1px solid #F5C0C0; }
.alert--info    { background: var(--blue-light); color: var(--blue); border: 1px solid #B8CCE8; }
.alert--warning { background: var(--gold-pale); color: #8B6914; border: 1px solid #DFC98A; }

/* ---- Utility ---- */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.p-4  { padding: 1rem; }
.p-6  { padding: 1.5rem; }
.w-full { width: 100%; }
.grid { display: grid; }
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Loading Spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner--dark {
  border-color: rgba(10,22,40,0.15);
  border-top-color: var(--navy);
}

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

/* ---- Skeleton Loader ---- */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

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

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

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform var(--transition);
  box-shadow: var(--shadow-lg);
}

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

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

.modal__body { padding: 1.5rem; }
.modal__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: background var(--transition), color var(--transition);
}

.modal__close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

/* ---- Sidebar Layout (Dashboard) ---- */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar__logo {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.sidebar__logo-mark {
  width: 34px;
  height: 34px;
  background: var(--gold);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy);
}

.sidebar__logo-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--white);
  line-height: 1.2;
}

.sidebar__logo-text span {
  display: block;
  font-size: 0.55rem;
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-light);
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar__section {
  margin-bottom: 0.25rem;
}

.sidebar__section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 0.5rem 1.5rem 0.25rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  border-radius: 0;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.sidebar__link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.06);
}

.sidebar__link.is-active {
  color: var(--white);
  background: rgba(201,168,76,0.12);
  border-left-color: var(--gold);
  font-weight: 500;
}

.sidebar__link svg { flex-shrink: 0; opacity: 0.75; }
.sidebar__link.is-active svg { opacity: 1; }

.sidebar__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar__user:hover { background: rgba(255,255,255,0.06); }

.sidebar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy);
  flex-shrink: 0;
}

.sidebar__user-info {
  flex: 1;
  min-width: 0;
}

.sidebar__user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--white);
  line-height: 1.3;
}

.sidebar__user-role {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  text-transform: capitalize;
}

/* ---- Main Content Area ---- */
.main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--off-white);
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--navy);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-content {
  padding: 2rem;
  flex: 1;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-card__label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.1;
}

.stat-card__change {
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-card__change.positive { color: var(--green); }
.stat-card__change.negative { color: var(--red); }

.stat-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
}

/* ---- Account Cards ---- */
.account-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  color: var(--white);
  position: relative;
  overflow: hidden;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.account-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(201,168,76,0.08);
}

.account-card::after {
  content: '';
  position: absolute;
  bottom: -60px;
  right: 30px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.account-card__type {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-light);
}

.account-card__balance {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.account-card__number {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.05em;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .nav__toggle { display: flex; }
}

@media (max-width: 768px) {
  .nav__menu { display: none; }
  .nav__menu.is-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--navy);
    padding: 1rem;
    gap: 0.25rem;
  }
  .nav__menu.is-open .nav__link {
    padding: 0.75rem 1rem;
    width: 100%;
    color: rgba(255,255,255,0.85);
  }
  .page-content { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 1rem; }
  .table th:nth-child(n+4),
  .table td:nth-child(n+4) { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .btn--xl { padding: 0.875rem 1.75rem; }
}

/* ---- Page Transitions ---- */
.page-fade-in {
  animation: fadeInUp 0.35s ease forwards;
}

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