/* ===== 自驾游手账 - 暖色扁平风格 ===== */
:root {
    --bg: #fdf6ec;
    --bg-card: #fffaf2;
    --primary: #e07a3c;
    --primary-light: #f5a662;
    --primary-dark: #c45e22;
    --accent: #d4a373;
    --accent-light: #e9c9a0;
    --text: #4a3728;
    --text-light: #8b7355;
    --text-muted: #b8a088;
    --border: #ecd9c0;
    --border-light: #f5e6d0;
    --success: #7cb342;
    --danger: #e57373;
    --warning: #ffb74d;
    --info: #64b5f6;
    --shadow: 0 2px 12px rgba(224, 122, 60, 0.12);
    --shadow-hover: 0 4px 20px rgba(224, 122, 60, 0.2);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

a:hover {
    color: var(--primary-dark);
}

/* ===== 顶部导航 ===== */
.navbar {
    background: var(--bg-card);
    border-bottom: 2px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.navbar-brand {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand .icon {
    font-size: 24px;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.navbar-user .username {
    color: var(--text-light);
}

.navbar-user .admin-badge {
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}

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

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

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

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

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

.btn-danger:hover {
    background: #d32f2f;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* ===== 容器 ===== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
}

.container-sm {
    max-width: 480px;
    margin: 40px auto;
    padding: 0 20px;
}

/* ===== 卡片 ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: rgba(224, 122, 60, 0.03);
}

/* ===== 登录/注册页 ===== */
.auth-card {
    padding: 36px 32px;
}

.auth-card h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 24px;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 28px;
    font-size: 14px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-light);
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

/* ===== 旅行卡片网格 ===== */
.trips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.trip-card {
    cursor: pointer;
    position: relative;
}

.trip-card .trip-route {
    font-size: 15px;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.trip-card .trip-title {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.trip-card .trip-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.trip-card .trip-stats .stat {
    display: flex;
    flex-direction: column;
}

.trip-card .trip-stats .stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.trip-card .trip-dates {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.trip-card .trip-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.trip-card:hover .trip-actions {
    opacity: 1;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* ===== 页面标题 ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    color: var(--text);
}

.page-header .back-link {
    font-size: 14px;
    color: var(--text-light);
}

/* ===== 旅行详情头部 ===== */
.trip-detail-header {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff;
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 24px;
}

.trip-detail-header h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

.trip-detail-header .route {
    font-size: 15px;
    opacity: 0.9;
    margin-bottom: 16px;
}

.trip-detail-header .stats-row {
    display: flex;
    gap: 24px;
    flex-wrap: nowrap;
}

.trip-detail-header .stat-item {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    text-align: center;
}

.trip-detail-header .stat-label {
    font-size: 12px;
    opacity: 0.8;
}

.trip-detail-header .stat-value {
    font-size: 20px;
    font-weight: 700;
}

/* ===== 每日记录卡片 ===== */
.daily-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.daily-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.daily-card-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.daily-card-header:hover {
    background: rgba(224, 122, 60, 0.04);
}

.daily-card-header .date-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.daily-card-header .day-num {
    background: var(--primary);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.daily-card-header .date-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.daily-card-header .date-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.daily-card-header .summary {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-light);
    align-items: center;
}

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

.daily-card-header .chevron {
    transition: transform 0.3s;
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 8px;
}

.daily-card.expanded .chevron {
    transform: rotate(180deg);
}

.daily-card-body {
    display: none;
    padding: 0 20px 20px;
    border-top: 1px solid var(--border-light);
}

.daily-card.expanded .daily-card-body {
    display: block;
}

.daily-card-body .detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.daily-card-body .detail-item {
    background: var(--bg);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
}

.daily-card-body .detail-item .label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.daily-card-body .detail-item .value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.daily-card-body .detail-item .value.cost {
    color: var(--primary);
}

.daily-card-body .notes-section {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-light);
    white-space: pre-wrap;
}

.daily-card-body .card-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

/* ===== 模态框 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(74, 55, 40, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== 闪存消息 ===== */
.flash {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 14px;
}

.flash-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.flash-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.flash-warning {
    background: #fff8e1;
    color: #f57f17;
    border: 1px solid #ffe082;
}

/* ===== 管理员表格 ===== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.admin-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-light);
    font-size: 13px;
}

.admin-table tr:hover {
    background: rgba(224, 122, 60, 0.03);
}

.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-light);
}

.admin-tab {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.admin-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.admin-tab-content {
    display: none;
}

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

/* ===== 预览模式提示 ===== */
.preview-banner {
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    color: #fff;
    text-align: center;
    padding: 10px;
    font-size: 13px;
}

.preview-banner a {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

/* ===== 统计概览 ===== */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 10px;
    border: 1px solid var(--border-light);
    text-align: center;
    min-width: 0;
    overflow: hidden;
}

.stat-card .stat-icon {
    font-size: 26px;
    margin-bottom: 6px;
}

.stat-card .stat-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    word-break: break-all;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .navbar {
        padding: 0 14px;
    }

    .navbar-user .username {
        display: none;
    }

    .container {
        padding: 16px 12px;
    }

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

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

    .stats-overview {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .stat-card {
        padding: 10px 4px;
    }

    .stat-card .stat-icon {
        font-size: 18px;
        margin-bottom: 3px;
    }

    .stat-card .stat-number {
        font-size: 13px;
    }

    .stat-card .stat-label {
        font-size: 9px;
    }

    .trip-detail-header {
        padding: 16px 14px;
    }

    .trip-detail-header .stats-row {
        gap: 8px;
    }

    .trip-detail-header .stat-value {
        font-size: 15px;
    }

    .trip-detail-header .stat-label {
        font-size: 10px;
    }

    .daily-card-header .summary {
        gap: 10px;
        font-size: 12px;
    }

    .daily-card-body .detail-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-table {
        font-size: 12px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 10px;
    }
}