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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #334155;
    background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
    min-height: 100vh;
}

/* 容器样式 */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 25px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 16px;
    color: white;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.25);
}

.header-icon {
    margin-bottom: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: white;
}

.header-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.header-description {
    font-size: 0.95rem;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .header {
        padding: 20px 15px;
        border-radius: 12px;
    }
    
    .header-title {
        font-size: 1.4rem;
    }
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    padding: 10px 20px;
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* API密码部分 */
.api-section {
    margin-bottom: 20px;
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.api-section .input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.api-section input {
    width: 100%;
    height: 44px;
    padding: 0 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background-color: #fff;
}

.password-hint {
    font-size: 0.8rem;
    color: #f59e0b;
}

/* 数据来源选择器 */
.data-source-selector {
    margin-bottom: 15px;
}

.source-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    display: block;
    margin-bottom: 10px;
}

.source-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.source-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #ffffff;
}

.source-option:hover {
    border-color: #cbd5e1;
}

.source-option.active {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.source-option.active .option-text {
    color: white;
    font-weight: 600;
}

.source-option input[type="radio"] {
    display: none;
}

.option-text {
    font-size: 0.9rem;
    font-weight: 500;
}

.admin-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.admin-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.api-notice {
    margin-top: 15px;
    padding: 12px 15px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #92400e;
}

/* 查询表单样式 */
.query-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.label-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
    color: white;
}

/* 日期区域样式 */
.date-section {
    background-color: #ffffff;
    padding: 18px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.section-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.date-row {
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: flex-end;
}

.date-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
}

.label-icon {
    font-size: 1rem;
}

.date-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #94a3b8;
    padding-bottom: 12px;
}

.arrow-icon {
    font-size: 1.2rem;
    color: #3b82f6;
}

.arrow-text {
    font-size: 0.75rem;
    margin-top: -5px;
}

/* 开始日期和结束日期的特殊样式 */
.date-start {
    border-left: 3px solid #10b981 !important;
}

.date-end {
    border-left: 3px solid #ef4444 !important;
}

/* 日期快捷按钮 */
.date-quick-btns {
    margin-left: 10px;
}

.quick-btn {
    padding: 4px 12px;
    font-size: 0.8rem;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #64748b;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 5px;
}

.quick-btn:hover {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.quick-btn.active {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

/* 日期输入框优化 */
input[type="date"] {
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* 输入组样式 */
.input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* 输入框样式 */
.input-field {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background-color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.input-field:hover {
    border-color: #cbd5e1;
}

.input-field:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-field::placeholder {
    color: #94a3b8;
}

/* 按钮加载动画 */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary .btn-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
}

.btn-primary .btn-text,
.btn-primary .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: rotate 2s linear infinite;
}

.spinner .path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* 密码提示 */
.password-hint {
    font-size: 0.875rem;
    color: #f59e0b;
}

/* 标签页样式 */
.tabs {
    margin-bottom: 30px;
}

.tabs-list {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background-color: transparent;
    padding: 0;
    border-radius: 8px;
}

.tab-trigger {
    padding: 10px 20px;
    border: none;
    background-color: transparent;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-trigger:hover {
    color: #3b82f6;
}

.tab-trigger.active {
    background-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

/* 标签页内容 */
.tab-content {
    display: none;
}

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

/* 卡片样式 */
.card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    margin-bottom: 18px;
}

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #fafafa;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.card-description {
    font-size: 0.85rem;
    color: #64748b;
}

.card-content {
    padding: 20px;
}

/* 按钮样式 */
.btn-primary {
    width: 100%;
    height: 48px;
    padding: 0 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-primary:disabled {
    background-color: #93c5fd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 加载状态 */
.loading {
    margin-top: 20px;
    padding: 20px;
    text-align: center;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.9rem;
}

/* 查询结果 */
.query-result {
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.result-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.query-period {
    font-size: 0.85rem;
    color: #64748b;
    background-color: #f1f5f9;
    padding: 4px 12px;
    border-radius: 20px;
}

.result-card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin-bottom: 15px;
}

.query-result .result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.query-result .result-label {
    font-size: 0.9rem;
    color: #64748b;
}

.query-result .result-value {
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
    text-align: right;
    word-break: break-all;
}

.result-value.copyable {
    cursor: pointer;
    color: #3b82f6;
    transition: all 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}

.result-value.copyable:hover {
    background-color: #eff6ff;
}

/* 金额卡片 */
.amount-card {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.amount-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.amount-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.amount-period {
    font-size: 0.8rem;
    opacity: 0.8;
}

.query-info {
    margin-top: 15px;
    padding: 12px 15px;
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    color: #0369a1;
    font-size: 0.85rem;
}

.query-info small {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 统计数据 */
.statistics {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.statistics h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 15px;
}

.statistics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.statistics-item {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.statistics-item .stat-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 5px;
}

.statistics-item .stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #3b82f6;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #475569;
}

tr:nth-child(even) {
    background-color: #f8fafc;
}

tr:hover {
    background-color: #f1f5f9;
}

/* 前端查询结果表格样式 */
.data-table-container {
    margin-top: 25px;
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 10px;
}

.table-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.table-summary {
    display: flex;
    gap: 15px;
    font-size: 0.875rem;
    color: #64748b;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    box-shadow: none;
    border-radius: 0;
}

.result-table th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: #475569;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.result-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}

.result-table tr:nth-child(even) {
    background-color: #fafafa;
}

.result-table tr:hover {
    background-color: #f0f9ff;
}

.amount-cell {
    font-weight: 600;
    color: #059669;
    text-align: right;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .header-icon {
        width: 60px;
        height: 60px;
    }
    
    .header-icon svg {
        width: 30px !important;
        height: 30px !important;
    }
    
    .header-title {
        font-size: 1.4rem;
    }
    
    .header-description {
        font-size: 0.875rem;
    }
    
    /* 查询表单移动端优化 */
    .query-form {
        gap: 12px;
    }
    
    .date-section {
        padding: 0;
        background-color: transparent;
        border: none;
    }
    
    .date-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .section-label {
        font-size: 0.9rem;
    }
    
    .date-row {
        flex-direction: column;
        gap: 6px;
        align-items: center;
    }
    
    .date-group {
        align-items: center;
        width: 100%;
    }
    
    .date-arrow {
        display: none;
    }
    
    /* 移动端简化日期标签 */
    .date-label {
        font-size: 0.75rem;
        color: #64748b;
        margin-bottom: 2px;
    }
    
    .date-label .label-icon {
        display: none;
    }
    
    /* 移动端移除颜色边框，改用简洁样式，减少左内边距 */
    .date-start, .date-end {
        border-left: none !important;
        padding-left: 8px;
    }
    
    .date-quick-btns {
        margin-left: 0;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        width: 100%;
    }
    
    .quick-btn {
        padding: 6px 14px;
        font-size: 0.85rem;
        flex: 1;
        min-width: 60px;
        margin-right: 0;
    }
    
    .input-field {
        height: 52px;
        font-size: 16px; /* 防止iOS缩放 */
        padding: 0 14px;
    }
    
    /* 优化iOS日期选择器 */
    input[type="date"] {
        -webkit-appearance: none;
        appearance: none;
    }
    
    .btn-primary {
        width: 100%;
        height: 52px;
        font-size: 1rem;
        margin-top: 5px;
    }
    
    /* 查询结果移动端 */
    .query-result {
        margin-top: 12px;
    }
    
    /* 表格移动端适配 */
    .data-table-container {
        margin-top: 15px;
    }
    
    .table-header {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table-summary {
        width: 100%;
        justify-content: space-between;
    }
    
    .result-table {
        font-size: 0.85rem;
    }
    
    .result-table th,
    .result-table td {
        padding: 10px 8px;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .result-header h3 {
        font-size: 1rem;
    }
    
    .result-card {
        padding: 15px;
    }
    
    .query-result .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding: 10px 0;
    }
    
    .query-result .result-value {
        text-align: left;
        font-size: 1.05rem;
    }
    
    .amount-card {
        padding: 20px 15px;
    }
    
    .amount-value {
        font-size: 1.6rem;
    }
    
    .amount-label {
        font-size: 0.85rem;
    }
    
    .query-info {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .tabs-list {
        flex-direction: column;
    }
    
    .tab-trigger {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }
    
    .card-content {
        padding: 15px;
    }
    
    /* API密码区域 */
    .api-section {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .api-section .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* 数据来源选择器移动端 */
    .source-options {
        flex-direction: column;
    }
    
    .source-option {
        width: 100%;
        justify-content: center;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 1.25rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .statistics-grid {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease;
}

.query-result {
    animation: fadeIn 0.3s ease;
}

/* 错误提示 */
.error-message {
    margin-top: 10px;
    padding: 10px;
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    border-radius: 6px;
    color: #dc2626;
    font-size: 0.875rem;
}

/* 成功提示 */
.success-message {
    margin-top: 10px;
    padding: 10px;
    background-color: #ecfdf5;
    border: 1px solid #d1fae5;
    border-radius: 6px;
    color: #10b981;
    font-size: 0.875rem;
}