/* ============================================================
 * common.css - 公共样式（布局 + 导航 + 玻璃风变量）
 * 直播OA系统 - 透明玻璃简约风
 * ============================================================ */

/* === 设计变量 === */
:root {
    /* 主色调：直播公司常用的活力渐变 */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --gradient-primary: linear-gradient(135deg, #a5b4fc 0%, #c4b5fd 100%);

    /* 状态色 */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    /* 玻璃风颜色 */
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-bg-hover: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    --glass-shadow-hover: 0 12px 40px rgba(99, 102, 241, 0.25);

    /* 文字色 */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-on-primary: #ffffff;

    /* 中性色 */
    --bg-body: #eef2ff;
    --bg-page: #f8fafc;
    --border-light: rgba(226, 232, 240, 0.6);

    /* 间距系统（紧凑） */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;

    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* 弹性动画曲线 */
    --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    /* 尺寸 */
    --sidebar-width: 220px;
    --sidebar-collapsed: 64px;
    --header-height: 60px;
}

/* === Reset === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
        "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 渐变背景 + 装饰光斑 */
body {
    background: linear-gradient(135deg, #e0e7ff 0%, #f0f9ff 50%, #faf5ff 100%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}

body::before {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #a78bfa, transparent 70%);
    top: -100px;
    right: -100px;
}

body::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #60a5fa, transparent 70%);
    bottom: -150px;
    left: -150px;
}

/* === 滚动条 === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* === App 主容器 === */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "logo header"
        "sidebar main";
    height: 100vh;
    position: relative;
    z-index: 1;
    transition: grid-template-columns 0.3s var(--ease-smooth);
}

.app.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed) 1fr;
}

/* === 顶部 Logo 区 === */
.app-logo {
    grid-area: logo;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 2px 12px rgba(165, 180, 252, 0.4);
    overflow: hidden;
}

.app-logo .logo-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    flex-shrink: 0;
}

/* === 顶部导航栏 === */
.app-header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* 折叠按钮 */
.sidebar-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
}

.sidebar-toggle:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px;
}

/* 面包屑 */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* 搜索框 */
.header-search {
    position: relative;
    width: 240px;
}

.header-search input {
    width: 100%;
    height: 36px;
    padding: 0 var(--space-md) 0 36px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all 0.25s var(--ease-smooth);
}

.header-search input::placeholder {
    color: var(--text-tertiary);
}

.header-search input:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.header-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

/* 用户头像 */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s var(--ease-elastic);
}

.user-avatar:hover {
    transform: scale(1.08);
}

/* === 侧边栏 === */
.app-sidebar {
    grid-area: sidebar;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid var(--glass-border);
    padding: var(--space-md) 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s var(--ease-smooth);
}

.sidebar-menu {
    list-style: none;
    padding: 0 var(--space-sm);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-menu .menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: 2px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s var(--ease-smooth);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-menu .menu-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
    transform: translateX(2px);
}

.sidebar-menu .menu-item.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar-menu .menu-item .menu-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-menu .menu-item .menu-text {
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.2s;
}

/* 登出按钮样式 */
.sidebar-menu .menu-logout {
    margin-top: auto;
    color: var(--color-danger);
    border-top: 1px solid var(--border-light);
    padding-top: var(--space-md);
}

.sidebar-menu .menu-logout:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--color-danger);
}

.app.sidebar-collapsed .sidebar-menu .menu-text {
    opacity: 0;
    width: 0;
}

.app.sidebar-collapsed .sidebar-menu .menu-item {
    justify-content: center;
}

/* === 主内容区 === */
.app-main {
    grid-area: main;
    padding: var(--space-xl);
    overflow-y: auto;
    position: relative;
}

/* === 页面标题区 === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.page-title .count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 var(--space-sm);
    background: var(--gradient-primary);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* === 玻璃卡片通用 === */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    transition: all 0.3s var(--ease-elastic);
}

/* === 按钮 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    height: 34px;
    padding: 0 var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s var(--ease-elastic);
    white-space: nowrap;
    outline: none;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary);
    border-color: var(--primary-light);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--color-danger);
    color: #fff;
}

.btn-sm {
    height: 28px;
    padding: 0 var(--space-md);
    font-size: 12px;
}

/* === 工具栏 === */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* 筛选项 */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    height: 32px;
    padding: 0 var(--space-md);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
}

.filter-chip:hover,
.filter-chip.active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}

/* === 状态标签 === */
.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.status-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-tag.success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-success);
}

.status-tag.warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--color-warning);
}

.status-tag.danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-danger);
}

/* === 平台标签 === */
.platform-tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

/* === 卡片日期小标签（与状态徽章并排显示） === */
.date-badge {
    position: static;
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    padding: 2px var(--space-xs);
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

/* === 空状态 === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl) 0;
    color: var(--text-tertiary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-md);
    opacity: 0.4;
}

.empty-state .empty-text {
    font-size: 14px;
}

.empty-state .empty-hint {
    font-size: 12px;
    margin-top: var(--space-xs);
}

/* === Modal 弹窗 === */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s var(--ease-smooth);
}

.modal-mask.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(31, 38, 135, 0.3);
    width: 480px;
    max-width: 92vw;
    max-height: 86vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.35s var(--ease-elastic);
}

.modal-mask.show .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

.modal-body {
    padding: var(--space-xl);
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border-light);
}

/* === 表单 === */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-label .required {
    color: var(--color-danger);
    margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    height: 38px;
    padding: 0 var(--space-md);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all 0.25s var(--ease-smooth);
}

.form-textarea {
    height: auto;
    min-height: 80px;
    padding: var(--space-sm) var(--space-md);
    resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-tertiary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

/* === Toast 提示 === */
.toast-container {
    position: fixed;
    top: var(--space-xl);
    right: var(--space-xl);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 240px;
    max-width: 360px;
    padding: var(--space-md) var(--space-lg);
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--glass-shadow);
    font-size: 13px;
    transform: translateX(120%);
    animation: toastIn 0.4s var(--ease-elastic) forwards;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error   { border-left: 3px solid var(--color-danger); }
.toast.warning { border-left: 3px solid var(--color-warning); }
.toast.info    { border-left: 3px solid var(--color-info); }

@keyframes toastIn {
    to { transform: translateX(0); }
}

.toast.fade-out {
    animation: toastOut 0.3s var(--ease-smooth) forwards;
}

@keyframes toastOut {
    to { transform: translateX(120%); opacity: 0; }
}

/* === 入场动画 === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 响应式：小屏适配 */
@media (max-width: 768px) {
    .app {
        grid-template-columns: 0 1fr;
    }
    .app-logo,
    .app-sidebar {
        display: none;
    }
    .header-search {
        width: 140px;
    }
}
