/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== 主容器 ==================== */
.mobile-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==================== 地图区域 ==================== */
.map-section {
    position: relative;
    height: 40vh;
    min-height: 200px;
    background-color: #e5e7eb;
    overflow: hidden;
}

.map-container {
    width: 100%;
    height: 100%;
}

/* WebSocket连接状态 */
.connection-status {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    font-size: 12px;
    z-index: 10;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--warning-color);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background-color: var(--success-color);
    animation: none;
}

.status-dot.disconnected {
    background-color: var(--danger-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==================== 拖拽分隔条 ==================== */
.resizer {
    height: 20px;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ns-resize;
    user-select: none;
    touch-action: none;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.resizer-handle {
    color: var(--text-secondary);
    font-size: 16px;
    letter-spacing: 2px;
    pointer-events: none;
}

.resizer:active {
    background-color: var(--primary-color);
}

.resizer:active .resizer-handle {
    color: white;
}

/* ==================== 刷新按钮区域 ==================== */
.refresh-section {
    padding: 8px 12px;
    background-color: var(--bg-primary);
    display: flex;
    justify-content: flex-start;
    border-bottom: 1px solid var(--border-color);
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background-color: #fff;
    color: #666;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.refresh-btn:active {
    transform: scale(0.98);
    background-color: #f9fafb;
}

.refresh-icon {
    font-size: 14px;
    transition: transform 0.6s ease;
}

.refresh-btn.loading .refresh-icon {
    animation: rotate 1s linear infinite;
}

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

/* ==================== 天数导航栏 ==================== */
.days-navigation {
    display: flex;
    gap: 8px;
    padding: 12px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    /* 添加渐变遮罩效果，提示可以滚动 */
    position: relative;
}

.days-navigation::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right, transparent, var(--bg-primary));
    pointer-events: none;
}

.days-navigation::-webkit-scrollbar {
    display: none;
}

.day-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.day-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

/* ==================== 行程区域 ==================== */
.itinerary-section {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: var(--bg-secondary);
}

.content-area {
    min-height: 100%;
    padding: 16px;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty-state h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 行程内容样式 */
.day-content {
    display: none;
}

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

.itinerary-item {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.itinerary-item h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.itinerary-item p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==================== 悬浮按钮 ==================== */
.floating-btn {
    position: fixed;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 1000;
    touch-action: none;
}

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

.floating-btn svg {
    width: 24px;
    height: 24px;
}

/* AI助手按钮 */
.ai-btn {
    right: 20px;
    bottom: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

/* AI按钮提示气泡 */
.ai-btn-tooltip {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: tooltipBounce 2s ease-in-out infinite;
    z-index: 1;
    display: none;
    pointer-events: none;
}

.ai-btn-tooltip.hidden {
    display: none;
}

.tooltip-arrow {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid #1f2937;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

@keyframes tooltipBounce {
    0%, 100% {
        transform: translateY(-50%) translateX(0);
    }
    50% {
        transform: translateY(-50%) translateX(-5px);
    }
}

/* 投诉反馈按钮 */
.feedback-btn {
    left: 20px;
    bottom: 20px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
}

/* ==================== AI聊天抽屉 ==================== */
.chat-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    pointer-events: none;
}

.chat-drawer.open {
    pointer-events: auto;
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.chat-drawer.open .drawer-overlay {
    opacity: 1;
}

.drawer-content {
    position: fixed;
    top: 50%;
    right: 0;
    width: 90%;
    height: 80%;
    max-width: 400px;
    background-color: var(--bg-primary);
    border-radius: 20px 0 0 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translate(100%, -50%);
    transition: transform 0.3s ease;
    overflow: hidden;
    z-index: 2;
}

.chat-drawer.open .drawer-content {
    transform: translate(0, -50%);
}

/* 抽屉头部 */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.drawer-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-title .icon {
    font-size: 24px;
}

.drawer-title h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background-color: var(--bg-secondary);
    border-radius: 50%;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:active {
    transform: scale(0.9);
    background-color: var(--border-color);
}

/* 工具调用提示栏 */
.tool-call-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: #fef3c7;
    border-bottom: 1px solid #fcd34d;
    position: relative;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #fcd34d;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.tool-text {
    flex: 1;
    font-size: 13px;
    color: #92400e;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.thinking-timer {
    font-size: 11px;
    color: #b45309;
    background: rgba(251, 191, 36, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 8px;
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 0 4px;
}

/* 输入区域 */
.input-section {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-primary);
}

.message-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.3s ease;
}

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

.send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.send-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 375px) {
    .floating-btn {
        width: 48px;
        height: 48px;
    }
    
    .ai-btn {
        right: 16px;
        bottom: 16px;
    }
    
    .feedback-btn {
        left: 16px;
        bottom: 16px;
    }
    
    .drawer-content {
        width: 95%;
        height: 90%;
    }
}

@media (min-width: 768px) {
    .drawer-content {
        max-width: 450px;
    }
}

/* ==================== 滚动条样式 ==================== */
.chat-messages::-webkit-scrollbar,
.itinerary-section::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.itinerary-section::-webkit-scrollbar-track {
    background-color: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.itinerary-section::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.itinerary-section::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* ==================== 行程卡片样式 ==================== */
.day-section {
    margin-bottom: 20px;
}

.day-header {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.day-summary {
    display: flex;
    gap: 12px;
    font-size: 12px;
    font-weight: normal;
    color: #999;
}

.day-summary span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.day-detail-header {
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.day-detail-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.day-detail-header .day-summary {
    display: flex;
    gap: 20px;
    font-size: 13px;
    font-weight: normal;
    color: #666;
}

.summary-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #666;
}

.attractions-list {
    padding: 0 20px 20px;
}

.attraction-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.attraction-card:active {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.attraction-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.attraction-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

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

.attraction-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.attraction-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.type-label {
    font-size: 12px;
    color: #667eea;
    background: #f0f0ff;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.time-info,
.duration-info {
    font-size: 12px;
    color: #666;
    background: #f5f5f5;
    padding: 3px 8px;
    border-radius: 4px;
}

.attraction-address {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.attraction-price {
    font-size: 12px;
    color: #f59e0b;
    margin-top: 4px;
    font-weight: 500;
}

.more-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    flex-shrink: 0;
}

.more-btn:active {
    color: #667eea;
}

.attraction-images {
    margin: 12px 0;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.attraction-images::-webkit-scrollbar {
    height: 4px;
}

.attraction-images::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.attraction-img {
    height: 120px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s;
}

.attraction-img:active {
    transform: scale(1.05);
}

.attraction-img:only-child {
    width: 100%;
    max-width: 400px;
}

.attraction-notes {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    margin-top: 10px;
}

.travel-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    color: #666;
    font-size: 13px;
}

.travel-icon {
    font-size: 16px;
}

.travel-time {
    font-weight: 500;
    color: #333;
}

.travel-mode,
.travel-notes {
    color: #999;
}
