/**
 * 后台管理系统样式
 */

:root {
    --admin-primary: #6366f1;
    --admin-secondary: #8b5cf6;
    --admin-success: #10b981;
    --admin-danger: #ef4444;
    --admin-warning: #f59e0b;
    --admin-info: #3b82f6;
    --admin-dark: #1f2937;
    --admin-light: #f9fafb;
    --admin-border: #e5e7eb;
    --sidebar-width: 260px;
    --header-height: 70px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--admin-light);
    color: #374151;
}

/* ==================== 登录页面 ==================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    padding: 3rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 4rem;
    color: var(--admin-primary);
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.75rem;
    color: var(--admin-dark);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #6b7280;
}

.login-form {
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group label i {
    margin-right: 0.5rem;
    color: var(--admin-primary);
}

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

.form-control:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control.error {
    border-color: var(--admin-danger);
}

.error-message {
    color: var(--admin-danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--admin-primary);
    color: var(--admin-primary);
}

.btn-outline:hover {
    background: var(--admin-primary);
    color: white;
}

.btn-success {
    background: var(--admin-success);
    color: white;
}

.btn-danger {
    background: var(--admin-danger);
    color: white;
}

.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.alert i {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

/* ==================== 后台布局 ==================== */
.admin-page {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--admin-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s;
    z-index: 1000;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-nav a i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-section {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
}

.sidebar-footer .btn {
    flex: 1;
    text-align: center;
    margin: 0 !important;
}

/* 侧边栏收起状态 */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-header h2 {
    font-size: 0;
}

.sidebar.collapsed .sidebar-header h2 i {
    font-size: 1.5rem;
}

.sidebar.collapsed .sidebar-nav span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 1rem;
}

.sidebar.collapsed .sidebar-nav a i {
    margin-right: 0;
    font-size: 1.2rem;
}

.main-content.expanded {
    margin-left: 70px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: all 0.3s;
}

/* 头部 */
.admin-header {
    height: var(--header-height);
    background: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--admin-dark);
    cursor: pointer;
    padding: 0.5rem;
}

.header-title {
    font-size: 1.25rem;
    color: var(--admin-dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
}

.header-user {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.user-info:hover {
    background: var(--admin-light);
}

.user-info i {
    font-size: 1.5rem;
    color: var(--admin-primary);
}

.user-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    min-width: 180px;
    overflow: hidden;
}

.user-menu.active {
    display: block;
}

.user-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    color: var(--admin-dark);
    text-decoration: none;
    transition: all 0.3s;
}

.user-menu a:hover {
    background: var(--admin-light);
}

/* 内容包装器 */
.content-wrapper {
    padding: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    color: var(--admin-dark);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: #6b7280;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.stat-info h3 {
    font-size: 2rem;
    color: var(--admin-dark);
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: #6b7280;
    font-size: 0.875rem;
}

/* 快捷操作 */
.quick-actions,
.system-info {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.quick-actions h2,
.system-info h2 {
    font-size: 1.5rem;
    color: var(--admin-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

@media (max-width: 1400px) {
    .actions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1100px) {
    .actions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.action-card {
    background: white;
    border: 2px solid var(--admin-border);
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: center;
    text-decoration: none;
    color: var(--admin-dark);
    transition: all 0.3s;
}

.action-card:hover {
    border-color: var(--admin-primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.action-card i {
    font-size: 2.5rem;
    color: var(--admin-primary);
    margin-bottom: 1rem;
}

.action-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.action-card p {
    font-size: 0.875rem;
    color: #6b7280;
}

/* 系统信息 */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.info-item {
    padding: 1rem;
    background: var(--admin-light);
    border-radius: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-item strong {
    color: var(--admin-dark);
}

.info-item span {
    color: #6b7280;
}

/* 卡片 */
.card {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--admin-border);
}

.card-header h2 {
    font-size: 1.5rem;
    color: var(--admin-dark);
}

/* 表格 */
.table-responsive {
    overflow-x: auto;
}

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

table th,
table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--admin-border);
}

table th {
    background: var(--admin-light);
    font-weight: 600;
    color: var(--admin-dark);
}

table tr:hover {
    background: var(--admin-light);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.table-actions a,
.table-actions button {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-edit {
    background: var(--admin-info);
    color: white;
}

.btn-delete {
    background: var(--admin-danger);
    color: white;
}

/* 表单样式 */
.admin-form {
    padding: 1rem 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    color: var(--admin-dark);
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--admin-border);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--admin-border);
    display: flex;
    gap: 1rem;
}

select.form-control {
    cursor: pointer;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: -300px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: right 0.3s;
    z-index: 9999;
}

.notification.show {
    right: 20px;
}

.notification-success {
    border-left: 4px solid var(--admin-success);
}

.notification-success i {
    color: var(--admin-success);
}

.notification-error {
    border-left: 4px solid var(--admin-danger);
}

.notification-error i {
    color: var(--admin-danger);
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    /* 侧边栏打开时的遮罩层 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.expanded {
        margin-left: 0;
    }
    
    .stats-grid,
    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-header {
        padding: 0 1rem;
    }
    
    .header-left {
        gap: 0.75rem;
    }
    
    .sidebar-toggle {
        font-size: 1.25rem;
        padding: 0.25rem;
    }
    
    .header-title {
        display: none;
    }
    
    .header-right {
        gap: 1rem;
    }
    
    .header-time {
        font-size: 0.8rem;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
}
