/* UniCore 统一样式文件 */

/* ========== 全局变量 ========== */
:root {
    --primary-color: #3B82F6;
    --primary-hover: #2563EB;
    --primary-light: #DBEAFE;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --info-color: #6366F1;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --white: #FFFFFF;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: all 0.3s ease;
}

/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 通用样式 ========== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.flex-col {
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

/* ========== 按钮样式 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    outline: none;
}

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

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

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

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

.btn-success:hover {
    background: #059669;
    box-shadow: var(--shadow-md);
}

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

.btn-danger:hover {
    background: #DC2626;
    box-shadow: var(--shadow-md);
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover {
    background: var(--gray-100);
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-small {
    padding: 6px 16px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========== 输入框样式 ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-label.required::after {
    content: '*';
    color: var(--danger-color);
    margin-left: 4px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--gray-800);
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
    color: var(--gray-400);
}

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

/* ========== 输入框组合 ========== */
.input-group {
    display: flex;
    gap: 8px;
}

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

.input-group .btn {
    white-space: nowrap;
}

.form-error {
    margin-top: 6px;
    font-size: 12px;
    color: var(--danger-color);
}

.form-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--danger-color);
}

/* ========== 卡片样式 ========== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-body {
    padding: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

/* ========== 徽章样式 ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-color);
}

.badge-success {
    background: #D1FAE5;
    color: var(--success-color);
}

.badge-warning {
    background: #FEF3C7;
    color: var(--warning-color);
}

.badge-danger {
    background: #FEE2E2;
    color: var(--danger-color);
}

.badge-info {
    background: #DBEAFE;
    color: #3B82F6;
}

.badge-secondary {
    background: #E5E7EB;
    color: #6B7280;
}

/* ========== 加载动画 ========== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-large {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

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

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

.toast-info {
    border-left: 4px solid var(--info-color);
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 16px;
    }

    .btn-large {
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* ========== 工具类 ========== */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }
.text-muted { color: var(--gray-500); }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* ========== 选项卡样式 ========== */
.tabs-container {
    margin-top: 16px;
}

.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 16px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

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

/* ========== 统计卡片网格 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

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

.stat-value-warning {
    color: var(--warning-color);
}

.stat-value-info {
    color: var(--info-color);
}

/* ========== 商户详情弹窗优化 ========== */
#merchantDetailModal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
}

#merchantDetailModal .modal-body {
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

#merchantDetailModal .tabs-container {
    margin-top: 20px;
}

#merchantDetailModal .tab-content {
    max-height: 400px;
    overflow-y: auto;
}

#merchantDetailModal .table-container {
    margin: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

#merchantDetailModal .table {
    margin: 0;
}

#merchantDetailModal .table th {
    background: var(--gray-50);
    padding: 12px 16px;
    font-weight: 600;
    white-space: nowrap;
}

#merchantDetailModal .table td {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200);
}

#merchantDetailModal .table tbody tr:hover {
    background: var(--gray-50);
}

/* 商户详情弹窗中的表格文字大小调整 */
#merchantDetailModal .table th,
#merchantDetailModal .table td {
    font-size: 13px;
}

/* 订单号列缩短显示 */
#merchantDetailModal .table tbody td:first-child {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 商户订单号和结算单号也缩短显示 */
#merchantDetailModal .table tbody td:nth-child(2) {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 状态列居中 */
#merchantDetailModal .table tbody td:nth-child(4),
#merchantDetailModal .table tbody td:nth-child(5) {
    text-align: center;
}

/* 金额列右对齐 */
#merchantDetailModal .table tbody td:nth-child(3) {
    text-align: right;
}

/* 时间列缩小字体 */
#merchantDetailModal .table tbody td:last-child {
    font-size: 12px;
    color: var(--gray-500);
}

/* 确保商户详情弹窗中的表格标题和内容对齐 */
#merchantDetailModal .table {
    table-layout: fixed;
    width: 100%;
}

#merchantDetailModal .table th,
#merchantDetailModal .table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 处理全宽列 */
#merchantDetailModal .detail-item.full-width {
    grid-column: 1 / -1;
}

/* 确保结算详情弹窗中的表格也对齐 */
#settlementDetailModal .data-table,
#orderDetailModal .data-table {
    table-layout: auto;
}
