/* ============================================================
   模块：base/css/framework.css
   功能：全局基础样式（仅含侧边栏、布局、弹窗、表格）
   版本：精简版 v4.0-core
   ============================================================ */

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    font-size: 14px;
    color: #0F172A;
    background: #F8FAFC;
}

:root {
    --geo-primary: #3B82F6;
    --geo-primary-hover: #2563EB;
    --geo-primary-light: #DBEAFE;
    --geo-primary-bg: #EFF6FF;
    --geo-success: #10B981;
    --geo-danger: #EF4444;
    --geo-warning: #F59E0B;
    --geo-bg: #F8FAFC;
    --geo-surface: #FFFFFF;
    --geo-text: #0F172A;
    --geo-text-secondary: #475569;
    --geo-text-tertiary: #94A3B8;
    --geo-border: #E2E8F0;
    --geo-radius: 8px;
    --geo-radius-lg: 12px;
    --geo-radius-xl: 16px;
    --geo-shadow: 0 4px 6px rgba(0,0,0,0.04);
    --geo-shadow-md: 0 10px 15px rgba(0,0,0,0.06);
    --geo-transition: 0.25s ease;
    --geo-transition-fast: 0.15s ease;
    --geo-sidebar-width: 240px;
    --geo-sidebar-collapsed-width: 64px;
    --geo-sidebar-bg: #0F172A;
    --geo-sidebar-text: #94A3B8;
    --geo-sidebar-hover-bg: rgba(255,255,255,0.08);
    --geo-sidebar-active-bg: rgba(59,130,246,0.2);
    --geo-sidebar-active-text: #60A5FA;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ============================================================
   侧边栏
   ============================================================ */
.geo-sidebar {
    position: relative;
    z-index: 100;
    width: var(--geo-sidebar-width);
    background: var(--geo-sidebar-bg);
    color: var(--geo-sidebar-text);
    display: flex;
    flex-direction: column;
    transition: width var(--geo-transition);
    overflow: hidden;
    flex-shrink: 0;
    min-height: 100vh; height: auto;
    border-right: 1px solid rgba(255,255,255,0.06);
}
.geo-sidebar.collapsed {
    width: var(--geo-sidebar-collapsed-width);
}

.geo-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
    cursor: pointer;
}
.geo-sidebar-header:hover {
    background: rgba(255,255,255,0.03);
}
.geo-sidebar-header img {
    height: 28px;
    width: auto;
    background: #FFFFFF;
    padding: 2px;
    object-fit: contain;
    flex-shrink: 0;
}
.geo-sidebar-logo-text {
    font-size: 16px;
    font-weight: 700;
    color: #F1F5F9;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--geo-transition-fast);
}
.geo-sidebar.collapsed .geo-sidebar-logo-text {
    opacity: 0;
    width: 0;
    margin: 0;
}
.geo-sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--geo-sidebar-text);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all var(--geo-transition-fast);
    flex-shrink: 0;
    margin-left: auto;
}
.geo-sidebar-toggle:hover {
    background: var(--geo-sidebar-hover-bg);
    color: #F1F5F9;
}
.geo-sidebar-toggle-icon {
    font-size: 12px;
    transition: transform var(--geo-transition);
}
.geo-sidebar.collapsed .geo-sidebar-toggle-icon {
    transform: rotate(180deg);
}

.geo-sidebar-menu {
    list-style: none;
    padding: 8px;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.geo-sidebar-menu::-webkit-scrollbar {
    width: 3px;
}
.geo-sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}
.geo-sidebar-section {
    padding: 12px 12px 4px;
    font-size: 10px;
    font-weight: 700;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    white-space: nowrap;
    overflow: hidden;
}
.geo-sidebar.collapsed .geo-sidebar-section {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}
.geo-sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 2px 0;
    color: var(--geo-sidebar-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    transition: all var(--geo-transition-fast);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}
.geo-sidebar-menu li a:hover {
    background: var(--geo-sidebar-hover-bg);
    color: #E2E8F0;
    transform: translateX(2px);
}
.geo-sidebar-menu li a.active {
    background: var(--geo-sidebar-active-bg);
    color: var(--geo-sidebar-active-text);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(59,130,246,0.3);
}
.geo-sidebar-menu li a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--geo-primary);
    border-radius: 0 2px 2px 0;
}
.geo-sidebar-menu li a .menu-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}
.geo-sidebar-menu li a .menu-text {
    overflow: hidden;
    text-overflow: ellipsis;
}
.geo-sidebar.collapsed .geo-sidebar-menu li a {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
}
.geo-sidebar.collapsed .geo-sidebar-menu li a .menu-text {
    display: none;
}

.geo-sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: auto;
    display: flex;
    align-items: center;
    position: relative;
}
.geo-sidebar.collapsed .geo-sidebar-footer {
    justify-content: center;
    padding: 14px 0;
}
#sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(148,163,184,0.4);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.15), 0 0 0 6px rgba(59,130,246,0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all var(--geo-transition-fast);
    background: rgba(255,255,255,0.05);
}
#sidebar-avatar:hover {
    border-color: var(--geo-primary);
    background: rgba(59,130,246,0.1);
    transform: scale(1.05);
}
#sidebar-user-menu {
    position: absolute;
    bottom: 52px;
    left: 8px;
    background: #1E293B;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 160px;
    z-index: 20;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    overflow: hidden;
}
#menu-user-info {
    padding: 10px 16px;
    font-size: 12px;
    color: #94A3B8;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-weight: 500;
}
#menu-item-logout {
    padding: 10px 16px;
    font-size: 13px;
    color: #E2E8F0;
    cursor: pointer;
    transition: all var(--geo-transition-fast);
    font-weight: 500;
}
#menu-item-logout:hover {
    background: rgba(239,68,68,0.15);
    color: #FCA5A5;
}
.menu-super-admin { display: none; }
body.is-super-admin .menu-super-admin { display: block; }

/* ============================================================
   弹窗
   ============================================================ */
.geo-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.geo-modal {
    background: var(--geo-surface);
    border-radius: var(--geo-radius-xl);
    box-shadow: 0 25px 50px rgba(0,0,0,0.12);
    padding: 28px;
    min-width: 360px;
    max-width: 90vw;
}
.geo-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--geo-text);
}
.geo-modal-body {
    font-size: 14px;
    color: var(--geo-text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}
.geo-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.geo-modal-btn {
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--geo-transition-fast);
}
.geo-modal-btn-primary {
    background: var(--geo-primary);
    color: white;
}
.geo-modal-btn-primary:hover {
    background: var(--geo-primary-hover);
}
.geo-modal-btn-secondary {
    background: #F1F5F9;
    color: var(--geo-text);
    border: 1px solid var(--geo-border);
}
.geo-modal-btn-secondary:hover {
    background: #E2E8F0;
}

/* ============================================================
   表格
   ============================================================ */
.geo-table-wrapper {
    overflow: auto;
    border-radius: var(--geo-radius-lg);
    border: 1px solid var(--geo-border);
    background: var(--geo-surface);
}
.geo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.geo-table th {
    background: #F8FAFC;
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 12px;
    color: var(--geo-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--geo-border);
    white-space: nowrap;
}
.geo-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #F1F5F9;
    color: var(--geo-text);
    vertical-align: middle;
}
.geo-table tbody tr:hover {
    background: #F0F7FF;
}
.geo-table tbody tr:last-child td {
    border-bottom: none;
}
.geo-col-resizer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    background: transparent;
    transition: background var(--geo-transition-fast);
}
.geo-col-resizer:hover,
.geo-col-resizer.active {
    background: var(--geo-primary);
    opacity: 0.3;
}

/* ============================================================
   工具类
   ============================================================ */
.geo-flex { display: flex; }
.geo-flex-center { display: flex; align-items: center; justify-content: center; }
.geo-flex-between { display: flex; align-items: center; justify-content: space-between; }
.geo-gap-2 { gap: 8px; }
.geo-gap-4 { gap: 16px; }
.geo-mt-2 { margin-top: 8px; }
.geo-mt-4 { margin-top: 16px; }
.geo-mb-4 { margin-bottom: 16px; }
.geo-text-center { text-align: center; }
.geo-hidden { display: none; }
.geo-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   响应式适配（仅基础）
   ============================================================ */
@media (max-width: 768px) {
    .geo-modal {
        min-width: auto;
        margin: 0 16px;
    }
}

/* 保证登录页容器不被覆盖 */
#header-container { display: none !important; }
