/* css/index.css - 订单统计系统样式文件 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 900px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    overflow: hidden;
}

.header {
    background: linear-gradient(90deg, #2575fc, #6a11cb);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.header p {
    opacity: 0.9;
    font-size: 14px;
    margin-top: 5px;
}

.content {
    padding: 30px;
}

.date-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    text-align: center;
}

.date-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 20px;
    font-weight: 500;
}

.date-input-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.date-input {
    padding: 12px 18px;
    border: 2px solid #e6e6e6;
    border-radius: 10px;
    font-size: 16px;
    background: white;
    width: 200px;
    cursor: pointer;
}

.date-input:focus {
    outline: none;
    border-color: #2575fc;
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.1);
}

.query-btn {
    background: linear-gradient(90deg, #2575fc, #6a11cb);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.query-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 117, 252, 0.3);
}

.query-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.stats-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border-top: 5px solid #2575fc;
    flex: 1 1 calc(25% - 15px);
    min-width: 180px;
}

.stat-card.paid {
    border-top-color: #dc3545;
}

.stat-card.unpaid {
    border-top-color: #ffc107;
}

.stat-card.amount {
    border-top-color: #28a745;
}

.stat-card.visitor {
    border-top-color: #6f42c1;
}

.stat-card.full-width {
    flex: 1 1 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.stat-title {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.stat-card.paid .stat-value {
    color: #dc3545;
}

.stat-card.amount .stat-value {
    color: #28a745;
}

.stat-card.visitor .stat-value {
    color: #6f42c1;
}

.stat-percentage {
    font-size: 14px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(37, 117, 252, 0.1);
    color: #2575fc;
    display: inline-block;
}

.stat-card.paid .stat-percentage {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.stat-card.visitor .stat-percentage {
    background: rgba(111, 66, 193, 0.1);
    color: #6f42c1;
}

.ranking-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-top: 20px;
}

.ranking-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e6e6e6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.ranking-table th {
    background: rgba(37, 117, 252, 0.1);
    color: #2575fc;
    font-weight: 600;
    text-align: left;
    padding: 12px 8px;
    border-bottom: 2px solid #e6e6e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-table tr:hover {
    background: rgba(37, 117, 252, 0.05);
}

.product-name {
    font-weight: 500;
    color: #333;
}

.order-count {
    color: #dc3545;
    font-weight: 600;
}

.order-ratio {
    color: #2575fc;
    font-weight: 600;
}

.sales-percentage {
    color: #28a745;
    font-weight: 600;
}

.sales-amount {
    color: #6c757d;
    font-size: 14px;
}

.ranking-table th:nth-child(1),
.ranking-table td:nth-child(1) { 
    width: 22%; 
    padding-left: 10px;
}

.ranking-table th:nth-child(2),
.ranking-table td:nth-child(2) { 
    width: 18%; 
    text-align: center;
}

.ranking-table th:nth-child(3),
.ranking-table td:nth-child(3) { 
    width: 18%; 
    text-align: center;
}

.ranking-table th:nth-child(4),
.ranking-table td:nth-child(4) { 
    width: 20%; 
    text-align: center;
}

.ranking-table th:nth-child(5),
.ranking-table td:nth-child(5) { 
    width: 22%; 
    text-align: right;
    padding-right: 10px;
}

.chart-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-top: 20px;
}

.chart-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e6e6e6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-title-with-note {
    justify-content: space-between;
    flex-wrap: wrap;
}

.chart-title-with-note small {
    font-size: 13px;
    color: #666;
    font-weight: 400;
}

.chart-container {
    width: 100%;
    height: 420px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hourly-chart-container {
    height: 430px;
}

#lineChart,
#hourlyChart {
    width: 100%;
    height: 100%;
}

.chart-loading-text {
    width: 100%;
    height: 100%;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
}

.chart-error-text {
    color: #dc3545;
}

.trend-controls {
    background: rgba(37, 117, 252, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.trend-btn {
    background: white;
    border: 2px solid #2575fc;
    color: #2575fc;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.trend-btn:hover {
    background: #2575fc;
    color: white;
}

.trend-btn.active {
    background: #2575fc;
    color: white;
}

.loading {
    text-align: center;
    padding: 50px;
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2575fc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { 
        transform: rotate(0deg); 
    }

    100% { 
        transform: rotate(360deg); 
    }
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.error-state {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    border: 1px solid #f5c6cb;
}

.footer-note {
    text-align: center;
    color: #666;
    font-size: 13px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    line-height: 1.5;
}

.footer-note small {
    color: #999;
    font-size: 12px;
}

@media (max-width: 768px) {
    .container {
        border-radius: 15px;
    }
    
    .content {
        padding: 20px;
    }
    
    .stats-container {
        gap: 10px;
    }
    
    .stat-card {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
        margin-bottom: 0;
        padding: 15px;
    }
    
    .stat-card.full-width {
        flex: 1 1 100%;
        margin-top: 10px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-title {
        font-size: 12px;
        letter-spacing: 0.5px;
    }
    
    .stat-percentage {
        font-size: 12px;
        padding: 3px 8px;
    }
    
    .date-input-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .date-input {
        width: 100%;
    }
    
    .ranking-table {
        font-size: 14px;
    }
    
    .ranking-table th,
    .ranking-table td {
        padding: 10px 5px;
        font-size: 12px;
    }
    
    .ranking-table th:nth-child(1),
    .ranking-table td:nth-child(1) { 
        width: 22%; 
        padding-left: 6px;
    }

    .ranking-table th:nth-child(2),
    .ranking-table td:nth-child(2) { 
        width: 18%; 
        text-align: center;
    }

    .ranking-table th:nth-child(3),
    .ranking-table td:nth-child(3) { 
        width: 18%; 
        text-align: center;
    }

    .ranking-table th:nth-child(4),
    .ranking-table td:nth-child(4) { 
        width: 20%; 
        text-align: center;
    }

    .ranking-table th:nth-child(5),
    .ranking-table td:nth-child(5) { 
        width: 22%; 
        text-align: right;
        padding-right: 6px;
    }
    
    .ranking-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .chart-container {
        height: 380px;
    }

    .hourly-chart-container {
        height: 460px;
    }
    
    .chart-section {
        padding: 20px 15px;
    }
    
    .chart-title {
        font-size: 18px;
        margin-bottom: 15px;
    }

    .chart-title-with-note {
        align-items: flex-start;
        gap: 8px;
    }

    .chart-title-with-note small {
        width: 100%;
        font-size: 12px;
    }
    
    .trend-controls {
        padding: 10px;
        gap: 10px;
    }
    
    .trend-btn {
        padding: 6px 15px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 24px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-title {
        font-size: 11px;
        margin-bottom: 8px;
    }
    
    .stat-percentage {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    .ranking-section {
        padding: 20px 12px;
    }
    
    .ranking-table th,
    .ranking-table td {
        padding: 8px 3px;
        font-size: 11px;
    }
    
    .ranking-table th:nth-child(1),
    .ranking-table td:nth-child(1) { 
        width: 22%;
        padding-left: 4px;
    }

    .ranking-table th:nth-child(2),
    .ranking-table td:nth-child(2) { 
        width: 18%;
        text-align: center;
    }

    .ranking-table th:nth-child(3),
    .ranking-table td:nth-child(3) { 
        width: 18%;
        text-align: center;
    }

    .ranking-table th:nth-child(4),
    .ranking-table td:nth-child(4) { 
        width: 20%;
        text-align: center;
    }

    .ranking-table th:nth-child(5),
    .ranking-table td:nth-child(5) { 
        width: 22%;
        text-align: right;
        padding-right: 4px;
    }
    
    .chart-container {
        height: 350px;
    }

    .hourly-chart-container {
        height: 470px;
    }
}

@media (max-width: 360px) {
    .stat-card {
        padding: 10px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-title {
        font-size: 10px;
    }
    
    .ranking-section {
        padding: 18px 10px;
    }
    
    .ranking-table th,
    .ranking-table td {
        padding: 6px 2px;
        font-size: 10px;
    }
    
    .ranking-table th:nth-child(1),
    .ranking-table td:nth-child(1) { 
        width: 22%;
        padding-left: 3px;
    }

    .ranking-table th:nth-child(2),
    .ranking-table td:nth-child(2) { 
        width: 18%;
        text-align: center;
    }

    .ranking-table th:nth-child(3),
    .ranking-table td:nth-child(3) { 
        width: 18%;
        text-align: center;
    }

    .ranking-table th:nth-child(4),
    .ranking-table td:nth-child(4) { 
        width: 20%;
        text-align: center;
    }

    .ranking-table th:nth-child(5),
    .ranking-table td:nth-child(5) { 
        width: 22%;
        text-align: right;
        padding-right: 3px;
    }
    
    .chart-container {
        height: 320px;
    }

    .hourly-chart-container {
        height: 460px;
    }
}

@media (max-width: 280px) {
    .stat-card:not(.full-width) {
        flex: 1 1 100%;
        margin-bottom: 10px;
    }
    
    .stat-card.full-width {
        margin-top: 0;
    }
}