/* AIvoy — App Dashboard Styles */

/* Layout principal */
.app-layout {
    display: grid;
    grid-template-columns: 380px 1fr 360px;
    grid-template-rows: 56px 1fr;
    height: 100vh;
    overflow: hidden;
}

/* Top Bar */
.topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
}
.topbar__left { display: flex; align-items: center; gap: var(--space-4); }
.topbar__trip-name {
    font-size: var(--fs-base); font-weight: 600; color: var(--text-primary);
    background: none; border: 1px solid transparent; padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm); transition: all var(--transition-fast); min-width: 200px;
}
.topbar__trip-name:hover { border-color: var(--border-medium); }
.topbar__trip-name:focus { outline: none; border-color: var(--primary); background: var(--bg-glass); }
.topbar__center { display: flex; align-items: center; gap: var(--space-2); }
.topbar__transport {
    display: flex; align-items: center; gap: var(--space-1);
    padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
    background: var(--bg-glass); border: 1px solid var(--border-subtle);
    font-size: var(--fs-sm); cursor: pointer; transition: all var(--transition-fast);
}
.topbar__transport:hover, .topbar__transport--active { border-color: var(--primary); background: rgba(99,102,241,0.1); }
.topbar__transport--active { color: var(--primary-light); }
.topbar__right { display: flex; align-items: center; gap: var(--space-3); }

/* Budget chip */
.budget-chip {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
    background: var(--bg-glass); border: 1px solid var(--border-subtle);
    font-size: var(--fs-sm); font-weight: 600; cursor: pointer; transition: all var(--transition-fast);
}
.budget-chip:hover { border-color: var(--success); }
.budget-chip__amount { color: var(--success); }
.budget-chip__bar { width: 60px; height: 4px; border-radius: 2px; background: var(--bg-glass-strong); overflow: hidden; }
.budget-chip__fill { height: 100%; border-radius: 2px; background: var(--success); transition: width var(--transition-base); }
.budget-chip__fill--warning { background: var(--warning); }
.budget-chip__fill--danger { background: var(--danger); }

/* Chat Panel */
.chat-panel {
    display: flex; flex-direction: column; background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle); overflow: hidden;
}
.chat-panel__header {
    padding: var(--space-4); border-bottom: 1px solid var(--border-subtle);
    display: flex; align-items: center; gap: var(--space-3);
}
.chat-panel__ai-avatar {
    width: 36px; height: 36px; border-radius: var(--radius-md);
    background: var(--gradient-primary); display: flex; align-items: center;
    justify-content: center; font-weight: 800; font-size: var(--fs-sm); color: white;
}
.chat-panel__ai-info h3 { font-size: var(--fs-sm); font-weight: 600; }
.chat-panel__ai-status {
    font-size: var(--fs-xs); color: var(--success);
    display: flex; align-items: center; gap: var(--space-1);
}
.chat-panel__ai-status::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--success); animation: pulse 2s ease-in-out infinite;
}

/* Messages */
.chat-messages {
    flex: 1; overflow-y: auto; padding: var(--space-4);
    display: flex; flex-direction: column; gap: var(--space-4); scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.chat-msg { display: flex; gap: var(--space-3); animation: fadeInUp 300ms ease both; }
.chat-msg--user { flex-direction: row-reverse; }
.chat-msg__avatar {
    width: 32px; height: 32px; border-radius: var(--radius-sm); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-xs); font-weight: 700;
}
.chat-msg--ai .chat-msg__avatar { background: var(--gradient-primary); color: white; }
.chat-msg--user .chat-msg__avatar { background: var(--bg-glass-strong); border: 1px solid var(--border-medium); color: var(--text-secondary); }
.chat-msg__bubble { max-width: 85%; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); font-size: var(--fs-sm); line-height: 1.6; }
.chat-msg--ai .chat-msg__bubble { background: var(--bg-glass); border: 1px solid var(--border-subtle); border-top-left-radius: var(--space-1); }
.chat-msg--user .chat-msg__bubble { background: var(--gradient-primary); color: white; border-top-right-radius: var(--space-1); }

/* Typing */
.chat-typing { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); }
.chat-typing__dots { display: flex; gap: 4px; }
.chat-typing__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: typingBounce 1.4s ease-in-out infinite; }
.chat-typing__dot:nth-child(2) { animation-delay: 200ms; }
.chat-typing__dot:nth-child(3) { animation-delay: 400ms; }
@keyframes typingBounce { 0%,60%,100%{transform:translateY(0);opacity:.4} 30%{transform:translateY(-6px);opacity:1} }

/* Chips */
.chat-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2) var(--space-4) var(--space-3); }
.chat-chip {
    padding: var(--space-2) var(--space-3); border-radius: var(--radius-full);
    background: var(--bg-glass); border: 1px solid var(--border-subtle);
    font-size: var(--fs-xs); color: var(--text-accent); cursor: pointer; transition: all var(--transition-fast); white-space: nowrap;
}
.chat-chip:hover { background: rgba(99,102,241,0.15); border-color: var(--primary); }

/* Input */
.chat-input { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border-subtle); }
.chat-input__form { display: flex; gap: var(--space-2); align-items: flex-end; }
.chat-input__field {
    flex: 1; padding: var(--space-3) var(--space-4); background: var(--bg-glass);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-xl);
    color: var(--text-primary); font-size: var(--fs-sm); outline: none; resize: none;
    min-height: 44px; max-height: 120px; transition: all var(--transition-fast);
}
.chat-input__field::placeholder { color: var(--text-muted); }
.chat-input__field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.chat-input__send {
    width: 44px; height: 44px; border-radius: 50%; background: var(--gradient-primary);
    color: white; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: all var(--transition-fast);
}
.chat-input__send:hover { transform: scale(1.05); box-shadow: 0 4px 16px rgba(99,102,241,0.4); }

/* Map Panel */
.map-panel { position: relative; overflow: hidden; }
.map-panel #map { width: 100%; height: 100%; }

/* Itinerary Panel */
.itinerary-panel {
    display: flex; flex-direction: column; background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle); overflow: hidden;
}
.itinerary-panel__header {
    padding: var(--space-4); border-bottom: 1px solid var(--border-subtle);
    display: flex; align-items: center; justify-content: space-between;
}
.itinerary-panel__header h3 { font-size: var(--fs-base); font-weight: 600; }
.itinerary-panel__summary { display: flex; gap: var(--space-4); font-size: var(--fs-xs); color: var(--text-muted); }
.itinerary-days {
    flex: 1; overflow-y: auto; padding: var(--space-4);
    display: flex; flex-direction: column; gap: var(--space-4);
}
.itinerary-days::-webkit-scrollbar { width: 4px; }
.itinerary-days::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Day section */
.day-section { animation: fadeInUp 300ms ease both; }
.day-section__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--border-subtle); }
.day-section__title { font-size: var(--fs-sm); font-weight: 700; color: var(--primary-light); }
.day-section__date { font-size: var(--fs-xs); color: var(--text-muted); }

/* Activity card */
.activity-card {
    display: flex; gap: var(--space-3); padding: var(--space-3);
    background: var(--bg-glass); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md); margin-bottom: var(--space-2);
    cursor: grab; transition: all var(--transition-fast); position: relative;
}
.activity-card:hover { border-color: var(--border-medium); background: var(--bg-surface-hover); }
.activity-card--gem { border-color: rgba(168,85,247,0.3); background: rgba(168,85,247,0.05); }
.activity-card__icon {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    color: currentColor;
}
.activity-card__icon--see { background: rgba(99,102,241,0.15); }
.activity-card__icon--eat { background: rgba(239,68,68,0.15); }
.activity-card__icon--sleep { background: rgba(16,185,129,0.15); }
.activity-card__icon--transport { background: rgba(245,158,11,0.15); }
.activity-card__icon--gem { background: rgba(168,85,247,0.15); }
.activity-card__content { flex: 1; min-width: 0; }
.activity-card__name { font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; margin-bottom: 2px; }
.activity-card__desc { font-size: var(--fs-xs); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-card__meta { display: flex; gap: var(--space-3); margin-top: var(--space-1); font-size: var(--fs-xs); color: var(--text-muted); }
.activity-card__delete {
    position: absolute; top: var(--space-2); right: var(--space-2);
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
    color: var(--text-muted); opacity: 0; transition: all var(--transition-fast);
}
.activity-card:hover .activity-card__delete { opacity: 1; }
.activity-card__delete:hover { background: rgba(239,68,68,0.2); color: var(--danger); }
.activity-card__gem-badge {
    position: absolute; top: -6px; right: var(--space-3);
    padding: 2px var(--space-2); border-radius: var(--radius-full);
    background: linear-gradient(135deg, #c084fc, #a855f7);
    font-size: 10px; font-weight: 700; color: white;
    display: flex; align-items: center; gap: 3px;
}

/* Transport segment */
.transport-segment { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); font-size: var(--fs-xs); color: var(--text-muted); }
.transport-segment__line { flex: 1; height: 1px; background: var(--border-subtle); }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: var(--space-12); color: var(--text-muted); }
.empty-state__icon { font-size: 48px; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state__title { font-size: var(--fs-lg); font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state__desc { font-size: var(--fs-sm); max-width: 280px; }

/* Mobile tabs */
.mobile-tabs { display: none; }

@media (max-width: 1024px) {
    .app-layout { grid-template-columns: 1fr; grid-template-rows: 56px 1fr 48px; }
    .chat-panel, .itinerary-panel { display: none; }
    .chat-panel--active, .itinerary-panel--active { display: flex; position: fixed; inset: 56px 0 48px; z-index: var(--z-dropdown); }
    .mobile-tabs { display: flex; grid-column: 1; background: var(--bg-secondary); border-top: 1px solid var(--border-subtle); }
    .mobile-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-1); font-size: var(--fs-xs); color: var(--text-muted); padding: var(--space-2); }
    .mobile-tab--active { color: var(--primary-light); }
}
