:root {
    --primary-color: #ff9f43;
    --secondary-color: #feca57;
    --background-color: #fefaf0;
    --card-bg: #ffffff;
    --text-color: #2f3542;
    --border-color: #dfe4ea;
    --success-color: #2ed573;
    --danger-color: #ff4757;
    --info-color: #48dbfb;
    --warning-color: #ffa502;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background-color: #fff;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #2f3542;
    border-radius: 0 0 20px 20px;
    margin: 0 10px;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.navbar-brand span {
    color: var(--primary-color);
    margin-right: 5px;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Container & Layout */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1;
    width: 100%;
}

.footer {
    background-color: #fff;
    padding: 1.5rem;
    text-align: center;
    margin-top: auto;
    border-top: 1px solid #dfe4ea;
    color: #666;
    font-size: 0.9rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 2px solid #2f3542;
    margin-bottom: 1.5rem;
    transition: transform 0.2s;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.5;
}

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

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(255, 159, 67, 0.3);
}

.btn-primary:hover {
    background-color: #e68a35;
}

.btn-secondary {
    background-color: #f1f2f6;
    color: var(--text-color);
    border: 1px solid #dfe4ea;
}

.btn-secondary:hover {
    background-color: #dfe4ea;
}

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

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}

/* Dashboard Actions */
.dashboard-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #dfe4ea;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background-color: #fff;
    -webkit-appearance: none; /* iOS 移除默认样式 */
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    background-color: #fff;
}

.table th, .table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #f1f2f6;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #57606f;
    white-space: nowrap;
}

/* Grid System */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Stat Cards */
.stat-card {
    text-align: center;
    padding: 1.5rem;
    margin-bottom: 0;
}

.stat-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: #747d8c;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Filter Box */
.filter-box {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-item {
    flex: 1;
    min-width: 200px;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

/* Pagination */
.pagination-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-controls input {
    width: 60px;
    text-align: center;
    padding: 0.5rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.chart-item {
    height: 300px;
    position: relative;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .navbar .nav-links {
        display: none;
    }

    .navbar {
        margin: 0;
        border-radius: 0;
        padding: 0.8rem 1rem;
        padding-top: max(0.8rem, env(safe-area-inset-top)); /* 适配 iOS 刘海屏 */
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .container {
        margin: 1rem auto;
        margin-bottom: 80px;
        padding: 0 1rem;
    }

    .footer {
        padding-bottom: calc(1.5rem + 70px);
    }
    
    /* 移动端卡片式表格 */
    .table thead {
        display: none;
    }

    .table, .table tbody, .table tr, .table td {
        display: block;
        width: 100%;
    }

    .table tr {
        margin-bottom: 1rem;
        background: #fff;
        border: 1px solid #dfe4ea;
        border-radius: 10px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        padding: 0.5rem;
    }

    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.8rem 0.5rem;
        border-bottom: 1px solid #f1f2f6;
        text-align: right;
    }

    .table td:last-child {
        border-bottom: none;
        justify-content: flex-end;
        gap: 0.5rem;
    }

    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #747d8c;
        margin-right: 1rem;
        text-align: left;
    }

    .card {
        padding: 1.2rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    /* Dashboard Actions Mobile */
    .dashboard-actions {
        flex-direction: column;
    }

    .grid-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .chart-item {
        height: 250px;
    }

    /* 移动端底部导航 */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #fff;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        border-top: 1px solid #eee;
        justify-content: space-around;
        align-items: center;
        padding: 0.5rem 0;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
        z-index: 1000;
        height: 60px;
        box-sizing: content-box;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #a4b0be;
        font-size: 0.75rem;
        flex: 1;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-item i {
        font-size: 1.2rem;
        margin-bottom: 4px;
    }

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

    .mobile-nav-item.center-btn {
        position: relative;
        top: -20px;
    }

    .add-btn-circle {
        width: 50px;
        height: 50px;
        background-color: var(--primary-color);
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        box-shadow: 0 4px 10px rgba(255, 159, 67, 0.4);
        border: 4px solid #fff;
    }

    .add-btn-circle i {
        color: #fff;
        font-size: 1.5rem;
        margin: 0;
    }

    /* 移动端表单优化 */
    .form-control {
        font-size: 16px; /* 防止 iOS 缩放 */
        padding: 10px 12px;
    }
    
    .btn {
        min-height: 44px; /* 增大点击区域 */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 筛选区域垂直排列 */
    .filter-box {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }
    
    .filter-item {
        min-width: 100%;
    }
    
    .filter-actions {
        flex-direction: row;
        width: 100%;
    }
    
    .filter-actions .btn {
        flex: 1;
    }
    
    /* 列表操作按钮 */
    .table .btn-sm {
        padding: 0.4rem 0.8rem;
        min-height: 32px;
        margin-right: 5px;
    }
    
    /* 分页优化 */
    .pagination-box {
        flex-direction: column;
        align-items: center;
    }
    
    .pagination-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .pagination-controls .btn {
        flex: 1;
    }
}
