/* ==========================================================================
   TravellerProfile Advisor UI Stylesheet
   --------------------------------------------------------------------------
   GLOSSARY
   --------------------------------------------------------------------------
   :root                = design tokens (colors, radius, spacing, shadows)
   body                 = global typography and page background
   .app-shell           = main app layout (sidebar + content)
   .sidebar             = left navigation
   .main-content        = primary page content area
   .page-header         = page title + right-side actions
   .card                = reusable content container
   .grid / .grid.two    = generic content grids
   .table               = standard table styling
   .actions             = top action bars / toolbars
   .button*             = primary / secondary button styles
   .form-grid           = two-column form layout
   input/select/textarea= standard form controls
   .auth-*              = login/auth screens
   .flash*              = success / error banners
   .stack               = vertical spacing utility
   .muted               = secondary text utility
   .inline-form         = compact inline forms
   .traveller-form      = traveller create/edit page wrapper
   .form-section        = grouped form section card
   .checkbox-row        = aligned checkbox + label
   .error-list          = validation messages
   .table.compact       = key/value compact table styling
   code                 = inline code styling
   --------------------------------------------------------------------------
   DESIGN NOTES
   --------------------------------------------------------------------------
   - Lightweight, framework-free SaaS admin styling
   - Soft contrast, strong readability, modern spacing
   - Focused on forms, data entry, and profile management UX
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */

:root {
  /* Color system */
  --bg: #f4f7fb;
  --bg-soft: #eef3f9;
  --surface: #ffffff;
  --surface-alt: #f8fbff;
  --border: #d9e3ef;
  --border-strong: #c5d3e3;

  --text: #162235;
  --text-soft: #41536b;
  --text-muted: #6c7b91;
  --text-inverse: #eef4ff;

  --nav: #162132;
  --nav-hover: rgba(255, 255, 255, 0.08);
  --nav-active: rgba(255, 255, 255, 0.14);

  --accent: #0f62fe;
  --accent-hover: #0b57e3;
  --accent-soft: #e8f0ff;

  --success-bg: #ecfdf3;
  --success-text: #166534;
  --success-border: #bbf7d0;

  --error-bg: #fef2f2;
  --error-text: #991b1b;
  --error-border: #fecaca;

  --warning-bg: #fff8e8;
  --warning-text: #92400e;
  --warning-border: #f6d79d;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, 0.08);

  /* Layout */
  --sidebar-width: 248px;
  --content-max: 1400px;

  /* Typography */
  --font-sans: Inter, "Segoe UI", Arial, sans-serif;
  --font-size-base: 14px;
  --line-height-base: 1.5;
}


/* ==========================================================================
   2. GLOBAL RESET + BASE
   ========================================================================== */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(15, 98, 254, 0.04), transparent 22%),
    linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.18s ease, opacity 0.18s ease;
}

a:hover {
  color: var(--accent-hover);
}

strong {
  font-weight: 600;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

code {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: #eef2f7;
  color: #24344a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}


/* ==========================================================================
   3. APP LAYOUT
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.main-content {
  padding: var(--space-7);
}

.main-content > * {
  max-width: var(--content-max);
}


/* ==========================================================================
   4. SIDEBAR
   ========================================================================== */

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 24%),
    var(--nav);
  color: var(--text-inverse);
  padding: var(--space-6);
  display: grid;
  gap: var(--space-2);
  align-content: start;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}

.sidebar .brand {
  margin-bottom: var(--space-4);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar a {
  display: block;
  color: var(--text-inverse);
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 500;
  transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.sidebar a:hover {
  background: var(--nav-hover);
  color: #ffffff;
  transform: translateX(1px);
}

.sidebar a.active,
.sidebar a[aria-current="page"] {
  background: var(--nav-active);
  color: #ffffff;
}


/* ==========================================================================
   5. PAGE HEADER + TOOLBARS
   ========================================================================== */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.page-header h1,
.page-header h2 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 var(--space-5);
}


/* ==========================================================================
   6. CARD SYSTEM
   ========================================================================== */

.card {
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}

.card + .card {
  margin-top: var(--space-5);
}

.card h2,
.card h3,
.card h4 {
  margin-top: 0;
  margin-bottom: var(--space-3);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.card p:last-child,
.card ul:last-child,
.card table:last-child {
  margin-bottom: 0;
}


/* ==========================================================================
   7. GRID UTILITIES
   ========================================================================== */

.grid {
  display: grid;
  gap: var(--space-5);
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stack {
  display: grid;
  gap: var(--space-3);
}

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


/* ==========================================================================
   8. BUTTONS
   ========================================================================== */

.button,
button.button,
input[type="submit"].button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent) 0%, #0b57e3 100%);
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 98, 254, 0.18);
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease;
}

.button:hover,
button.button:hover,
input[type="submit"].button:hover {
  background: linear-gradient(180deg, var(--accent-hover) 0%, #084bcc 100%);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 98, 254, 0.22);
}

.button:active,
button.button:active,
input[type="submit"].button:active {
  transform: translateY(0);
}

.button-secondary {
  background: linear-gradient(180deg, #6b7b91 0%, #59687d 100%);
  box-shadow: 0 8px 18px rgba(75, 85, 99, 0.14);
}

.button-secondary:hover {
  background: linear-gradient(180deg, #607086 0%, #516074 100%);
}

.button-small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}


/* ==========================================================================
   9. TABLES
   ========================================================================== */

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
}

.table thead th {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
  background: rgba(15, 98, 254, 0.025);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table.compact th {
  width: 180px;
  color: var(--text-muted);
  font-weight: 600;
  background: transparent;
}


/* ==========================================================================
   10. FORMS
   ========================================================================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.form-grid .full {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-soft);
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: rgba(15, 98, 254, 0.65);
  box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.12);
  background: #ffffff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}


/* ==========================================================================
   11. TRAVELLER FORM EXPERIENCE
   ========================================================================== */

.traveller-form {
  display: grid;
  gap: var(--space-6);
}

.form-section {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.form-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.form-section h2 {
  margin: 0 0 var(--space-2);
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.form-section > p,
.form-section .muted {
  margin-top: 0;
  margin-bottom: var(--space-4);
}


/* ==========================================================================
   12. FLASH + VALIDATION STATES
   ========================================================================== */

.flash {
  margin-bottom: var(--space-5);
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 500;
}

.flash.success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.flash.error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: var(--error-border);
}

.error-list {
  margin: 10px 0 0 18px;
  padding: 0;
  color: var(--error-text);
}

.error-list li + li {
  margin-top: 4px;
}


/* ==========================================================================
   13. AUTH SCREENS
   ========================================================================== */

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--space-6);
}

.auth-card {
  width: min(440px, 94vw);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.auth-card h1,
.auth-card h2 {
  margin-top: 0;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-card p {
  color: var(--text-muted);
  margin-top: 0;
  margin-bottom: var(--space-5);
}


/* ==========================================================================
   14. INLINE / SEARCH / SMALL COMPONENTS
   ========================================================================== */

.search-list {
  display: grid;
  gap: 8px;
  margin-top: var(--space-3);
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 120px 140px auto;
  gap: 8px;
  align-items: center;
}


/* ==========================================================================
   15. RESPONSIVE
   ========================================================================== */

@media (max-width: 1100px) {
  .main-content {
    padding: var(--space-6);
  }

  .grid.two,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    align-items: center;
    padding: 14px 16px;
    gap: 8px;
  }

  .sidebar .brand {
    margin: 0 10px 0 0;
    padding-right: 8px;
    white-space: nowrap;
  }

  .sidebar a {
    white-space: nowrap;
  }

  .main-content {
    padding: var(--space-5);
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .card,
  .auth-card {
    padding: var(--space-4);
  }

  .table th,
  .table td {
    padding: 10px 12px;
  }

  .button,
  .button-secondary {
    width: 100%;
  }

  .actions {
    align-items: stretch;
  }
}

/* ==========================================================================
   16. FIELD-LEVEL ERROR STATES
   ========================================================================== */

.input-error {
  border-color: var(--error-border) !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.10) !important;
  background: #fffafa;
}

.error-text {
  display: block;
  margin-top: 6px;
  color: var(--error-text);
  font-size: 12px;
  font-weight: 600;
}