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

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --bg:            #080c17;
  --bg2:           #0d1424;
  --surface:       rgba(255,255,255,0.04);
  --surface-2:     rgba(255,255,255,0.07);
  --surface-hover: rgba(255,255,255,0.10);
  --border:        rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);

  --teal:      #00d4aa;
  --teal-dark: #00a882;
  --teal-glow: rgba(0,212,170,0.22);
  --teal-dim:  rgba(0,212,170,0.10);

  --amber:     #f59e0b;
  --amber-dim: rgba(245,158,11,0.12);

  --red:       #f87171;
  --red-dim:   rgba(248,113,113,0.12);

  --green:     #4ade80;
  --green-dim: rgba(74,222,128,0.12);

  --blue:      #60a5fa;
  --blue-dim:  rgba(96,165,250,0.12);

  --text:      #e2e8f0;
  --text-2:    #94a3b8;
  --text-3:    #475569;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 40px rgba(0,212,170,0.08);
  --transition:  0.2s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { font-size: 16px; scroll-behavior: smooth; }
body  {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Ambient gradient background */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%,   rgba(0,212,170,0.06)  0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%,  rgba(96,165,250,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 { font-size: 2rem;     font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem;   font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 0.9375rem;font-weight: 600; }
a  { color: var(--teal); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

.text-teal   { color: var(--teal);  }
.text-amber  { color: var(--amber); }
.text-red    { color: var(--red);   }
.text-green  { color: var(--green); }
.text-muted  { color: var(--text-2);}

/* ============================================================
   GLASS CARD
   ============================================================ */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent);
}
.card-sm { padding: 1rem;  border-radius: var(--radius);    }
.card-lg { padding: 2rem;  border-radius: var(--radius-xl); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: inherit; font-size: 0.875rem; font-weight: 600;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
  position: relative; overflow: hidden; user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0.06);
  opacity: 0; transition: opacity var(--transition);
}
.btn:hover:not(:disabled)::after { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #020a08; border-color: var(--teal);
  box-shadow: 0 0 20px var(--teal-glow);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--teal-glow);
}

.btn-danger {
  background: var(--red-dim); color: var(--red);
  border-color: rgba(248,113,113,0.30);
}
.btn-danger:hover:not(:disabled) { background: rgba(248,113,113,0.20); transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface-2); color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); transform: translateY(-1px); }

.btn-amber {
  background: var(--amber-dim); color: var(--amber);
  border-color: rgba(245,158,11,0.30);
}
.btn-amber:hover:not(:disabled) { background: rgba(245,158,11,0.22); transform: translateY(-1px); }

.btn-ghost {
  background: transparent; color: var(--text-2); border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--surface); color: var(--text); }

.btn-sm  { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg  { padding: 0.875rem 1.75rem; font-size: 1rem;      }
.btn-full{ width: 100%; }
.btn-icon{ padding: 0.5rem; border-radius: var(--radius-sm); aspect-ratio: 1; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }

.form-label {
  font-size: 0.8125rem; font-weight: 500; color: var(--text-2);
  letter-spacing: 0.03em; text-transform: uppercase;
}

.form-input, .form-select {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  font-family: inherit; font-size: 0.9375rem; color: var(--text);
  transition: all var(--transition); width: 100%; outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-dim);
  background: var(--surface-hover);
}
.form-input::placeholder { color: var(--text-3); }
.form-input:disabled, .form-select:disabled {
  opacity: 0.6; cursor: not-allowed;
}

.amount-wrapper { position: relative; }
.amount-prefix {
  position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%);
  color: var(--amber); font-weight: 700; font-size: 1rem;
  pointer-events: none;
}
.amount-input { padding-left: 2.25rem !important; }

.form-select {
  appearance: none; cursor: pointer;
  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='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
  padding-right: 2.5rem;
}
.form-select option { background: #0d1424; color: var(--text); }

/* Radio group (Cash / Online) */
.radio-group { display: flex; gap: 0.75rem; }
.radio-option { flex: 1; }
.radio-option input[type="radio"] { display: none; }
.radio-label {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  font-size: 0.875rem; font-weight: 500; color: var(--text-2);
}
.radio-option input[type="radio"]:checked + .radio-label {
  background: var(--teal-dim); border-color: var(--teal); color: var(--teal);
}
.radio-label:hover { background: var(--surface-hover); color: var(--text); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrapper {
  overflow-x: auto; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { background: var(--surface-2); border-bottom: 1px solid var(--border); }
th {
  padding: 0.875rem 1rem; text-align: left;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2);
}
td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface); }
.empty-state { text-align: center; color: var(--text-3); padding: 3rem !important; font-size: 0.875rem; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; padding: 0.2rem 0.6rem;
  border-radius: 999px; font-size: 0.7375rem; font-weight: 600; letter-spacing: 0.03em;
}
.badge-teal   { background: var(--teal-dim);  color: var(--teal);  border: 1px solid rgba(0,212,170,0.2);  }
.badge-amber  { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }
.badge-red    { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(248,113,113,0.2);}
.badge-green  { background: var(--green-dim); color: var(--green); border: 1px solid rgba(74,222,128,0.2); }
.badge-blue   { background: var(--blue-dim);  color: var(--blue);  border: 1px solid rgba(96,165,250,0.2); }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast {
  position: fixed; bottom: 2rem; right: 2rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.875rem 1.25rem;
  font-size: 0.9375rem; font-weight: 500;
  backdrop-filter: blur(20px); box-shadow: var(--shadow);
  transform: translateY(120%); opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 9999; max-width: 320px;
  display: flex; align-items: center; gap: 0.5rem;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(74,222,128,0.35);  color: var(--green); }
.toast.error   { border-color: rgba(248,113,113,0.35); color: var(--red);   }
.toast.info    { border-color: rgba(0,212,170,0.35);   color: var(--teal);  }

/* ============================================================
   LOADING / SPINNER
   ============================================================ */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid transparent; border-top-color: currentColor;
  border-radius: 50%; animation: spin 0.6s linear infinite;
  display: inline-block; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
  position: fixed; inset: 0;
  background: var(--bg); display: flex;
  align-items: center; justify-content: center;
  z-index: 9990; flex-direction: column; gap: 1rem;
  transition: opacity 0.4s ease;
}
.page-loader.hidden { opacity: 0; pointer-events: none; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(5px); display: flex;
  align-items: center; justify-content: center;
  z-index: 9997; opacity: 0; pointer-events: none;
  transition: opacity var(--transition); padding: 1rem;
}
.modal-backdrop.show { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl); padding: 2rem;
  width: 100%; max-width: 480px;
  transform: scale(0.94) translateY(12px);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
}
.modal-backdrop.show .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-close {
  background: none; border: none; color: var(--text-2);
  cursor: pointer; font-size: 1.125rem; line-height: 1;
  padding: 0.25rem; transition: color var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card { display: flex; flex-direction: column; gap: 0.375rem; }
.stat-label {
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2);
}
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-value.amber { color: var(--amber); }
.stat-value.teal  { color: var(--teal);  }
.stat-sub { font-size: 0.8125rem; color: var(--text-2); margin-top: 0.125rem; }

/* ============================================================
   SETTLEMENT CARDS
   ============================================================ */
.settlement-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 0.875rem;
  transition: background var(--transition);
}
.settlement-card:hover { background: var(--surface-hover); }
.settlement-from { font-weight: 600; }
.settlement-arrow { color: var(--amber); font-size: 1.125rem; flex-shrink: 0; }
.settlement-to { font-weight: 600; color: var(--teal); }
.settlement-amount {
  font-size: 1.0625rem; font-weight: 700; color: var(--amber);
  margin-left: auto; flex-shrink: 0;
}

/* ============================================================
   MEMBER ITEMS
   ============================================================ */
.member-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.875rem 1rem;
  display: flex; align-items: center; gap: 0.75rem;
  transition: background var(--transition);
}
.member-item:hover { background: var(--surface-hover); }
.member-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--teal-dim); border: 1px solid rgba(0,212,170,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; font-weight: 700; color: var(--teal); flex-shrink: 0;
}
.member-name { font-weight: 600; font-size: 0.9375rem; }
.member-meta { font-size: 0.75rem; color: var(--text-2); }
.member-actions { margin-left: auto; display: flex; gap: 0.375rem; }

/* ============================================================
   TRIP ITEMS
   ============================================================ */
.trip-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 0.875rem;
  transition: background var(--transition);
}
.trip-item:hover { background: var(--surface-hover); }
.trip-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--blue-dim); display: flex; align-items: center;
  justify-content: center; font-size: 1.25rem; flex-shrink: 0;
}
.trip-name { font-weight: 600; }
.trip-status { font-size: 0.75rem; color: var(--text-2); }
.trip-actions { margin-left: auto; display: flex; gap: 0.375rem; }

/* ============================================================
   TAB NAVIGATION
   ============================================================ */
.tabs {
  display: flex; gap: 0.25rem;
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 0.375rem; border: 1px solid var(--border);
}
.tab-btn {
  flex: 1; padding: 0.625rem 0.75rem;
  background: none; border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 0.875rem; font-weight: 500;
  color: var(--text-2); cursor: pointer; transition: all var(--transition);
}
.tab-btn.active {
  background: var(--surface-2); color: var(--teal); font-weight: 600;
  box-shadow: 0 1px 6px rgba(0,0,0,0.2);
}
.tab-btn:hover:not(.active) { color: var(--text); background: var(--surface-hover); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,12,23,0.85); backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
  display: flex; align-items: center; gap: 0.625rem; font-weight: 700; font-size: 1.0625rem;
}
.navbar-brand-icon {
  width: 34px; height: 34px; background: var(--teal-dim);
  border: 1px solid rgba(0,212,170,0.3); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.navbar-right { display: flex; align-items: center; gap: 1rem; }
.navbar-user {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.375rem 0.875rem;
  font-size: 0.875rem; font-weight: 500;
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page-content {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto;
  padding: 2rem 1.5rem;
}
.page-content-wide { max-width: 1400px; }

/* ============================================================
   SECTION HEADER
   ============================================================ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title {
  font-size: 0.8125rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-2);
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* ============================================================
   ALERT BANNERS
   ============================================================ */
.alert {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.875rem 1rem; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
}
.alert-warning { background: var(--amber-dim); border: 1px solid rgba(245,158,11,0.3); color: var(--amber); }
.alert-error   { background: var(--red-dim);   border: 1px solid rgba(248,113,113,0.3); color: var(--red);   }
.alert-success { background: var(--green-dim); border: 1px solid rgba(74,222,128,0.3);  color: var(--green); }
.alert-info    { background: var(--teal-dim);  border: 1px solid rgba(0,212,170,0.3);   color: var(--teal);  }

/* ============================================================
   GRID
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr;        gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr);   gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr);   gap: 1rem; }
.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-end    { justify-content: flex-end; }
.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-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }
.text-center { text-align: center; } .text-right { text-align: right; }
.hidden { display: none !important; }
.relative { position: relative; }

/* ============================================================
   LIST STACKS
   ============================================================ */
.item-list { display: flex; flex-direction: column; gap: 0.625rem; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  body { background: #fff; color: #111; }
  body::before { display: none; }
  .no-print { display: none !important; }
  .card { background: #fff; border: 1px solid #ddd; box-shadow: none; backdrop-filter: none; }
  .toast, .modal-backdrop, .navbar { display: none; }
  .page-content { padding: 0; }
  .settlement-card { border: 1px solid #ddd; background: #f9f9f9; }
  .settlement-from, .settlement-to, .settlement-amount { color: #111; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .stat-value { font-size: 1.5rem; }
  .toast { right: 1rem; left: 1rem; max-width: none; bottom: 1.25rem; }
  .navbar { padding: 0 1rem; }
  .page-content { padding: 1.25rem 1rem; }
  .tabs { flex-wrap: wrap; }
  .tab-btn { font-size: 0.8125rem; }
}
