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

/* ========================
   Design Tokens
   ======================== */

:root {
  /* Tropical Neon Glass - Premium Dark Theme as Default */
  --bg-start: #0f172a;
  --bg-end: #1e1b4b;
  --card-bg: rgba(15, 23, 42, 0.4);
  --text-main: #f8fafc;
  --text-sub: #cbd5e1;
  --text-dim: #94a3b8;
  
  --primary: #00d2ff; /* Bright Cyan */
  --primary-glow: rgba(0, 210, 255, 0.5);
  --accent: #ff007a; /* Neon Pink/Coral */
  --accent-glow: rgba(255, 0, 122, 0.5);
  --violet: #8b5cf6;
  --danger: #ff3366;
  --emerald: #00e676;
  --coral: #ff5e62;
  --border-color: rgba(255, 255, 255, 0.1);
  
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15), 0 8px 32px rgba(0, 0, 0, 0.5);
  
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  
  --radius-xs: 8px;
  --radius-sm: 16px;
  --radius: 24px;
  --radius-lg: 32px;
  
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  
  --header-h: 70px;
  --tabbar-h: 88px;
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

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

html { height: 100%; -webkit-text-size-adjust: 100%; background: #0f172a; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(160deg, var(--bg-start), var(--bg-end));
    background-attachment: fixed;
    color: var(--text-main);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, .brand-font { font-family: 'Outfit', sans-serif; }

a { color: var(--primary); text-decoration: none; }

/* ========================
   Glassmorphism
   ======================== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
}

/* ========================
   Header
   ======================== */
#app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 200;
    transition: background 0.3s var(--ease);
}

.brand-title {
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

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

.user-badge {
    font-size: 0.8rem;
    background: rgba(6, 182, 212, 0.15);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.header-link {
    font-size: 1.2rem;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.header-link:hover { opacity: 1; }

/* ========================
   App Container & Panels
   ======================== */
.app-container {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    bottom: 0;
    overflow: hidden;
}

.panel {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.4s var(--ease-spring), opacity 0.4s var(--ease);
}

.panel-map {
    z-index: 1;
}

.panel-itinerary {
    z-index: 2;
    background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
    transform: translateX(100%);
    opacity: 0;
    overflow-y: auto;
    padding: 24px 20px;
    padding-bottom: calc(100px + var(--safe-bottom));
}

.panel-itinerary.active.active {
    transform: translateX(0);
    opacity: 1;
}

.panel-map.inactive {
    /* Keep map always rendered to avoid reload */
    visibility: visible;
}

/* ========================
   Map
   ======================== */
#map {
    width: 100%;
    height: 100%;
}

.map-search-bar {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 10;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    padding: 0 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255,255,255,0.1);
    transition: all 0.3s var(--ease);
}
.search-input-wrap:focus-within {
    background: rgba(15, 23, 42, 0.85);
    border-color: var(--primary);
    box-shadow: 0 8px 32px var(--primary-glow), inset 0 1px 1px rgba(255,255,255,0.2);
}

.search-icon {
    font-size: 1rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.search-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    padding: 14px 0;
    outline: none;
}

.search-input-wrap input::placeholder {
    color: var(--text-dim);
}

/* ========================
   Bottom Tab Bar
   ======================== */
.tab-bar {
    position: fixed;
    bottom: calc(16px + var(--safe-bottom));
    left: 20px; right: 20px;
    height: 72px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(32px) saturate(200%);
    -webkit-backdrop-filter: blur(32px) saturate(200%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.2);
    z-index: 200;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 0;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.7rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    -webkit-tap-highlight-color: transparent;
}

.tab-item .tab-icon { 
    font-size: 1.4rem; 
    transition: transform 0.3s var(--ease-spring);
}

.tab-item:hover .tab-icon { transform: scale(1.1); color: var(--text-sub); }

.tab-item.active {
    color: var(--primary);
}
.tab-item.active .tab-icon {
    transform: translateY(-2px) scale(1.15);
    filter: drop-shadow(0 2px 8px var(--primary-glow));
}

.tab-fab {
    position: relative;
    top: -24px;
}

.tab-fab .tab-icon {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 8px 24px var(--primary-glow), inset 0 2px 4px rgba(255,255,255,0.4);
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s;
    color: #fff;
    margin-top: 0;
}

.tab-fab:hover .tab-icon {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 32px var(--primary-glow), inset 0 2px 4px rgba(255,255,255,0.5);
}

.tab-fab:active .tab-icon { transform: scale(0.95); }

/* ========================
   Action Sheet
   ======================== */
.action-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.action-sheet-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.action-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid rgba(255,255,255,0.1);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    padding: 16px 24px 32px;
    padding-bottom: calc(32px + var(--safe-bottom));
    z-index: 301;
    transform: translateY(100%);
    transition: transform 0.4s var(--ease-spring);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}

.action-sheet.active {
    transform: translateY(0);
}

.action-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--text-dim);
    border-radius: 2px;
    margin: 0 auto 16px;
}

.action-sheet-title {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-sub);
}

.action-sheet-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    color: var(--text-main);
    cursor: pointer;
    margin-bottom: 10px;
    text-align: left;
    font-family: 'Inter', sans-serif;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.action-sheet-btn:active {
    background: rgba(255, 255, 255, 0.08);
}

.action-icon { font-size: 1.5rem; flex-shrink: 0; }

.action-sheet-btn strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.action-sheet-btn small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ========================
   Itinerary Panel
   ======================== */
.itinerary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.itinerary-header h2 { font-size: 1.4rem; }

.time-range {
    font-size: 0.8rem;
    color: var(--text-sub);
    margin-top: 2px;
}

.itinerary-actions-top {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.icon-btn:active { background: rgba(255, 255, 255, 0.1); }

/* Dashboard Card */
.dashboard-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

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

.stat-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    display: block;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
}

.stat-value.text-danger { color: var(--danger); }
.stat-value.text-success { color: var(--emerald); }
.stat-value.text-warning { color: var(--accent); }

/* ========================
   Timeline View
   ======================== */
.timeline-container {
    margin-bottom: 16px;
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
}

.timeline-bar {
    display: flex;
    align-items: center;
    min-width: max-content;
    gap: 4px;
    padding: 8px 4px;
}

.timeline-segment {
    height: 8px;
    border-radius: 4px;
    min-width: 24px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.timeline-segment:hover, .timeline-segment:active {
    transform: scaleY(1.8);
}

.timeline-segment.cat-food { background: linear-gradient(90deg, #f97316, #fb923c); }
.timeline-segment.cat-sightseeing { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
.timeline-segment.cat-shopping { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.timeline-segment.cat-activity { background: linear-gradient(90deg, #10b981, #34d399); }

.timeline-travel {
    width: 16px;
    height: 4px;
    border-radius: 2px;
    background: var(--text-dim);
    opacity: 0.4;
    flex-shrink: 0;
}

.timeline-legend {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ========================
   Place Card
   ======================== */
.place-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease), border-color 0.3s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 4px 16px rgba(0,0,0,0.2);
}

.place-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.2), 0 12px 32px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.2);
}

.place-card:active {
    transform: scale(0.96);
}

.place-card.priority-must {
    border-left: 4px solid var(--coral);
}

.place-card.priority-optional {
    opacity: 0.7;
}

.place-card-photo {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.place-card-body {
    padding: 20px;
}

.place-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.place-card-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-right: 10px;
}

.place-card-info { flex: 1; min-width: 0; }

.place-card-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.place-card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-sub);
}

.meta-chip.chip-time {
    background: rgba(6, 182, 212, 0.15);
    color: var(--primary);
}

.meta-chip.chip-cost {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent);
}

.meta-chip.chip-priority-must {
    background: rgba(244, 63, 94, 0.15);
    color: var(--coral);
}

.meta-chip.chip-category {
    background: rgba(139, 92, 246, 0.15);
    color: var(--violet);
}

.place-card-memo {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Travel Connector */
.travel-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 0;
    color: var(--text-dim);
    font-size: 0.75rem;
    gap: 8px;
    position: relative;
}

.travel-connector::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--glass-border), transparent);
}

.travel-time-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
}

/* Drag Handle */
.drag-handle {
    color: var(--text-dim);
    cursor: grab;
    font-size: 1.2rem;
    padding: 4px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.drag-handle:active { cursor: grabbing; }

.place-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.place-card.drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-sub);
}

.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; font-size: 1.1rem; }
.empty-state p { font-size: 0.85rem; color: var(--text-dim); }

/* ========================
   Buttons
   ======================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: 100px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.95); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #00e5ff);
    color: #000;
    font-weight: 700;
    box-shadow: 0 4px 16px var(--primary-glow), inset 0 2px 4px rgba(255,255,255,0.6);
}

.btn-primary:hover {
    box-shadow: 0 8px 24px var(--primary-glow), inset 0 2px 4px rgba(255,255,255,0.8);
    transform: translateY(-2px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #ea580c);
    color: white;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-ghost {
    background: transparent;
    color: var(--text-sub);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); }

.btn-compact { padding: 10px 16px; }

/* ========================
   Modals
   ======================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-height: 90vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid rgba(255,255,255,0.1);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    z-index: 401;
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s var(--ease-spring), opacity 0.4s var(--ease), visibility 0.4s;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}

.modal.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.modal-sm {
    max-width: 380px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    bottom: auto;
    top: 50%;
    border-radius: var(--radius);
}

.modal-sm.active {
    transform: translateX(-50%) translateY(-50%);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 12px;
    position: sticky;
    top: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    z-index: 10;
}

.modal-title { font-size: 1.15rem; }

.modal-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-sub);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body { padding: 12px 24px; }

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 24px;
    padding-bottom: calc(24px + var(--safe-bottom));
}

.modal-footer .btn { flex: 1; }

.modal-place-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.modal-place-address {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 20px;
}

/* Confirm Modal */
.confirm-icon { font-size: 2.5rem; margin-bottom: 16px; }
.confirm-message { font-size: 1rem; color: var(--text-sub); line-height: 1.5; }

/* ========================
   Form Elements
   ======================== */
.form-field {
    margin-bottom: 20px;
}

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

.slider-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.slider-wrap input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.slider-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.slider-value {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    min-width: 50px;
    text-align: right;
}

/* Pills */
.category-pills, .priority-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-sub);
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.pill.active {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

.pill:active { transform: scale(0.95); }

textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: var(--primary);
}

input[type="text"],
input[type="number"],
input[type="time"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="time"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* ========================
   Toast
   ======================== */
.toast-container {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: calc(100% - 32px);
    max-width: 400px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: rgba(12, 18, 34, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast.toast-success { border-left: 3px solid var(--emerald); }
.toast.toast-error { border-left: 3px solid var(--danger); }
.toast.toast-info { border-left: 3px solid var(--primary); }

.toast.removing {
    animation: toastOut 0.3s forwards;
}

@keyframes toastIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-20px); opacity: 0; }
}

/* ========================
   Loading Overlay
   ======================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 18, 34, 0.85);
    backdrop-filter: blur(8px);
    z-index: 450;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-content {
    text-align: center;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(6, 182, 212, 0.15);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s ease-in-out infinite;
    margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========================
   Welcome Overlay
   ======================== */
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.welcome-card {
    width: 100%;
    max-width: 380px;
    padding: 36px 28px;
    text-align: center;
}

.welcome-emoji { font-size: 3.5rem; margin-bottom: 12px; }

.welcome-card h2 {
    font-size: 1.4rem;
    margin-bottom: 28px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-steps {
    text-align: left;
    margin-bottom: 28px;
}

.welcome-step {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
    align-items: flex-start;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.welcome-step strong {
    display: block;
    margin-bottom: 2px;
    font-size: 0.9rem;
}

.welcome-step p {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.welcome-btn { width: 100%; padding: 14px; font-size: 1rem; }

/* ========================
   Login Page
   ======================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: auto;
    position: relative;
}

.login-scene {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.wave {
    position: absolute;
    bottom: -10%;
    left: -10%;
    width: 120%;
    height: 50%;
    border-radius: 40%;
    opacity: 0.15;
    filter: blur(12px);
}

.wave-1 {
    background: linear-gradient(90deg, var(--primary), var(--violet));
    animation: wave 12s ease-in-out infinite;
}

.wave-2 {
    background: linear-gradient(90deg, var(--accent), var(--coral));
    animation: wave 16s ease-in-out infinite reverse;
    bottom: -15%;
}

.wave-3 {
    background: linear-gradient(90deg, var(--emerald), var(--primary));
    animation: wave 20s ease-in-out infinite;
    bottom: -20%;
}

@keyframes wave {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(5deg) scale(1.05); }
    100% { transform: rotate(0deg) scale(1); }
}

.login-container {
    position: relative;
    z-index: 1;
    padding: 40px 28px;
    width: 100%;
    max-width: 400px;
    margin: 20px;
}

.login-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    text-align: center;
}

.login-container h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    text-align: center;
    color: var(--text-sub);
    margin-bottom: 28px;
    font-size: 0.9rem;
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    margin-bottom: 20px;
    font-size: 0.85rem;
    text-align: center;
}

.member-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.member-form { display: contents; }

.member-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(12px);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.member-btn:hover {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.2);
}

.member-btn:active {
    transform: scale(0.96);
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.member-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.manual-login-row {
    display: flex;
    gap: 10px;
}

.manual-login-row input {
    flex: 1;
}

/* ========================
   Admin Page
   ======================== */
.admin-container {
    max-width: 480px;
    margin: calc(var(--header-h) + 24px) auto 24px;
    padding: 0 16px;
}

.admin-panel {
    padding: 28px;
}

.form-group {
    margin-bottom: 20px;
}

/* ========================
   Scrollbar
   ======================== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }

/* ========================
   Desktop Overrides (768px+)
   ======================== */
.desktop-only { display: none !important; }

@media (min-width: 769px) {
    .tab-bar { display: none; }
    .desktop-only { display: inline-flex !important; }

    .app-container {
        display: flex;
        bottom: 0;
    }

    .panel {
        position: relative;
        transform: none !important;
        opacity: 1 !important;
    }

    .panel-map {
        flex: 1;
        order: 2;
    }

    .panel-itinerary {
        width: 440px;
        flex-shrink: 0;
        order: 1;
        border-right: 1px solid var(--glass-border);
        overflow-y: auto;
        padding: 24px;
    }

    .map-search-bar {
        top: 16px;
        left: 16px;
        right: auto;
        width: 380px;
    }

    /* Show action buttons inline on desktop */
    .itinerary-actions-top {
        gap: 8px;
    }
}

/* ========================
   Accessibility
   ======================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Touch targets */
button, a, input:not([type="range"]), select, textarea {
    min-height: 44px;
}

.meta-chip, .legend-item {
    min-height: auto;
}
