/**
 * SF顺丰运费计算器 - 主样式表
 * 包含响应式设计
 */

/* CSS变量 */
:root {
    --primary-color: #e60012;
    --primary-hover: #cc0010;
    --secondary-color: #333;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* 容器 */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.header {
    text-align: center;
    padding: 30px 0;
}

.header h1 {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-weight: 600;
}

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

/* 同步状态指示器 */
.sync-status {
    display: inline-block;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    margin-top: 8px;
}

.sync-status:empty {
    display: none;
}

.sync-status.syncing {
    background-color: #e6f7ff;
    color: #1890ff;
}

.sync-status.syncing::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 2px solid #1890ff;
    border-top-color: transparent;
    border-radius: 50%;
    margin-right: 6px;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

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

.sync-status.success {
    background-color: #f6ffed;
    color: #52c41a;
}

.sync-status.success::before {
    content: '\2713';
    margin-right: 4px;
}

.sync-status.offline {
    background-color: #fff7e6;
    color: #fa8c16;
}

.sync-status.offline::before {
    content: '\26A0';
    margin-right: 4px;
}

.sync-status.error {
    background-color: #fff2f0;
    color: #ff4d4f;
}

.sync-status.local {
    background-color: #f0f0f0;
    color: #8c8c8c;
}

/* 主内容 */
.main-content {
    flex: 1;
}

/* 输入区域 */
.input-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.input-group input[type="number"],
.input-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
    background: var(--card-bg);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.1);
}

/* 省份选择 */
.province-select-wrapper {
    position: relative;
}

.province-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.province-dropdown.active {
    display: block;
}

.province-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

.province-item:last-child {
    border-bottom: none;
}

.province-item:hover,
.province-item.selected {
    background: #fff5f5;
    color: var(--primary-color);
}

.province-item.highlighted {
    background: #fff0f0;
}

/* 选项面板 */
.options-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.option-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 4px;
}

/* 计费方式标签页 */
.billing-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.billing-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: var(--bg-color);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.billing-tab:first-child {
    border-right: 1px solid var(--border-color);
}

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

.billing-tab:hover:not(.active) {
    background: #eee;
}

/* 输入行布局 */
.input-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.input-row .input-group {
    margin-bottom: 0;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* 方数提示 */
.volume-hint {
    font-size: 11px;
    color: var(--primary-color);
    font-weight: normal;
    margin-left: 8px;
    background: #fff0f0;
    padding: 2px 6px;
    border-radius: 4px;
}

/* 计费重量提示 */
.input-tip {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0f9ff;
    border-radius: 6px;
    border-left: 3px solid #1890ff;
}

.input-tip #billing-weight-value {
    font-weight: 600;
    color: var(--primary-color);
}

.input-tip #billing-weight-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

/* 箱子信息 */
.box-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 6px;
}

.box-info .box-product {
    font-weight: 600;
    color: var(--text-primary);
}

.box-info .box-weight-info {
    color: var(--text-muted);
    margin-left: 12px;
}

/* 下拉选择框样式 */
.input-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
    background: var(--card-bg);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.1);
}

/* 管理员按钮组 */
.admin-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.btn-admin {
    flex: 1;
    min-width: 120px;
    padding: 10px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

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

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

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

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* 表单样式 */
.form-section {
    margin-bottom: 24px;
}

.form-section h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-group {
    flex: 1;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: var(--transition);
}

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

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 12px;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* 涨价幅度预览 */
.adjustment-preview {
    background: #fffbf0;
    border: 1px solid #ffe7ba;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
}

.preview-title {
    font-size: 13px;
    font-weight: 500;
    color: #d48806;
    margin-bottom: 10px;
}

.preview-content {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-label {
    font-size: 12px;
    color: var(--text-muted);
}

.preview-value {
    font-size: 14px;
    font-weight: 600;
    color: #d48806;
}

.preview-value.negative {
    color: var(--success-color);
}

/* 规则列表 */
.rules-section h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.rules-list {
    max-height: 200px;
    overflow-y: auto;
}

.rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    margin-bottom: 8px;
}

.rule-info {
    flex: 1;
}

.rule-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.rule-detail {
    font-size: 12px;
    color: var(--text-muted);
}

.rule-amount {
    font-size: 16px;
    font-weight: 600;
    margin-right: 12px;
}

.rule-amount.positive {
    color: #d48806;
}

.rule-amount.negative {
    color: var(--success-color);
}

.btn-delete {
    padding: 6px 12px;
    background: none;
    border: 1px solid #ff4d4f;
    color: #ff4d4f;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-delete:hover {
    background: #ff4d4f;
    color: white;
}

/* 抛比设置 */
.setting-tip {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-color);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    line-height: 1.8;
}

.volume-settings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.volume-setting-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
}

.volume-setting-label {
    width: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.volume-setting-inputs {
    display: flex;
    gap: 12px;
    flex: 1;
}

.volume-input-group {
    flex: 1;
}

.volume-input-group label {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.volume-input-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.volume-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.volume-kg-preview {
    font-size: 12px;
    color: var(--primary-color);
    margin-top: 4px;
}

.rules-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 13px;
}

/* Toggle Switch 样式 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: var(--transition);
    border-radius: 24px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus + .slider {
    box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.2);
}

/* Checkbox 样式 */
.checkbox-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-wrapper input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-wrapper .checkmark {
    position: relative;
    height: 20px;
    width: 20px;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}

.checkbox-wrapper:hover .checkmark {
    border-color: var(--primary-color);
}

.checkbox-wrapper input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-wrapper .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-wrapper input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-wrapper input:focus ~ .checkmark {
    box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.2);
}

/* 计算按钮 */
.btn-calculate {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-calculate:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-calculate:active {
    transform: translateY(0);
}

.btn-calculate:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 结果区域 */
.result-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.result-header h2 {
    font-size: 18px;
    color: var(--text-primary);
}

.result-info {
    font-size: 13px;
    color: var(--text-muted);
}

/* 价格列表 */
.price-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.price-item:hover {
    background: #f0f0f0;
}

.price-item.cheapest {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    border: 1px solid var(--primary-color);
}

.price-item.cheapest .price-rank {
    background: var(--primary-color);
}

.price-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.price-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--text-muted);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.price-name {
    font-weight: 500;
    color: var(--text-primary);
}

.price-right {
    text-align: right;
}

.price-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

.price-unit {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* 折扣信息样式 */
.price-discount-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.original-price {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.discount-badge {
    font-size: 11px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #ff6b6b 0%, #e60012 100%);
    color: white;
    border-radius: 4px;
    font-weight: 500;
}

/* 填仓折扣设置区域 */
.filling-discount-section {
    background: linear-gradient(135deg, #fff9f0 0%, #fff5e6 100%);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

.section-tip {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}

.discount-preview {
    background: white;
    padding: 16px;
    border-radius: var(--border-radius);
    margin: 16px 0;
}

.discount-preview .preview-title {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.discount-preview .preview-content {
    display: flex;
    gap: 24px;
}

.discount-preview .preview-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.discount-preview .preview-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.discount-preview .preview-value.highlight {
    color: var(--primary-color);
}

.btn-secondary {
    padding: 10px 20px;
    border: 1px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* 价格图表 */
.chart-container {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.chart-container h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chart-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-label {
    width: 80px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.chart-bar-wrapper {
    flex: 1;
    height: 24px;
    background: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #ff6b6b);
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    min-width: 60px;
}

.chart-bar-fill.cheapest {
    background: linear-gradient(90deg, var(--success-color), #73d13d);
}

.chart-bar-value {
    font-size: 11px;
    color: white;
    font-weight: 500;
}

/* 员工模式 - 推荐结果 */
.employee-result {
    text-align: center;
    padding: 40px 20px;
}

.employee-result .recommendation-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.employee-result .recommendation-method {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.employee-result .recommendation-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 16px;
}

/* 历史记录 */
.history-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.history-header h3 {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-clear-history {
    padding: 4px 12px;
    font-size: 12px;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-clear-history:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 14px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: var(--bg-color);
}

.history-info {
    display: flex;
    gap: 16px;
    font-size: 14px;
}

.history-weight {
    color: var(--text-primary);
    font-weight: 500;
}

.history-province {
    color: var(--text-secondary);
}

.history-price {
    color: var(--primary-color);
    font-weight: 500;
}

.history-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
}

/* 加载状态 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast提示 */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--secondary-color);
    color: white;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 14px;
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background: #ff4d4f;
}

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

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 20px 0;
    }

    .header h1 {
        font-size: 24px;
    }

    .input-section,
    .result-section,
    .history-section {
        padding: 16px;
    }

    .price-item {
        padding: 12px;
        flex-wrap: wrap;
    }

    .price-value {
        font-size: 18px;
    }

    .chart-label {
        width: 60px;
        font-size: 11px;
    }

    .history-info {
        flex-direction: column;
        gap: 4px;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 40px 20px;
    }

    .header {
        padding: 40px 0;
    }

    .input-section {
        padding: 32px;
    }
}

/* 无选中状态 */
.no-select {
    user-select: none;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==================== 日志统计模态框样式 ==================== */

.modal-large {
    max-width: 700px;
    max-height: 85vh;
}

.modal-small {
    max-width: 360px;
}

/* 密码模态框 */
.password-modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.password-modal-buttons button {
    flex: 1;
}

#admin-password-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    transition: border-color 0.2s;
}

#admin-password-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.logs-section {
    margin-bottom: 24px;
}

.logs-section h4 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.logs-content {
    min-height: 100px;
}

.logs-content .loading {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

.stats-empty, .stats-error {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 14px;
}

.stats-error {
    color: var(--primary-color);
}

/* 统计卡片 */
.stats-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

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

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 统计区块 */
.stats-section {
    margin-top: 20px;
}

.stats-section h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

/* IP 统计列表 */
.ip-stats-list {
    max-height: 200px;
    overflow-y: auto;
}

.ip-stat-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}

.ip-rank {
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    margin-right: 10px;
}

.ip-stat-item:nth-child(n+4) .ip-rank {
    background: var(--text-muted);
}

.ip-address {
    flex: 1;
    font-family: monospace;
    color: var(--text-secondary);
}

.ip-device {
    background: #e6f7ff;
    color: #1890ff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin: 0 10px;
}

.ip-count {
    font-weight: bold;
    color: var(--text-primary);
    margin-right: 10px;
}

.ip-last {
    color: var(--text-muted);
    font-size: 12px;
}

/* 每日趋势 */
.daily-trend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trend-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trend-date {
    width: 50px;
    font-size: 12px;
    color: var(--text-secondary);
}

.trend-bar-wrapper {
    flex: 1;
    height: 20px;
    background: var(--bg-color);
    border-radius: 10px;
    overflow: hidden;
}

.trend-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #ff6b6b);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.trend-count {
    width: 40px;
    font-size: 12px;
    font-weight: bold;
    text-align: right;
}

/* 审计日志列表 */
.audit-logs-list {
    max-height: 300px;
    overflow-y: auto;
}

.audit-log-item {
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid var(--success-color);
}

.audit-log-item.failed {
    border-left-color: var(--primary-color);
}

.audit-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.audit-action {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.audit-time {
    font-size: 12px;
    color: var(--text-muted);
}

.audit-log-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.audit-summary {
    font-size: 13px;
    color: var(--text-secondary);
}

.audit-ip {
    font-size: 11px;
    font-family: monospace;
    color: var(--text-muted);
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
}

/* 响应式 */
@media (max-width: 480px) {
    .stats-summary {
        flex-direction: column;
    }
    
    .stat-card {
        flex-direction: row;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .ip-stat-item {
        flex-wrap: wrap;
    }
    
    .ip-device {
        margin: 4px 0;
    }
}
