/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ef1c47;
    --secondary-color: #ffffff;
    --dark-color: #333;
    --gray-color: #666;
    --light-gray: #f5f5f5;
    --border-radius: 8px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* SVG 图标通用样式 */
svg {
    transition: all 0.3s ease;
    display: inline-block;
    flex-shrink: 0;
}

/* 按钮和表单元素内图标对齐 */
.btn-action, .filter-btn, button:not(.btn) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.btn svg, .btn-action svg, .filter-btn svg, button svg {
    flex-shrink: 0;
}

/* 徽章内图标对齐 */
.badge svg {
    flex-shrink: 0;
}

/* 状态标签图标对齐 */
.status-paid, .status-pending {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 侧边栏菜单图标 */
.sidebar-menu-link {
    display: flex;
    align-items: center;
}

.sidebar-menu-link svg {
    transition: transform 0.3s ease;
}

.sidebar-menu-link:hover svg {
    transform: scale(1.1);
}

/* 快捷链接卡片 */
.quick-link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.quick-link-card:hover svg {
    transform: scale(1.1);
    stroke: #ef1c47;
}

/* 统计卡片 */
.stat-card:hover svg {
    transform: scale(1.05);
}

/* 页面标题图标 */
.admin-page-title, .editor-title, .hero-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* 权限提示图标 */
.permission-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 表单选择框对齐 */
.form-select {
    display: flex;
    align-items: center;
    /* 移除默认箭头 */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none;
    padding-right: 1rem;
}

/* 表格内容对齐 */
table td {
    vertical-align: middle;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* 确保h4标题内的SVG对齐 */
h4 {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 设置章节标题对齐 */
.settings-section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* 容器 */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* 导航栏 - 专业版 */
.navbar {
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #f0f0f0;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 40px;
    max-width: none;
    gap: 30px;
    min-height: 60px;
}

.navbar-brand {
    display: flex;
    align-items: center;
}

.navbar-brand .logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.navbar-brand .logo:hover {
    opacity: 0.8;
}

.logo-icon {
    color: #ef1c47;
    flex-shrink: 0;
}

.logo-text {
    letter-spacing: -0.02em;
}

/* 导航分类菜单 - 使用 .navbar 作用域保护 */
.navbar .navbar-categories {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.navbar .nav-category-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.navbar .nav-category-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    color: #666;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.navbar .nav-category-link:hover {
    background: #f8f8f8;
    color: #ef1c47;
}

.navbar .nav-category-link.active {
    background: #fff5f7;
    color: #ef1c47;
}

.navbar .nav-category-link svg {
    flex-shrink: 0;
}

/* 汉堡菜单按钮 - 默认隐藏 */
.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    transition: all 0.3s ease;
}

.navbar-toggle-icon {
    width: 100%;
    height: 3px;
    background: #ef1c47;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* 汉堡菜单激活状态 - X形 */
.navbar-toggle.active .navbar-toggle-icon:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

.navbar-toggle.active .navbar-toggle-icon:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active .navbar-toggle-icon:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* 导航折叠容器 */
.navbar-collapse {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 30px;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.user-info {
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: transparent;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.user-info:hover {
    background: #f8f9fa;
}

.user-name {
    font-weight: 500;
    color: #333;
}

.user-balance {
    font-weight: 600;
    color: #ef1c47;
    padding: 2px 8px;
    background: rgba(239, 28, 71, 0.1);
    border-radius: 4px;
    font-size: 0.85rem;
}

/* 导航按钮 */
.btn-nav-outline,
.btn-nav-primary {
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-nav-outline {
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
}

.btn-nav-outline:hover {
    border-color: #ef1c47;
    color: #ef1c47;
    background: #fff5f7;
}

.btn-nav-primary {
    border: 2px solid #ef1c47;
    background: #ef1c47;
    color: white;
}

.btn-nav-primary:hover {
    background: #d11839;
    border-color: #d11839;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 按钮 */
.btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--secondary-color);
}

.btn-primary:hover {
    background: #d11839;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-outline {
    background: #ef1c47;
    color: #ffffff;
    border: 2px solid #ef1c47;
}

.btn-outline:hover {
    background: #d91939;
    color: #ffffff;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-block {
    width: 100%;
    text-align: center;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* 徽章 - SVG图标样式 */
.role-badge-img,
.template-badge-img,
.plan-badge-img,
.type-badge-img {
    display: inline-block;
    vertical-align: middle;
    height: 24px;
    transition: all 0.3s ease;
}

.role-badge-img:hover,
.template-badge-img:hover,
.plan-badge-img:hover,
.type-badge-img:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* 保留旧的徽章样式作为备用 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-normal {
    background: #6c757d;
    color: white;
}

.badge-vip {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-svip {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.badge-free {
    background: #28a745;
    color: white;
}

.badge-webmb {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.badge-wapmb {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

/* Flash 消息 */
.flash-messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    max-width: 400px;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
}

.close-btn:hover {
    opacity: 1;
}

/* 主内容 */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* 卡片 */
.card {
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.card-header {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

/* 表单 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #ddd;
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

/* 页脚 - 专业版 */
.footer {
    background: #1a1a2e;
    padding: 50px 0 0;
    color: rgba(255, 255, 255, 0.6);
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-main {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr;
    gap: 50px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-section {
    display: flex;
    flex-direction: column;
}

.footer-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 20px 0;
    letter-spacing: 0.5px;
}

.footer-desc {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0 0 10px 0;
}

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-contact a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    padding: 8px 0;
}

.footer-contact a:hover {
    color: #ffffff;
    transform: translateX(5px);
}

.footer-contact a svg {
    flex-shrink: 0;
}

.footer-qrcode-section {
    align-items: center;
    text-align: center;
}

.footer-qrcode-wrapper {
    width: 140px;
    height: 140px;
    background: white;
    padding: 10px;
}

.footer-qrcode-wrapper img {
    width: 100%;
    height: 100%;
    display: block;
}

.footer-bottom {
    padding: 25px 0;
    text-align: center;
}

.footer-bottom p {
    margin: 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

/* 网格布局 */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* 移动端遮罩层 */
.navbar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.navbar-backdrop.show {
    display: block;
    opacity: 1;
}

/* 响应式 - 大屏幕（确保汉堡按钮隐藏） */
@media (min-width: 769px) {
    .navbar-toggle {
        display: none !important;
    }
}

/* 响应式 - 小屏幕 */
@media (max-width: 768px) {
    .navbar-container {
        flex-wrap: nowrap;
        padding: 10px 15px;
        min-height: 56px;
    }
    
    /* 导航品牌区域 - 显示Logo和汉堡按钮 */
    .navbar-brand {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    /* 显示汉堡菜单按钮 */
    .navbar-toggle {
        display: flex;
    }
    
    /* 导航折叠容器 - 侧边栏样式 */
    .navbar-collapse {
        position: fixed;
        top: 0;
        right: -320px;
        width: 280px;
        height: 100vh;
        background: #ffffff;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
        z-index: 999;
        overflow-y: auto;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 20px;
    }
    
    /* 侧边栏滚动条样式 */
    .navbar-collapse::-webkit-scrollbar {
        width: 6px;
    }
    
    .navbar-collapse::-webkit-scrollbar-track {
        background: #f5f5f5;
    }
    
    .navbar-collapse::-webkit-scrollbar-thumb {
        background: #ef1c47;
        border-radius: 3px;
    }
    
    .navbar-collapse::-webkit-scrollbar-thumb:hover {
        background: #d11839;
    }
    
    /* 展开状态 */
    .navbar-collapse.show {
        right: 0;
    }
    
    /* 阻止页面滚动 */
    body.menu-open {
        overflow: hidden;
    }
    
    /* 侧边栏标题 */
    .navbar-collapse::before {
        content: '菜单';
        font-size: 1.2rem;
        font-weight: 600;
        color: #ef1c47;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 2px solid #f0f0f0;
    }
    
    .navbar .navbar-categories {
        width: 100%;
        order: 1;
        margin-bottom: 20px;
    }
    
    .navbar .nav-category-menu {
        width: 100%;
        flex-direction: column;
        gap: 0;
    }
    
    .navbar .nav-category-link {
        width: 100%;
        padding: 12px 16px;
        font-size: 0.9rem;
        border-radius: 6px;
        margin-bottom: 6px;
        justify-content: flex-start;
    }
    
    .navbar .nav-category-link:hover {
        background: #fff5f7;
    }
    
    .navbar .nav-category-link.active {
        background: #fff5f7;
        font-weight: 600;
    }
    
    .navbar .nav-category-link svg {
        flex-shrink: 0;
    }

    .navbar-menu {
        flex-direction: column;
        width: 100%;
        order: 2;
        gap: 10px;
        padding-top: 15px;
        border-top: 2px solid #f0f0f0;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .logo-icon {
        width: 24px;
        height: 24px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
    
    .user-info {
        width: 100%;
        justify-content: center;
        font-size: 0.85rem;
        padding: 8px 12px;
        background: #f8f9fa;
        border-radius: 6px;
    }
    
    .user-name {
        display: inline;
    }
    
    .btn-nav-outline,
    .btn-nav-primary {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .btn-nav-outline svg,
    .btn-nav-primary svg {
        width: 16px;
        height: 16px;
    }

    .btn {
        font-size: 0.9rem;
        padding: 10px 16px;
    }

    .flash-messages {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    /* 页脚响应式 */
    .footer {
        padding: 40px 0 0;
    }
    
    .footer-main {
        grid-template-columns: 1fr;
        gap: 35px;
        padding-bottom: 30px;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-title {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .footer-desc {
        font-size: 0.85rem;
    }
    
    .footer-contact {
        align-items: center;
        gap: 10px;
    }
    
    .footer-contact a {
        font-size: 0.85rem;
        padding: 6px 0;
    }
    
    .footer-contact a:hover {
        transform: translateX(0);
    }
    
    .footer-qrcode-wrapper {
        width: 120px;
        height: 120px;
    }
    
    .footer-bottom {
        padding: 20px 0;
    }
    
    .footer-bottom p {
        font-size: 0.8rem;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(239, 28, 71, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 文本对齐 */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

/* 间距 */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
