/* ==========================================================================
   Travel Companion PWA - Style Sheet
   ========================================================================== */

:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Modern Palette */
  --bg-primary: #0b0c10;
  --bg-secondary: #141621;
  --bg-tertiary: #1f2234;
  --border-color: rgba(255, 255, 255, 0.08);
  
  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --text-muted: #718096;
  
  --accent-primary: #319795; /* Emerald */
  --accent-primary-glow: rgba(49, 151, 149, 0.2);
  --accent-secondary: #d69e2e; /* Warm Amber */
  --accent-info: #3182ce; /* Electric Blue */
  --accent-danger: #e53e3e; /* Crimson */
  --accent-success: #38a169; /* Green */
  
  --nav-height: 72px;
  --header-height: 64px;
  --border-radius: 16px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Glassmorphism */
  --glass-bg: rgba(20, 22, 33, 0.7);
  --glass-blur: blur(15px);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Header */
.app-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: relative;
  z-index: 100;
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
}

.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trip-icon {
  font-size: 24px;
}

.app-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.app-header p {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--accent-primary);
  background: var(--accent-primary-glow);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(49, 151, 149, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.install-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-info);
  padding: 5px 12px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-sans);
}

.install-btn:hover {
  background: #2b6cb0;
}


/* Main Content Area */
.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: calc(var(--nav-height) + 30px + env(safe-area-inset-bottom, 0px));
  position: relative;
}

.tab-content {
  display: none;
  animation: fadeIn var(--transition-normal);
}

.tab-content.active {
  display: block;
}

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

/* View Header */
.view-header {
  margin-bottom: 24px;
}

.view-header h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

/* Bottom Navigation */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: var(--glass-border);
  box-shadow: var(--glass-shadow);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-item svg {
  transition: transform var(--transition-fast);
  stroke-width: 2;
}

.nav-item span {
  font-size: 10px;
  font-weight: 500;
}

.nav-item.active {
  color: var(--accent-primary);
}

.nav-item.active svg {
  transform: translateY(-2px);
  stroke: var(--accent-primary);
}

/* Loader */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 250px;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-tertiary);
  border-top: 4px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Filters & Controls */
.filter-bar, .lang-selector, .segment-control {
  display: flex;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
  margin-top: 12px;
  border: var(--border-color);
}

.filter-btn, .lang-btn, .segment-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-btn.active, .lang-btn.active, .segment-btn.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Segment Content */
.segment-content {
  display: none;
  margin-top: 20px;
}

.segment-content.active {
  display: block;
}

/* Cards & Accordions (Timeline & Checklist) */
.card {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  border: var(--border-color);
  padding: 16px;
  margin-bottom: 16px;
  transition: var(--transition-normal);
}

.timeline-day {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  border: var(--border-color);
  margin-bottom: 16px;
  overflow: hidden;
  transition: var(--transition-normal);
}

.day-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: background var(--transition-fast);
}

.day-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.day-title-box {
  display: flex;
  flex-direction: column;
}

.day-title {
  font-size: 16px;
  font-weight: 700;
}

.day-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.day-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-secondary);
  background: rgba(214, 158, 46, 0.1);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(214, 158, 46, 0.2);
}

.day-content {
  display: none;
  padding: 16px;
  border-top: var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

.timeline-day.expanded .day-content {
  display: block;
}

.day-header svg {
  transition: transform var(--transition-normal);
  color: var(--text-secondary);
}

.timeline-day.expanded .day-header svg {
  transform: rotate(180deg);
}

/* Activity Items */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-item:first-child {
  padding-top: 0;
}

.activity-bullet {
  font-size: 16px;
  display: flex;
  align-items: flex-start;
  margin-top: 2px;
}

.activity-text {
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
}

.activity-text strong {
  color: #fff;
}

.activity-item.booked {
  background: rgba(49, 151, 149, 0.05);
  border-left: 3px solid var(--accent-primary);
  padding-left: 8px;
  margin-left: -8px;
  border-radius: 0 6px 6px 0;
}

/* Alert / Warning Boxes in Itinerary */
.note-box {
  background: rgba(49, 130, 206, 0.08);
  border-left: 4px solid var(--accent-info);
  padding: 12px 14px;
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.note-box strong {
  color: var(--text-primary);
}

/* Checklist Styling */
.checklist-group {
  margin-bottom: 24px;
}

.checklist-group-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  border-bottom: var(--border-color);
  padding-bottom: 6px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: var(--border-color);
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.check-item:hover {
  background: var(--bg-tertiary);
}

.check-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.check-item input[type="checkbox"]:checked {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.check-item input[type="checkbox"]:checked::after {
  content: "✓";
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}

.check-item-label {
  font-size: 14px;
  transition: var(--transition-fast);
  flex: 1;
}

.check-item input[type="checkbox"]:checked + .check-item-label {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Progress bar inside checklist */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-primary);
}

.progress-track {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 10px;
  overflow: hidden;
  border: var(--border-color);
}

.progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 10px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Phrasebook Styling */
.search-box {
  width: 100%;
  margin-bottom: 12px;
}

.search-box input {
  width: 100%;
  background: var(--bg-secondary);
  border: var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--accent-primary);
}

.phrase-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  border: var(--border-color);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-fast);
}

.phrase-card:hover {
  background: var(--bg-tertiary);
}

.phrase-content {
  flex: 1;
}

.phrase-en {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.phrase-translated {
  font-size: 13px;
  color: var(--accent-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.phrase-pronounce {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.audio-btn {
  background: var(--bg-tertiary);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.audio-btn:hover {
  background: var(--accent-primary);
  color: white;
}

.audio-btn:active {
  transform: scale(0.9);
}

/* Expenses Tab Styling */
.budget-card {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.budget-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-val {
  font-size: 22px;
  font-weight: 700;
}

#expenses-remaining {
  color: var(--accent-success);
}

.currency-calculator {
  background: var(--bg-secondary);
  border: var(--border-color);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 24px;
}

.calc-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calc-row input {
  flex: 1;
  background: var(--bg-tertiary);
  border: var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  outline: none;
}

.calc-eq {
  font-weight: 700;
  color: var(--text-secondary);
}

.calc-rate {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
}

/* Expense Log Days */
.expense-day-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  margin-top: 10px;
}

.expense-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
}

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

.expense-item-desc {
  flex: 1;
  display: flex;
  gap: 8px;
  align-items: center;
}

.expense-cat-icon {
  font-size: 14px;
}

.expense-val {
  font-weight: 600;
  color: var(--text-primary);
}

.expense-input-btn {
  background: none;
  border: 1px dashed var(--accent-primary);
  color: var(--accent-primary);
  border-radius: 8px;
  padding: 6px 12px;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  transition: var(--transition-fast);
}

.expense-input-btn:hover {
  background: var(--accent-primary-glow);
}

/* Weather & Logistics Cards */
.transit-step {
  border-left: 2px solid var(--accent-info);
  padding-left: 16px;
  margin-left: 8px;
  position: relative;
  padding-bottom: 24px;
}

.transit-step:last-child {
  border-left: none;
  padding-bottom: 0;
}

.transit-step::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-info);
  border: 2px solid var(--bg-primary);
}

.transit-step-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.transit-step-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.weather-city-card {
  margin-bottom: 20px;
}

.weather-city-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent-primary);
}

.weather-avg-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.weather-stat-box {
  background: var(--bg-tertiary);
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  font-size: 12px;
}

.weather-stat-label {
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.weather-stat-value {
  font-weight: 700;
  font-size: 14px;
}

/* PIN Lock Screen */
.pin-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-normal);
}

.pin-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.pin-container {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  width: 90%;
  max-width: 320px;
  box-shadow: var(--glass-shadow);
}

.pin-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.pin-container h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.pin-container p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.pin-input {
  width: 100%;
  padding: 12px;
  font-size: 24px;
  letter-spacing: 8px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: white;
  outline: none;
  font-family: monospace;
}

.pin-input:focus {
  border-color: var(--accent-primary);
}

.pin-input.shake {
  animation: shake 0.4s;
  border-color: var(--accent-danger);
}

.pin-error {
  color: var(--accent-danger) !important;
  font-size: 12px !important;
  margin-top: 10px !important;
  margin-bottom: 0 !important;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.pin-error.visible {
  opacity: 1;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}
