/* ============================================
   支付学堂管理系统 - 全局主题样式 (Glassmorphism Dark)
   ============================================ */

/* === CSS 变量定义 === */
:root {
    /* 主色调 - Indigo/Violet */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.2);

    /* 辅助色 */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    /* 背景色 - Dark Theme */
    --bg-body: #0f172a;
    /* Slate 900 */
    --bg-card: rgba(30, 41, 59, 0.7);
    /* Slate 800 + Opacity */
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.05);

    /* 文字颜色 */
    --text-main: #f8fafc;
    /* Slate 50 */
    --text-sub: #94a3b8;
    /* Slate 400 */
    --text-muted: #64748b;
    /* Slate 500 */

    /* 尺寸 */
    --sidebar-width: 200px;
    /* Reduced to ~3/4 of original 260px */
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
    --border-radius: 16px;
    --border-radius-sm: 8px;

    /* 字体 - System Premium Stack */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* === 全局基础样式 === */
body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    /* 动态背景 */
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(239, 68, 68, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    overflow-x: hidden;
    /* Ensure body takes full height */
    min-height: 100vh;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 链接 */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

/* === 卡片样式 (Glass Card) === */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.glass-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

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

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === 按钮样式 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    gap: 8px;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.4);
}

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

.btn-success:hover {
    filter: brightness(110%);
}

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

.btn-danger:hover {
    filter: brightness(110%);
}

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

.btn-outline:hover {
    background: var(--glass-highlight);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-icon {
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
}

/* === 表单样式 === */
.form-control,
.form-select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 10px;
    width: 100%;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(15, 23, 42, 0.8);
}

.form-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-sub);
    font-size: 0.9rem;
    font-weight: 500;
}

/* === 表格样式 === */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
}

.zf-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-sub);
}

.zf-table th {
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--glass-border);
}

.zf-table td {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
}

.zf-table tr:last-child td {
    border-bottom: none;
}

.zf-table tr:hover td {
    background: var(--glass-highlight);
}

/* === 分页 === */
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 20px;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-sub);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.page-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.page-item.active .page-link {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === 状态徽章 === */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--info);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

/* === Sidebar === */
.zf-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    z-index: 100;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Push footer to bottom */
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Sidebar Collapsed State */
.zf-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    padding: 24px 12px;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    white-space: nowrap;
    gap: 12px;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.3s;
    flex-grow: 1;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.7;
}

.sidebar-toggle:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.zf-sidebar.collapsed .sidebar-top {
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.zf-sidebar.collapsed .sidebar-brand span {
    opacity: 0;
    width: 0;
}

.zf-sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 0;
}

.sidebar-brand i {
    color: var(--primary);
    flex-shrink: 0;
}

.zf-sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
    /* Enable scrolling for nav */
}

.zf-sidebar-nav::-webkit-scrollbar {
    width: 0px;
    /* Hide scrollbar for cleaner look */
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-sub);
    border-radius: 12px;
    margin-bottom: 4px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.zf-sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 14px 0;
}

.zf-sidebar.collapsed .nav-link span {
    display: none;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: translateX(4px);
}

.zf-sidebar.collapsed .nav-link:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), transparent);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    border-radius: 4px 12px 12px 4px;
}

.zf-sidebar.collapsed .nav-link.active {
    border-left: none;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    color: var(--primary);
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* === Sidebar Footer (Profile) === */
.sidebar-footer {
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
    margin-top: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-sub);
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    flex-shrink: 0;
}

.user-info {
    flex-grow: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-icon {
    opacity: 0;
    transform: translateX(-5px);
    transition: all 0.2s;
    color: var(--danger);
}

.user-profile:hover .logout-icon {
    opacity: 1;
    transform: translateX(0);
}

.zf-sidebar.collapsed .sidebar-footer {
    padding-top: 16px;
    display: flex;
    justify-content: center;
}

.zf-sidebar.collapsed .user-info,
.zf-sidebar.collapsed .logout-icon {
    display: none;
}

.zf-sidebar.collapsed .user-profile {
    padding: 0;
    background: transparent;
}

/* === Content Area === */
.zf-main {
    margin-left: var(--sidebar-width);
    padding-left: 24px;
    padding-right: 24px;
    padding-top: 16px;
    /* Create visual gap */
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Ensure no extra spacing */
    display: flex;
    flex-direction: column;
}

.zf-main.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

.content-wrapper {
    padding: 0;
    /* Removed padding as .zf-main now handles layout gaps */
    height: 100%;
    min-height: 100vh;
}

/* === Animations === */
@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: floatIn 0.4s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === Toast (Global Override) === */
.zf-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.zf-toast {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    color: white;
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
    min-width: 320px;
    animation: slideInRight 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    align-items: start;
    gap: 12px;
}

.zf-toast.success {
    border-left-color: var(--success);
}

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

.zf-toast.error {
    border-left-color: var(--danger);
}

.zf-toast.error i {
    color: var(--danger);
}

/* === Modal (Global Override) === */
.modal-content {
    background: #1e293b;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: var(--border-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    border-bottom: 1px solid var(--glass-border);
    padding: 20px 24px;
}

.modal-footer {
    border-top: 1px solid var(--glass-border);
    padding: 16px 24px;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* === Login Page Specifics === */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo i {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    margin-bottom: 16px;
}

.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
}