/* ZPay 风格 UI 系统 - 极致稳定版 (支持 Edge/Chrome/Firefox) */
:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --sidebar-bg: #ffffff;
    --sidebar-text: #475569;
    --sidebar-active-bg: #f1f5f9;
    --sidebar-active-text: #3b82f6;
    --content-bg: #f4f7fe;
    --border-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --header-height: 70px;
    --sidebar-width: 250px;
}

* {
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--content-bg);
    color: var(--text-main);
}

/* 侧边栏结构 - 针对 Edge 优化稳定性 */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    z-index: 1000;
    border-right: 1px solid #eef2f6;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    border-bottom: 1px solid #f8fafc;
    flex-shrink: 0;
}

.sidebar-menu {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
    scrollbar-width: thin; /* Firefox 兼容 */
}

.menu-group {
    margin-bottom: 15px;
}

.menu-group-title {
    padding: 12px 24px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    margin: 2px 16px;
    border-radius: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    font-size: 0.9rem;
    font-weight: 600;
}

.menu-item i {
    width: 24px;
    margin-right: 10px;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
}

.menu-item:hover {
    background-color: #f8fafc;
    color: var(--primary);
}

.menu-item.active {
    background-color: var(--sidebar-active-bg);
    color: var(--primary);
}

.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid #f8fafc;
    flex-shrink: 0;
}

/* 顶部栏 */
.top-bar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background-color: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 900;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info-text {
    text-align: right;
}

/* 主内容布局修复 - 核心解决 Edge 乱序 */
.main-content {
    margin-left: var(--sidebar-width);
    padding: calc(var(--header-height) + 24px) 32px 32px;
    min-height: 100vh;
    width: auto;
    position: relative;
    display: block;
}

/* 蓝色统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    padding: 24px;
    border-radius: 12px;
    color: #ffffff;
    position: relative;
    overflow: hidden;
    min-height: 140px;
}

.stat-icon {
    font-size: 4rem;
    opacity: 0.15;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.stat-content {
    text-align: right;
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.stat-sub {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.stat-sub span {
    display: flex;
    gap: 4px;
}

.stat-sub b {
    color: #fff;
}

/* 警示条 */
.alert-banner {
    background-color: #fff7ed;
    border: 1px solid #ffedd5;
    color: #9a3412;
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.alert-banner i {
    margin-right: 12px;
    font-size: 1.1rem;
    color: #f97316;
}

/* 布局卡片 */
.card {
    background-color: #ffffff;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.card-body {
    padding: 24px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid #f8fafc;
    font-size: 0.875rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
}

.info-value {
    font-weight: 600;
}

/* 表格样式 */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    background-color: #f8fafc;
    padding: 14px 24px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    border-bottom: 1px solid #f1f5f9;
}

.admin-table td {
    padding: 16px 24px;
    border-bottom: 1px solid #f8fafc;
    font-size: 0.875rem;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

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

.btn-danger {
    background-color: #ef4444;
    color: #ffffff;
}

.btn-outline {
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #475569;
}

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

/* 输入框 */
.input-field {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    margin-bottom: 16px;
    transition: all 0.2s;
    background: #fcfdfe;
    box-sizing: border-box;
    display: block;
}

.input-field:focus {
    border-color: var(--primary);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-blue { background-color: #eff6ff; color: #3b82f6; }
.badge-gray { background-color: #f1f5f9; color: #64748b; }

/* 增强型输入框组 */
.input-group-modern {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.3s;
}

.input-group-modern:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: #fff;
}

.input-group-modern label {
    display: block;
    font-size: 0.85rem;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 16px;
    color: #94a3b8;
    font-size: 1.1rem;
    pointer-events: none;
}

.input-with-icon .input-field {
    padding-left: 48px !important;
    margin-bottom: 0 !important;
    border-color: #e2e8f0 !important;
    background: #fff !important;
}

/* 极简配置卡片 */
.config-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #eef2f6;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.config-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.config-header .title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-header .title-icon {
    color: var(--primary);
    font-size: 1.1rem;
}

.config-header .title-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
}

.config-body {
    padding: 20px 24px;
}

.config-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid #f1f5f9;
}

.config-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 4px;
}

.config-item .input-field-plain {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    outline: none;
}

/* 紧凑型套餐方案 */
.plan-card-compact {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #eef2f6;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.plan-number {
    width: 32px;
    height: 32px;
    background: #eff6ff;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    flex-shrink: 0;
}

.plan-inputs {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 12px;
}

.plan-inputs .input-field {
    margin-bottom: 0;
    height: 40px;
    padding: 0 12px;
    font-size: 0.85rem;
    border-radius: 10px;
}

/* 响应式适配 */
@media (max-width: 1024px) {
    :root { --sidebar-width: 80px; }
    .sidebar-header span, .menu-item span, .menu-group-title, .sidebar-footer span { display: none; }
    .menu-item i { margin-right: 0; }
    .top-bar, .main-content { left: 80px; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content, .top-bar { margin-left: 0 !important; left: 0 !important; }
}
