/* ==========================================
   支付宝服务商批量转账系统 - 全局样式
   ========================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #333;
    background: #f0f2f5;
    line-height: 1.6;
}

a { color: #1677ff; text-decoration: none; }
a:hover { color: #0958d9; }

code {
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
    font-size: 12px;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    color: #d4380d;
}

code.small { font-size: 11px; }

/* ============ Layout ============ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.sidebar-header small {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: rgba(255,255,255,0.65);
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.nav-item.active {
    color: #fff;
    background: rgba(22,119,255,0.2);
    border-left-color: #1677ff;
}

.nav-icon { margin-right: 10px; font-size: 16px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
}

.sidebar-footer .user-info {
    display: block;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
}

.btn-logout {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.65);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(255,77,79,0.15);
    border-color: #ff4d4f;
    color: #ff4d4f;
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px;
    min-height: 100vh;
}

/* ============ Page Header ============ */
.page-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a2e;
}

.breadcrumb {
    font-size: 13px;
    color: #999;
}

/* ============ Cards ============ */
.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
}

/* ============ Stats Grid ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}

.stat-card.clickable {
    cursor: pointer;
}

.stat-card.clickable:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: #999;
    margin-top: 2px;
}

/* ============ Tables ============ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: #fafafa;
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tbody tr:hover {
    background: #f9fbff;
}

.empty-row {
    text-align: center;
    color: #999;
    padding: 40px 0 !important;
}

.empty-row a { color: #1677ff; text-decoration: underline; }

/* ============ Badges ============ */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success, .badge-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.badge-error, .badge-fail { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.badge-pending, .badge-draft { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }
.badge-processing { background: #e6f7ff; color: #1677ff; border: 1px solid #91d5ff; }
.badge-partial { background: #f9f0ff; color: #722ed1; border: 1px solid #d3adf7; }
.badge-auth-authorized { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.badge-auth-pending { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }
.badge-auth-expired { background: #fafafa; color: #999; border: 1px solid #d9d9d9; }
.badge-auth-revoked { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }

/* ============ Buttons ============ */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #1677ff;
    color: #fff;
    border-color: #1677ff;
}

.btn-primary:hover { background: #0958d9; border-color: #0958d9; }

.btn-danger {
    background: #ff4d4f;
    color: #fff;
    border-color: #ff4d4f;
}

.btn-danger:hover { background: #cf1322; border-color: #cf1322; }

.btn-outline {
    background: #fff;
    color: #1677ff;
    border-color: #1677ff;
}

.btn-outline:hover { background: #e6f7ff; }

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-block { display: block; width: 100%; }

/* ============ Forms ============ */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.required { color: #ff4d4f; }

.form-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.form-input:focus {
    border-color: #1677ff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(22,119,255,0.08);
}

textarea.form-input {
    height: auto;
    padding: 10px 12px;
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}

select.form-input {
    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='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.form-row .form-group { flex: 1; }

.form-inline-auth {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-inline-auth .form-group { margin-bottom: 0; }

.input-copy {
    display: flex;
    gap: 8px;
}

.input-copy input { flex: 1; }

/* ============ Alerts ============ */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #389e0d;
}

.alert-error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #cf1322;
}

/* ============ Modal ============ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    width: 520px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    padding: 24px;
}

.modal-lg { width: 640px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover { background: #f0f0f0; color: #333; }

/* ============ Pagination ============ */
.pagination {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    justify-content: center;
}

.page-link {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    text-decoration: none;
}

.page-link:hover { border-color: #1677ff; color: #1677ff; }
.page-link.active { background: #1677ff; color: #fff; border-color: #1677ff; }

/* ============ Action Buttons ============ */
.action-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ============ App Grid ============ */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.app-card {
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    padding: 20px;
    transition: box-shadow 0.2s;
    background: #fff;
}

.app-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }

.app-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.app-icon { font-size: 28px; }

.app-card h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #1a1a2e;
}

.app-info {
    font-size: 12px;
    color: #999;
    margin-bottom: 16px;
    line-height: 2;
}

.app-info code { font-size: 11px; }

.app-card-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

/* ============ Batch Info ============ */
.batch-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    font-size: 13px;
    color: #666;
}

.batch-info strong { color: #333; }

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 16px;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar-header h2,
    .sidebar-header small,
    .sidebar-footer,
    .nav-item span:not(.nav-icon) {
        display: none;
    }
    .nav-item { padding: 12px; justify-content: center; }
    .nav-icon { margin-right: 0; font-size: 18px; }
    .main-content { margin-left: 60px; padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { flex-direction: column; }
    .app-grid { grid-template-columns: 1fr; }
    .batch-info { grid-template-columns: 1fr 1fr; }
}
