/**
 * 管理后台样式 - 现代化设计
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

/* 布局 */
.layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar .logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar .logo-text {
    font-size: 16px;
    font-weight: 600;
}

.sidebar .menu {
    padding: 16px 0;
}

.sidebar .menu-item {
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.7);
}

.sidebar .menu-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar .menu-item.active {
    background: linear-gradient(90deg, rgba(102,126,234,0.3) 0%, rgba(118,75,162,0.3) 100%);
    color: #fff;
    border-right: 3px solid #667eea;
}

.sidebar .menu-item .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* 主内容区 */
.main {
    flex: 1;
    margin-left: 220px;
    min-height: 100vh;
}

/* 顶部导航 */
.header {
    background: #fff;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 99;
}

.header .breadcrumb {
    color: #666;
    font-size: 14px;
}

.header .breadcrumb span {
    color: #999;
}

.header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* 内容区域 */
.content {
    padding: 24px;
}

/* 统计卡片 */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.stat-card .stat-icon.blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; }
.stat-card .stat-icon.green { background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%); color: #fff; }
.stat-card .stat-icon.orange { background: linear-gradient(135deg, #fa8c16 0%, #ffa940 100%); color: #fff; }
.stat-card .stat-icon.purple { background: linear-gradient(135deg, #722ed1 0%, #9254de 100%); color: #fff; }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #999;
}

/* 卡片容器 */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header .title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.card-body {
    padding: 24px;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.toolbar .search-box {
    display: flex;
    gap: 8px;
}

.toolbar .search-box input {
    padding: 8px 16px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    width: 240px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.toolbar .search-box input:focus {
    border-color: #667eea;
}

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-success {
    background: #52c41a;
    color: #fff;
}

.btn-danger {
    background: #ff4d4f;
    color: #fff;
}

.btn-warning {
    background: #faad14;
    color: #fff;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

.btn-text {
    background: none;
    color: #667eea;
    padding: 4px 8px;
}

.btn-text:hover {
    color: #764ba2;
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.table th {
    background: #fafafa;
    font-weight: 600;
    color: #666;
    font-size: 13px;
}

.table tr:hover {
    background: #fafafa;
}

.table .actions {
    display: flex;
    gap: 8px;
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.status-tag.active { background: #f6ffed; color: #52c41a; }
.status-tag.inactive { background: #fff1f0; color: #ff4d4f; }

/* 分页 */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.pagination .page-btn {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination .page-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.pagination .page-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.pagination .page-info {
    color: #666;
    font-size: 13px;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 12px;
    width: 800px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header .title {
    font-size: 16px;
    font-weight: 600;
}

.modal-header .close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group label .required {
    color: #ff4d4f;
    margin-right: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #667eea;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* 模板卡片 */
.template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.template-card {
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.template-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.template-card .template-preview {
    height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 48px;
}

.template-card .template-info {
    padding: 12px;
}

.template-card .template-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.template-card .template-desc {
    font-size: 12px;
    color: #999;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 9999;
    display: none;
    animation: slideIn 0.3s ease;
}

.toast.show {
    display: block;
}

.toast.success { border-left: 4px solid #52c41a; }
.toast.error { border-left: 4px solid #ff4d4f; }
.toast.info { border-left: 4px solid #1890ff; }

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

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

/* wangEditor 5 容器样式 */
#template-editor-wrapper,
#invitation-editor-wrapper {
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    z-index: 100;
}
#template-toolbar-container,
#invitation-toolbar-container {
    border-bottom: 1px solid #d9d9d9;
}
#template-editor-container,
#invitation-editor-container {
    height: 250px;
}
#invitation-editor-container {
    height: 300px;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar .logo-text,
    .sidebar .menu-item span {
        display: none;
    }
    .main {
        margin-left: 60px;
    }
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .template-grid {
        grid-template-columns: 1fr;
    }
}
