/* css/style.css (最终完整版 - 已修复Logo显示问题) */
:root {
    --bg-main-start: #f8f9fe;
    --bg-main-end: #e8ebf8;
    --bg-widget: rgba(255, 255, 255, 0.45);
    --bg-widget-solid: #ffffff;
    --primary-purple: #8364e8;
    --primary-blue: #a594f9;
    --text-main: #2d3748;
    --text-secondary: #718096;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-radius: 20px;
    --sidebar-collapsed-width: 90px;
    --sidebar-expanded-width: 280px;
    --transition-speed: 0.3s;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --shadow-color: rgba(131, 100, 232, 0.15);
    --sidebar-collapsed-padding: 25px; 
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* --- 核心布局 --- */
body {
    font-family: 'Poppins', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-image: linear-gradient(135deg, var(--bg-main-start) 0%, var(--bg-main-end) 100%);
    color: var(--text-main);
    position: relative;
}

body:has(> .sidebar-left) {
    display: grid;
    grid-template-columns: var(--sidebar-expanded-width) 1fr;
    height: 100vh;
    overflow: hidden;
    transition: grid-template-columns var(--transition-speed) ease;
}

.background-blob { position: absolute; border-radius: 50%; filter: blur(100px); z-index: -1; opacity: 0.7; }
.blob1 { width: 400px; height: 400px; top: -150px; left: -150px; background: rgba(165, 148, 249, 0.4); }
.blob2 { width: 300px; height: 300px; bottom: -100px; right: 5%; background: rgba(131, 100, 232, 0.3); }
.blob3 { width: 250px; height: 250px; top: 20%; right: 25%; background: rgba(180, 160, 255, 0.25); }


/* 
===================================================================
--- 通用 Logo 样式 (适用于所有页面) ---
===================================================================
*/
.logo {
    width: 40px;
    height: 40px;
    background-image: url('https://aixuexibiji.com/wp-content/uploads/2025/06/20250623192251557-logo2.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    flex-shrink: 0;
}


/* 
===================================================================
--- 侧边栏布局样式 (用于子页面) ---
===================================================================
*/
body.sidebar-collapsed { grid-template-columns: var(--sidebar-collapsed-width) 1fr; }
.sidebar-left { background-color: var(--bg-widget); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; width: 100%; transition: width var(--transition-speed) ease; }
.sidebar-header { display: flex; align-items: center; padding: 25px; flex-shrink: 0; min-height: 90px; transition: padding var(--transition-speed) ease; }
body.sidebar-collapsed .sidebar-header { padding-left: var(--sidebar-collapsed-padding); padding-right: var(--sidebar-collapsed-padding); }
.sidebar-left .logo { 
    /* 通用样式已提取，这里只保留侧边栏特有的样式 */
    margin-right: 15px; 
    transition: margin-right var(--transition-speed) ease; 
}
body.sidebar-collapsed .sidebar-left .logo { margin-right: 0; }
.sidebar-left .logo-text { font-size: 20px; font-weight: 600; white-space: nowrap; opacity: 1; transition: opacity 0.2s ease; color: var(--text-main); }
body.sidebar-collapsed .logo-text { opacity: 0; pointer-events: none; position: absolute; }
nav { flex-grow: 1; overflow-y: auto; overflow-x: hidden; }
nav::-webkit-scrollbar { width: 4px; }
nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }
nav ul { list-style: none; width: 100%; padding: 0 15px; transition: padding var(--transition-speed) ease; }
nav ul li a { color: var(--text-secondary); text-decoration: none; display: flex; align-items: center; padding: 14px 20px; margin: 5px 0; position: relative; border-radius: 12px; transition: all var(--transition-speed) ease; }
nav ul li a:hover { color: var(--text-main); background-color: rgba(255, 255, 255, 0.5); }
nav ul li a .fa-fw { width: 24px; font-size: 16px; text-align: center; margin-right: 20px; transition: margin-right var(--transition-speed) ease; }
nav .menu-text { font-size: 15px; white-space: nowrap; opacity: 1; transition: opacity 0.2s ease; }
body.sidebar-collapsed nav ul { padding: 0 10px; }
body.sidebar-collapsed nav ul li a { padding-left: 25px; padding-right: 0; }
body.sidebar-collapsed .menu-text { opacity: 0; pointer-events: none; position: absolute; }
body.sidebar-collapsed nav ul li a .fa-fw { margin-right: 0; }
nav ul .submenu li.active > a { color: var(--bg-widget-solid); font-weight: 500; background: linear-gradient(90deg, var(--primary-blue), var(--primary-purple)); box-shadow: 0 8px 20px -5px var(--shadow-color); }
nav .has-submenu > a { cursor: pointer; }
nav .submenu { list-style: none; padding-left: 0; max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out; background-color: rgba(255, 255, 255, 0.2); border-radius: 12px; margin-top: 5px; }
nav .submenu a { padding-left: 20px; }
nav .submenu a .fa-fw { font-size: 14px; margin-right: 15px; }
nav .submenu .menu-text { font-size: 14px; }
nav .has-submenu.open > .submenu { max-height: 500px; }
nav .has-submenu > a .fa-chevron-down { margin-left: auto; font-size: 12px; transition: transform var(--transition-speed) ease, opacity var(--transition-speed) ease; opacity: 1; }
body.sidebar-collapsed .has-submenu > a .fa-chevron-down { opacity: 0; }
nav .has-submenu.open > a .fa-chevron-down { transform: rotate(180deg); }
.sidebar-footer { padding: 20px; margin-top: auto; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; transition: all var(--transition-speed) ease; }
.user-profile { display: flex; align-items: center; gap: 15px; overflow: hidden; flex-grow: 1; }
#user-avatar-small { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; white-space: nowrap; opacity: 1; transition: opacity 0.2s ease; }
#user-nickname-small { font-weight: 600; color: var(--text-main); }
#logout-btn { font-size: 0.8rem; color: var(--text-secondary); text-decoration: none; }
#logout-btn:hover { color: var(--primary-purple); }
#sidebar-toggle { font-size: 20px; color: var(--text-secondary); text-decoration: none; padding: 10px; flex-shrink: 0; background: rgba(255,255,255,0.4); border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; }
#sidebar-toggle:hover { color: var(--text-main); background: rgba(255,255,255,0.7); }
#sidebar-toggle i { transition: transform 0.3s ease; }
body.sidebar-collapsed .user-profile { display: none; }
body.sidebar-collapsed .sidebar-footer { justify-content: flex-start; padding-left: var(--sidebar-collapsed-padding); padding-right: var(--sidebar-collapsed-padding); }
body.sidebar-collapsed .submenu { display: none !important; }
.main-content { display: flex; flex-direction: column; height: 100vh; overflow: hidden; animation: fadeIn 0.5s ease-out 0.3s forwards; opacity: 0; padding: 0; }
#content-area { flex-grow: 1; position: relative; width: 100%; height: 100%; background-color: var(--bg-widget); }
.content-iframe { display: none; width: 100%; height: 100%; border: none; background-color: transparent; }
.content-iframe.active { display: block; }
.welcome-message { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; font-size: 1.2rem; color: var(--text-secondary); background-color: transparent; border-radius: 0; line-height: 1.8; }
.welcome-message h3 { font-size: 1.8rem; color: var(--text-main); margin-bottom: 1rem; }


/* 
===================================================================
--- 标签页导航布局样式 (用于 index.html) ---
===================================================================
*/

.nav-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0; 
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-area .logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
}
.nav-header .user-profile {
    gap: 15px;
    flex-grow: 0;
}

#nav-main-content {
    flex-grow: 1;
    padding: 0 2rem;
}

#nav-tabs-container {
    display: flex;
    justify-content: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -2rem;
    margin-right: -2rem;
    padding-left: 2rem;
    padding-right: 2rem;
}
#nav-tabs-container::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.5rem 0.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--text-main);
}

.nav-tab.active {
    color: var(--primary-purple);
    font-weight: 600;
    border-bottom-color: var(--primary-purple);
}

#nav-grid-container {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.nav-category {
    background: var(--bg-widget);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 var(--shadow-color);
    animation: fadeIn 0.5s ease-out;
}

.nav-category h3 {
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-category h3 .fas {
    color: var(--primary-purple);
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-widget-solid);
    color: var(--text-secondary);
    padding: 1rem;
    border-radius: 12px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
}

.nav-button:hover {
    color: var(--bg-widget-solid);
    transform: translateY(-3px);
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-purple));
    box-shadow: 0 8px 20px -5px var(--shadow-color);
    border-color: transparent;
}

.nav-button i {
    font-size: 1.2rem;
    color: var(--primary-purple);
    transition: color 0.3s ease;
}

.nav-button:hover i {
    color: var(--bg-widget-solid);
}

.nav-footer {
    text-align: center;
    padding: 2rem 2rem 0 2rem;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

#nav-main-content .welcome-message,
#nav-grid-container .welcome-message {
    background: var(--bg-widget);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 4rem 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 var(--shadow-color);
    height: auto;
}

/* Expired Function Styles */
.nav-button.expired {
    opacity: 0.7;
    cursor: not-allowed;
    background: #f1f5f9;
    color: #94a3b8;
    border: 1px dashed #cbd5e1;
}

/*
===================================================================
--- User Center: Management Console Styles ---
===================================================================
*/

.management-console {
    width: 100%;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-widget);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    min-height: 520px;
}

.management-sidebar {
    width: 220px;
    flex: 0 0 220px;
    padding: 16px;
    border-right: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.35);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mgmt-nav-item {
    appearance: none;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.55);
    color: var(--text-secondary);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    font-size: 0.95rem;
}

.mgmt-nav-item i {
    width: 18px;
    text-align: center;
}

.mgmt-nav-item:hover {
    background: rgba(255, 255, 255, 0.75);
    color: var(--text-main);
    transform: translateY(-1px);
}

.mgmt-nav-item.active {
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-purple));
    color: #fff;
    box-shadow: 0 10px 22px -8px var(--shadow-color);
}

.management-content {
    flex: 1;
    padding: 20px;
    overflow: auto;
}

.mgmt-section {
    width: 100%;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.55);
}

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

.mgmt-table th,
.mgmt-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
}

.mgmt-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(248, 249, 254, 0.7);
    position: sticky;
    top: 0;
    z-index: 1;
}

.mgmt-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.7);
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.api-config-card {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 6px 18px -10px var(--shadow-color);
}

.api-config-card h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

.api-config-card h4 i {
    color: var(--primary-purple);
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-large {
    padding: 12px 18px;
    border-radius: 12px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    filter: brightness(1.02);
    box-shadow: 0 10px 22px -10px var(--shadow-color);
    transform: translateY(-1px);
}

.btn-icon {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.8);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, filter 0.15s ease;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
}

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

.mgmt-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.mgmt-modal-content {
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    z-index: 10;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-header {
    padding-right: 35px; /* 为绝对定位的关闭按钮留出空间 */
}

.mgmt-modal-content form {
    overflow-y: auto;
    padding-right: 5px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .mgmt-modal {
        padding: 0;
    }
    .mgmt-modal-content {
        max-width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin-bottom: 0;
    }
}

.permissions-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(248, 249, 254, 0.6);
    border: 1px solid var(--border-color);
}

.nav-button.expired:hover {
    transform: none;
    background: #f1f5f9;
    box-shadow: none;
    border-color: #cbd5e1;
}

.nav-button.expired i {
    color: #94a3b8;
}

.expired-badge {
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    font-weight: 500;
}
