/* 管理后台样式 */

/* 布局 */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #0f0f0f;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: #1a1a1a;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #333;
}

.sidebar-header h1 {
    font-size: 20px;
    margin: 0;
    color: #fff;
}

.sidebar-header span {
    font-size: 12px;
    color: #888;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #aaa;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border-left: 3px solid #3b82f6;
}

.nav-icon {
    font-size: 18px;
    margin-right: 12px;
}

.nav-text {
    flex: 1;
}

.badge {
    background: #ef4444;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.badge.hidden {
    display: none;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #333;
}

.back-link {
    color: #888;
    text-decoration: none;
    font-size: 14px;
}

.back-link:hover {
    color: #fff;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
}

.topbar h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#admin-name {
    color: #aaa;
}

.btn-logout {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #555;
    color: #aaa;
    border-radius: 4px;
    cursor: pointer;
}

.btn-logout:hover {
    background: #333;
    color: #fff;
}

.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* 页面切换 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
}

.stat-card.highlight {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 8px;
}

.stat-card.highlight .stat-value {
    color: #f59e0b;
}

.stat-label {
    color: #888;
    font-size: 14px;
}

/* 工具栏 */
.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.filter-group {
    display: flex;
    gap: 12px;
}

.filter-group select {
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    border-radius: 4px;
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.batch-actions.hidden {
    display: none;
}

#selected-count {
    color: #888;
    font-size: 14px;
}

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-success {
    background: #22c55e;
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* 图片网格 */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.image-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.image-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.image-card.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.image-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.image-card-info {
    padding: 10px;
    overflow: hidden;
}

.image-card-info .username {
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
    /* 文本截断 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-card-info .status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.status.pending {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.status.approved {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.status.rejected {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.image-card .checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.5);
    border: 2px solid #fff;
    border-radius: 4px;
    cursor: pointer;
}

.image-card .checkbox.checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

.image-card .checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 数据表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.data-table th {
    background: #222;
    color: #888;
    font-weight: 500;
    font-size: 13px;
}

.data-table td {
    color: #fff;
    font-size: 14px;
}

.data-table .code {
    font-family: monospace;
    background: #222;
    padding: 4px 8px;
    border-radius: 4px;
}

.data-table .status-unused {
    color: #22c55e;
}

.data-table .status-used {
    color: #888;
}

.data-table .btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1a1a1a;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 24px;
    color: #888;
    cursor: pointer;
}

.modal-close:hover {
    color: #fff;
}

#modal-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    background: #000;
}

.modal-info {
    padding: 16px;
    border-bottom: 1px solid #333;
}

.modal-info p {
    margin: 8px 0;
    color: #aaa;
}

.modal-info strong {
    color: #fff;
}

.modal-actions {
    padding: 16px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:hover {
    background: #333;
}

.pagination button.active {
    background: #3b82f6;
    border-color: #3b82f6;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 加载中 */
.loading {
    text-align: center;
    color: #888;
    padding: 40px;
}

/* 汉堡菜单按钮（窄屏） */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    width: 36px;
    height: 36px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 8px;
}

.sidebar-toggle span {
    width: 18px;
    height: 2px;
    background: #ccc;
    border-radius: 1px;
    transition: all 0.3s;
}

.sidebar-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.sidebar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.sidebar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0; /* 使用 top/bottom 代替 height: 100vh */
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 5px 0 20px rgba(0,0,0,0.5);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    /* 移动端 sidebar-footer 额外底部空间 */
    .sidebar-footer {
        padding-bottom: 80px !important; /* 为浏览器工具栏留空间 */
    }
    
    .admin-layout {
        flex-direction: column;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .topbar {
        padding-left: 60px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 遮罩层 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}
