/* ================================================================
   HMS Design System — "Sky Breeze" Theme
   A clean, modern CSS foundation for all dashboard pages.
   Works alongside Tailwind CDN utilities + Bootstrap 5.3 components.
   ================================================================ */

:root {
  /* Primary palette */
  --hms-primary: #0891b2;
  --hms-primary-light: #06b6d4;
  --hms-primary-lighter: #cffafe;
  --hms-primary-dark: #0e7490;
  --hms-primary-50: #ecfeff;

  /* Accent */
  --hms-accent: #f97316;
  --hms-accent-light: #fb923c;

  /* Service-type colors */
  --hms-flight: #0ea5e9;
  --hms-hotel: #8b5cf6;
  --hms-transfer: #f59e0b;
  --hms-cruise: #06b6d4;
  --hms-activity: #10b981;
  --hms-insurance: #6366f1;
  --hms-visa: #ec4899;
  --hms-rentcar: #f97316;

  /* Status colors */
  --hms-status-draft: #94a3b8;
  --hms-status-pending: #f59e0b;
  --hms-status-confirmed: #22c55e;
  --hms-status-completed: #06b6d4;
  --hms-status-cancelled: #ef4444;

  /* Payment status */
  --hms-pay-unpaid: #ef4444;
  --hms-pay-partial: #f59e0b;
  --hms-pay-paid: #22c55e;
  --hms-pay-refunded: #8b5cf6;

  /* Neutrals */
  --ink: #0c4a6e;
  --ink-light: #1e293b;
  --muted: #64748b;
  --border: #e0f2fe;
  --border-subtle: rgba(14,116,144,0.06);
  --panel: #f0f9ff;
  --card: #ffffff;

  /* Shadows */
  --ring: 0 1px 3px rgba(8,47,73,0.04), 0 4px 12px rgba(8,47,73,0.02);
  --shadow-md: 0 4px 16px rgba(8,47,73,0.06);
  --shadow-lg: 0 12px 28px rgba(8,47,73,0.12);

  /* Legacy aliases (used by base_public.html) */
  --anx-bg: var(--panel);
  --anx-card: var(--card);
  --anx-border: var(--border);
  --anx-ink: var(--ink);
  --anx-muted: var(--muted);
  --anx-primary: var(--hms-primary);
  --anx-primary-600: var(--hms-primary);
  --anx-primary-700: var(--hms-primary-dark);
  --anx-accent: var(--hms-activity);
  --anx-danger: #ef4444;
  --anx-warning: #f59e0b;
  --anx-ring: var(--ring);
}

/* ── Base ── */
html, body { height: 100%; }

body {
  background: var(--panel);
  color: var(--ink-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Cards ── */
.soft-card, .card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: var(--ring);
}
.card { padding: 1rem 1.25rem; }

.enhanced-card { position: relative; overflow: hidden; }
.enhanced-card:before {
  content: "";
  position: absolute; inset: -1px; pointer-events: none;
  background:
    radial-gradient(540px 160px at 20% -50%, rgba(6,182,212,.08), transparent),
    radial-gradient(560px 180px at 120% 120%, rgba(8,145,178,.06), transparent);
}
.enhanced-card .inner { position: relative; }

/* ── Buttons ── */
.btn, a.btn, button.btn, input.btn[type=submit] {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: .88rem;
  padding: .5rem .9rem; border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff; color: var(--ink-light);
  transition: all .18s ease-in-out;
  cursor: pointer; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(8,47,73,.06); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--hms-primary); color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(8,145,178,.2);
}
.btn-primary:hover { background: var(--hms-primary-light); filter: brightness(0.97); color: #fff; }

.btn-secondary { background: #f1f5f9; color: var(--ink-light); }

.btn-danger { background: #ef4444; color: #fff; border-color: transparent; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-outline {
  background: #fff; color: var(--hms-primary-dark);
  border-color: rgba(8,145,178,.3);
}
.btn-outline:hover { background: var(--hms-primary-50); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-light); }
.btn-ghost:hover { background: #f1f5f9; }

.btn-icon {
  width: 36px; height: 36px; padding: 0; justify-content: center;
  position: absolute; top: .75rem; right: .75rem;
}

/* ── Inputs ── */
input[type="text"], input[type="number"], input[type="date"],
input[type="email"], input[type="search"], input[type="password"],
input[type="tel"], input[type="url"], input[type="datetime-local"],
select, textarea {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .55rem .8rem;
  outline: none;
  width: 100%;
  transition: box-shadow .18s ease, border-color .18s ease;
  font-size: .9rem;
  color: var(--ink-light);
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(8,145,178,.5);
  box-shadow: 0 0 0 3px rgba(8,145,178,.1);
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .65rem; font-weight: 700; border-radius: 999px; font-size: .75rem;
  border: 1px solid rgba(14,116,144,.06);
  background: #f0f9ff; color: #0e7490;
  white-space: nowrap;
}
.badge.success, .badge-green { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.badge.warn, .badge-amber { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge.danger, .badge-red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge-blue { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.badge-purple { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.badge-gray { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

.badge-dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: currentColor; opacity: .55;
}

/* ── Chips ── */
.chip {
  border-radius: 999px; padding: .3rem .7rem;
  display: inline-flex; align-items: center; gap: .4rem;
  font-weight: 600; font-size: .78rem;
  border: 1px solid rgba(14,116,144,.08);
  background: #ecfeff; color: #0e7490;
}
.chip i { font-size: .78rem; }
.chip-orange { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.chip-green  { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.chip-rose   { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* chip toggle (filter modal) */
.chip-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem; border-radius: 999px;
  font-size: .82rem; font-weight: 600;
  border: 1px solid var(--border); background: #fff;
  color: var(--muted); cursor: pointer;
  transition: all .15s;
}
.chip-toggle:hover { border-color: var(--hms-primary); color: var(--hms-primary); }
.chip-on {
  background: var(--hms-primary) !important; color: #fff !important;
  border-color: var(--hms-primary) !important;
}
.chip-off {
  background: #fff; color: var(--muted);
  border-color: var(--border);
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
}
thead th {
  background: #f8fafc;
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #64748b;
  text-align: left;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 700;
}
tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid rgba(14,116,144,.04);
  vertical-align: middle;
  font-size: .88rem;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f0fdfa; }

/* ── Toolbar ── */
.toolbar {
  display: flex; flex-wrap: wrap; gap: .5rem;
  align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.toolbar .left, .toolbar .right { display: flex; gap: .5rem; align-items: center; }
.toolbar .search-wrap {
  position: relative; min-width: 240px; max-width: 360px; width: 100%;
}
.toolbar .search-wrap input[type="search"] { padding-left: 2.25rem; }
.toolbar .search-wrap .ico {
  position: absolute; left: .65rem; top: 50%; transform: translateY(-50%);
  opacity: .5; font-size: .88rem; color: var(--hms-primary);
}

/* ── Pagination ── */
nav.pagination, .pagination nav {
  display: flex; gap: .4rem; flex-wrap: wrap;
  align-items: center; justify-content: flex-end; margin-top: 1rem;
}
nav.pagination a, .pagination a, .pagination span {
  border: 1px solid var(--border);
  padding: .35rem .75rem; border-radius: 8px; font-size: .85rem;
  color: var(--ink-light); background: #fff; text-decoration: none;
  transition: all .15s;
}
nav.pagination a:hover, .pagination a:hover {
  background: var(--hms-primary-50); border-color: var(--hms-primary);
  color: var(--hms-primary);
}
nav.pagination .active, .pagination .active {
  background: var(--hms-primary); color: #fff; border-color: transparent;
}

/* ── Page header ── */
.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin-bottom: 1rem;
}
.page-head h1 { font-weight: 800; font-size: 1.35rem; color: var(--ink); }
.page-head .actions { display: flex; gap: .5rem; align-items: center; }

/* ── Utility helpers ── */
.grid-auto {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr));
  gap: 1rem;
}
.table-wrap { overflow-x: auto; border-radius: 14px; }
.sticky-head thead th { position: sticky; top: 0; z-index: 1; }

/* Action bar links */
.actions a:not(.btn) {
  border: 1px solid var(--border); border-radius: 10px; padding: .45rem .75rem;
  color: var(--ink-light); background: #fff; display: inline-flex; align-items: center; gap: .45rem;
  font-weight: 600; font-size: .88rem; text-decoration: none;
}
.actions a:not(.btn):hover { box-shadow: 0 4px 12px rgba(8,47,73,.06); transform: translateY(-1px); }

/* ── Avatars ── */
.avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .82rem;
  background: #ecfeff; color: #0e7490;
  border: 1px solid rgba(14,116,144,.08);
  flex: 0 0 auto;
}

/* ── List name (customer name + avatar in tables) ── */
.list-name {
  display: flex; align-items: center; gap: .6rem; min-width: 0;
}
.list-name .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Stat / Metric tiles (dashboard) ── */
.stat-pill {
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: rgba(255,255,255,.85);
  padding: .65rem .75rem;
}

.metric-tile {
  display: flex; align-items: center; gap: .75rem;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: rgba(255,255,255,.85);
  padding: .75rem .85rem;
  transition: transform .14s, box-shadow .14s, background .14s;
}
.metric-tile:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ── Dropdown panel ── */
.dropdown-panel { max-height: 70vh; overflow: auto; }

/* ── Form sections (booking form, CRM forms) ── */
.form-section {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--ring);
}
.form-section-title {
  font-size: .82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--hms-primary);
  margin-bottom: .75rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* ── Scrollbar styling ── */
.overflow-y-auto { scrollbar-width: thin; scrollbar-color: rgba(14,116,144,.15) transparent; }
.overflow-y-auto::-webkit-scrollbar { width: 6px; }
.overflow-y-auto::-webkit-scrollbar-track { background: transparent; }
.overflow-y-auto::-webkit-scrollbar-thumb {
  background: rgba(14,116,144,.12); border-radius: 9999px;
}
.overflow-y-auto::-webkit-scrollbar-thumb:hover { background: rgba(14,116,144,.25); }

/* ── Tab navigation ── */
.tab-nav {
  display: flex; gap: .25rem; border-bottom: 2px solid var(--border-subtle);
  margin-bottom: 1.25rem;
}
.tab-nav a, .tab-nav button {
  padding: .6rem 1rem; font-size: .85rem; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s;
  background: none; border-top: none; border-left: none; border-right: none;
  cursor: pointer; text-decoration: none;
}
.tab-nav a:hover, .tab-nav button:hover { color: var(--hms-primary); }
.tab-nav a.active, .tab-nav button.active {
  color: var(--hms-primary); border-bottom-color: var(--hms-primary); font-weight: 700;
}

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state i { font-size: 2.5rem; opacity: .3; margin-bottom: 1rem; display: block; }
.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: #94a3b8; margin-bottom: .5rem; }
.empty-state-icon {
  width: 80px; height: 80px; margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, #ecfeff, #cffafe);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.empty-state-icon i { font-size: 2rem; color: #0891b2; opacity: 1; margin-bottom: 0; }

/* ── Timeline ── */
.timeline-item {
  display: flex; gap: 1rem; padding: .75rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--hms-primary); margin-top: 5px; flex-shrink: 0;
}

/* ── Detail Page Components ── */
.detail-section {
  background: white; border-radius: 0.75rem; border: 1px solid #e5e7eb;
  margin-bottom: 1.5rem; overflow: hidden;
}
.detail-section-header {
  padding: 1rem 1.5rem; border-bottom: 1px solid #f3f4f6;
  display: flex; align-items: center; justify-content: space-between;
}
.detail-section-header h2 {
  font-size: 1.125rem; font-weight: 600; margin: 0;
  display: flex; align-items: center; gap: 0.5rem;
}
.detail-section-body { padding: 1.5rem; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.detail-field-label { font-size: 0.75rem; font-weight: 500; color: #6b7280; margin-bottom: 0.25rem; }
.detail-field-value { font-size: 0.875rem; font-weight: 500; color: #111827; }

/* ── KPI / Metric Cards ── */
.metric-tile {
  background: white; border-radius: 0.75rem; border: 1px solid #e5e7eb;
  padding: 1rem 1.25rem; display: flex; align-items: center; gap: 0.75rem;
}
.metric-tile .ico {
  width: 2.5rem; height: 2.5rem; border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 0.85rem;
}
.metric-tile .body .label { font-size: 0.8rem; color: #6b7280; font-weight: 500; }
.metric-tile .body .val { font-size: 1.5rem; font-weight: 700; color: #111827; line-height: 1.2; }

/* ── Dropdown Menu ── */
.dropdown-menu-custom {
  position: absolute; right: 0; top: 100%; margin-top: 0.25rem; min-width: 14rem;
  background: white; border-radius: 0.75rem; border: 1px solid #e5e7eb;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1); z-index: 50; display: none;
}
.dropdown-menu-custom.show { display: block; }
.dropdown-menu-custom a, .dropdown-menu-custom button {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem;
  color: #374151; text-decoration: none; border: none; background: none;
  width: 100%; text-align: start; cursor: pointer; font-size: 0.875rem;
  border-bottom: 1px solid #f3f4f6;
}
.dropdown-menu-custom a:hover, .dropdown-menu-custom button:hover { background: #f9fafb; }

/* ── Tab Navigation ── */
.tab-nav { display: flex; overflow-x: auto; padding: 0 1.5rem; border-bottom: 1px solid #e5e7eb; }
.tab-nav .tab-btn {
  flex: 1; padding: 1rem 1.5rem; border: none; background: none;
  border-bottom: 2px solid transparent; color: #6b7280; font-weight: 500;
  white-space: nowrap; cursor: pointer; display: flex; align-items: center; gap: 0.5rem;
  transition: all 0.15s;
}
.tab-nav .tab-btn:hover { color: #374151; }
.tab-nav .tab-btn.active { border-bottom-color: var(--hms-primary); color: var(--hms-primary); }

/* ── Tom Select overrides (searchable multi-select) ── */
.ts-wrapper { font-size: 0.875rem; }
.ts-wrapper .ts-control {
  border: 1px solid #d1d5db; border-radius: 0.5rem; padding: 0.375rem 0.5rem;
  min-height: 38px; background: #fff; box-shadow: none;
}
.ts-wrapper .ts-control:focus-within,
.ts-wrapper.focus .ts-control { border-color: #0891b2; box-shadow: 0 0 0 2px rgba(8,145,178,0.1); }
.ts-wrapper .ts-dropdown { border: 1px solid #e2e8f0; border-radius: 0.5rem; box-shadow: 0 8px 24px rgba(0,0,0,0.08); margin-top: 2px; }
.ts-wrapper .ts-dropdown .option { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
.ts-wrapper .ts-dropdown .active { background: #ecfeff; color: #0e7490; }
.ts-wrapper .ts-control .item {
  background: #ecfeff; color: #0e7490; border: 1px solid #a5f3fc;
  border-radius: 6px; padding: 1px 8px; font-size: 0.75rem; font-weight: 500;
}
.ts-wrapper .ts-control .item .remove { color: #0e7490; border-left: 1px solid #a5f3fc; }
.ts-wrapper .ts-control input { font-size: 0.8rem; }

/* ── Loading States ── */
.btn.is-loading, .btn:disabled {
  opacity: 0.6; cursor: not-allowed; pointer-events: none;
}
.btn.is-loading::after {
  content: ''; display: inline-block; width: 14px; height: 14px;
  margin-left: 8px; border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%; animation: skeleton-loading 1.2s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Focus Indicators (Accessibility) ── */
*:focus-visible {
  outline: 2px solid var(--hms-primary, #0891b2);
  outline-offset: 2px; border-radius: 4px;
}
.btn:focus-visible, a:focus-visible, button:focus-visible {
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.25);
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Status/Badge Standardization ── */
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.status-dot.success { background: #22c55e; }
.status-dot.warning { background: #f59e0b; }
.status-dot.danger  { background: #ef4444; }
.status-dot.info    { background: #3b82f6; }
.status-dot.neutral { background: #94a3b8; }

/* ── Currency display ── */
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money-currency { font-size: 0.75em; opacity: 0.7; margin-left: 0.25em; }

/* ── Tooltip helper ── */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%); background: rgba(15, 23, 42, 0.9); color: white;
  padding: 4px 8px; border-radius: 4px; font-size: 11px; white-space: nowrap;
  pointer-events: none; z-index: 1000;
}

/* ── Mobile touch targets (min 44x44) ── */
@media (max-width: 768px) {
  .btn, button[type="button"], button[type="submit"], .nav-link, .sidebar-toggle {
    min-height: 44px; min-width: 44px;
  }
  .chip-toggle { min-height: 36px; padding: 0.5rem 0.875rem; }
}

/* ── Print ── */
@media print {
  .ts-sidebar, .ts-topbar, .sidebar-overlay, .sidebar-toggle { display: none !important; }
  .ts-main { margin-left: 0 !important; margin-right: 0 !important; }
  .ts-content { padding: 0 !important; }
  .btn, .actions { display: none !important; }
}
