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

/* =========================================
   CSS Variables / Design Tokens
   ========================================= */
:root {
  --primary: #1a6b7a;
  --primary-dark: #134f5c;
  --primary-light: #e8f4f6;
  --accent: #26a69a;
  --accent-light: #b2dfdb;
  --success: #2e7d32;
  --success-light: #e8f5e9;
  --danger: #c62828;
  --danger-light: #ffebee;
  --warning: #f57f17;
  --warning-light: #fff8e1;
  --bg: #f0f4f5;
  --surface: #ffffff;
  --surface2: #f7f9fa;
  --border: #cfd8dc;
  --border-light: #eceff1;
  --text: #1c2b33;
  --text-muted: #607d8b;
  --text-light: #90a4ae;
  --nav-width: 220px;
  --header-h: 64px;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.14);
  --radius: 10px;
  --radius-sm: 6px;
}

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

html {
  font-size: 15px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

img {
  max-width: 100%;
}

/* =========================================
   Sidebar Navigation
   ========================================= */
.sidebar {
  width: var(--nav-width);
  background: var(--primary);
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: var(--shadow);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-logo .logo-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.75rem;
  font-weight: 400;
  margin-top: 2px;
}

.sidebar-logo .logo-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 20px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.18s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  border-left-color: #80cbc4;
}

.nav-item .nav-icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.72rem;
}

/* =========================================
   Main Content
   ========================================= */
.main {
  margin-left: var(--nav-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: 0 32px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.page-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-content {
  padding: 28px 32px;
  flex: 1;
}

/* =========================================
   Cards
   ========================================= */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.card-header {
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-header.green {
  background: #388e3c;
}

.card-header.teal {
  background: #00796b;
}

.card-header.blue {
  background: #1565c0;
}

.card-header.orange {
  background: #e65100;
}

.card-body {
  padding: 20px;
}

.card-body.p0 {
  padding: 0;
}

/* =========================================
   Stats Grid
   ========================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.stat-value.green {
  color: var(--success);
}

.stat-value.orange {
  color: var(--warning);
}

.stat-value.danger {
  color: var(--danger);
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

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

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

thead th {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.12s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--primary-light);
}

tbody td {
  padding: 10px 14px;
  color: var(--text);
  vertical-align: middle;
}

.table-total td {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
}

.table-diff td {
  background: #e0f7fa;
  color: var(--primary-dark);
  font-weight: 700;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  line-height: 1;
  white-space: nowrap;
}

.btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

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

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

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

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

.btn-icon {
  padding: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.73rem;
}

/* Mobile Header */
.mobile-header {
  display: none;
  /* Default hidden */
  align-items: center;
  background: var(--surface);
  padding: 0 16px;
  height: 56px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.mobile-toggle {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--primary);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 99;
}

/* =========================================
   Forms
   ========================================= */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(38, 166, 154, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

/* =========================================
   Budget Bar
   ========================================= */
.budget-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.budget-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s;
}

.budget-bar-fill.over {
  background: var(--danger);
}

/* =========================================
   Amount formatting
   ========================================= */
.amount {
  font-weight: 600;
  white-space: nowrap;
}

.amount-planned {
  color: var(--primary);
}

.amount-actual {
  color: var(--accent);
}

.amount-diff-pos {
  color: var(--danger);
}

.amount-diff-neg {
  color: var(--success);
}

.amount-zero {
  color: var(--text-light);
}

/* =========================================
   Checklist
   ========================================= */
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.checklist-column {
  min-width: 0;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 6px;
  background: var(--surface);
  transition: all 0.12s;
}

.task-item:hover {
  border-color: var(--accent-light);
  background: var(--primary-light);
}

.task-item.done {
  opacity: 0.55;
}

.task-item.done .task-name {
  text-decoration: line-through;
}

.task-checkbox {
  flex-shrink: 0;
}

.task-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.task-name {
  font-size: 0.85rem;
  flex: 1;
  line-height: 1.35;
}

.task-date {
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.task-actions {
  flex-shrink: 0;
}

/* =========================================
   Attractions Grid
   ========================================= */
.attractions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.attraction-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.attraction-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.attraction-header {
  background: #a5d6a7;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1b5e20;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.attraction-body {
  padding: 14px;
}

.attraction-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.attraction-detail {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.attraction-detail .icon {
  width: 16px;
  flex-shrink: 0;
  color: var(--accent);
}

.add-attraction-btn {
  background: #e8f5e9;
  border: 2px dashed #a5d6a7;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  cursor: pointer;
  transition: all 0.15s;
  color: #388e3c;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 8px;
}

.add-attraction-btn:hover {
  background: #c8e6c9;
  border-color: #388e3c;
}

.add-attraction-btn .plus {
  font-size: 2rem;
  font-weight: 300;
}

/* =========================================
   Itinerary
   ========================================= */
.itinerary-day {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.day-header {
  background: var(--primary);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.day-number {
  font-size: 1rem;
  font-weight: 800;
}

.day-date {
  font-size: 0.85rem;
  opacity: 0.8;
}

.day-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
}

.day-row {
  display: contents;
}

.day-row:not(:last-child) .row-label,
.day-row:not(:last-child) .row-value {
  border-bottom: 1px solid var(--border-light);
}

.row-label {
  padding: 10px 14px;
  background: var(--surface2);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border-light);
}

.row-value {
  padding: 8px 14px;
  font-size: 0.875rem;
}

.row-value input[type="text"],
.row-value textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  color: var(--text);
  resize: none;
  outline: none;
  min-height: 28px;
}

.timeline-table {
  border-collapse: collapse;
  width: 100%;
}

.timeline-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.83rem;
}

.timeline-table .time-col {
  width: 70px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  background: var(--surface2);
}

.timeline-table input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.83rem;
  outline: none;
  color: var(--text);
}

/* =========================================
   Modal
   ========================================= */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  background: var(--primary);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius) var(--radius) 0 0;
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.8;
  line-height: 1;
  padding: 0;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* =========================================
   Badge
   ========================================= */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 0.73rem;
  font-weight: 700;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

/* =========================================
   Progress
   ========================================= */
.progress-wrap {
  background: var(--border-light);
  border-radius: 100px;
  height: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width 0.4s;
}

/* =========================================
   Chart (Overview)
   ========================================= */
.chart-container {
  position: relative;
  height: 220px;
}

/* =========================================
   Info Grid (Trip Info)
   ========================================= */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.info-row {
  display: flex;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-light);
  gap: 10px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-key {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  min-width: 140px;
}

.info-val {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
}

/* =========================================
   Overview Layout
   ========================================= */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.overview-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* =========================================
   Utility
   ========================================= */
.mt-16 {
  margin-top: 16px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-center {
  display: flex;
  align-items: center;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

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

.text-sm {
  font-size: 0.8rem;
}

.fw-700 {
  font-weight: 700;
}

.full-width {
  width: 100%;
}

/* Inplace editable */
input.inline-edit {
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  width: 80px;
  text-align: right;
  outline: none;
}

input.inline-edit:focus {
  border-bottom: 1.5px solid var(--accent);
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 900px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 280px;
    z-index: 100;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.open+.sidebar-overlay {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .page-header {
    position: relative;
    border-top: none;
    padding: 12px 16px;
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header h1 {
    font-size: 1.15rem;
  }

  .page-header .flex {
    width: 100%;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
  }

  .overview-grid,
  .overview-grid-3 {
    grid-template-columns: 1fr;
  }

  .checklist-grid {
    grid-template-columns: 1fr 1fr;
  }

  .page-content {
    padding: 16px;
  }

  /* Hide sidebar toggle if it's already in the mobile header */
  .page-header .mobile-toggle {
    display: none;
  }
}

@media (max-width: 600px) {
  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .page-header .flex.gap-8 {
    gap: 4px;
  }

  .btn-sm {
    padding: 5px 8px;
    font-size: 0.7rem;
  }

  /* Table optimization */
  .table-wrap {
    margin: 0 -16px;
    width: calc(100% + 32px);
  }

  table {
    font-size: 0.8rem;
  }

  thead th,
  tbody td {
    padding: 10px 8px;
  }

  /* Hide less important columns on mobile */
  .hide-mobile {
    display: none;
  }

  .budget-planned-text {
    display: none;
  }

  input.inline-edit {
    width: 70px !important;
    font-size: 0.8rem;
  }
}

/* =========================================
   Animations
   ========================================= */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card,
.stat-card,
.attraction-card,
.itinerary-day {
  animation: fadeIn 0.25s ease both;
}