/* 管理后台样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 头部样式 */
header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 20px;
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    color: #5a67d8;
    font-size: 1.8rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    background: linear-gradient(135deg, #e53e3e, #c53030);
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.secondary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* 主要内容区域 */
main {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 30px;
    margin-bottom: 30px;
}

section {
    margin-bottom: 40px;
}

h2 {
    color: #5a67d8;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #edf2f7;
    display: flex;
    align-items: center;
    gap: 10px;
}

#website-count, #category-count {
    background: #5a67d8;
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* 表单样式 */
.add-website {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

input, textarea, select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #5a67d8;
    box-shadow: 0 0 0 3px rgba(90, 103, 216, 0.2);
}

button {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.category-actions {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

small {
    display: block;
    color: #718096;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* 分类管理样式 */
.category-management {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.category-stats {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.category-stats p {
    font-size: 1.1rem;
    color: #2d3748;
    margin: 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.category-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-top: 3px solid #059669;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.category-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
}

.category-count {
    font-size: 0.9rem;
    color: #718096;
    margin: 0;
}

.no-categories {
    text-align: center;
    padding: 30px;
    color: #718096;
    font-style: italic;
}

/* 分类管理模态框 */
.add-category {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.add-category h3, .categories-list h3 {
    color: #2d3748;
    margin-bottom: 15px;
}

.category-management-list {
    max-height: 400px;
    overflow-y: auto;
}

.category-sort-instructions {
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f4f8;
    border-radius: 8px;
    text-align: center;
}

.category-sort-instructions p {
    margin-bottom: 15px;
    color: #4a5568;
}

.category-management-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: move;
    transition: all 0.3s ease;
    position: relative;
}

.category-management-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.category-management-item.dragging {
    opacity: 0.5;
    background: #ebf4ff;
}

.category-management-item.drag-over {
    border-top: 2px solid #5a67d8;
}

.category-drag-handle {
    margin-right: 10px;
    cursor: move;
    color: #a0aec0;
}

.category-management-item .category-name {
    font-weight: 600;
    margin: 0;
    flex: 1;
    padding: 0 10px;
}

.category-actions {
    display: flex;
    gap: 10px;
    margin: 0;
}

.btn-edit-category, .btn-delete-category {
    padding: 6px 12px;
    font-size: 0.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit-category {
    background: linear-gradient(to right, #38a169, #2f855a);
    color: white;
}

.btn-delete-category {
    background: linear-gradient(to right, #e53e3e, #c53030);
    color: white;
}

.btn-edit-category:hover, .btn-delete-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 网站列表样式 */
.websites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.websites-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-controls, .search-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-controls label {
    font-weight: 600;
    color: #4a5568;
    margin: 0;
}

.search-controls input {
    width: 200px;
}

.websites-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.websites-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.websites-table thead {
    background: #f7fafc;
}

.websites-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

.websites-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.websites-table tr:hover {
    background: #f7fafc;
}

.logo-cell {
    width: 40px;
}

.website-logo {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
}

.name-cell {
    font-weight: 600;
    color: #2d3748;
}

.url-cell a {
    color: #667eea;
    text-decoration: none;
}

.url-cell a:hover {
    text-decoration: underline;
}

.category-cell {
    width: 120px;
}

.category-badge {
    background: #ebf4ff;
    color: #5a67d8;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.description-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.date-cell {
    color: #718096;
    font-size: 0.9rem;
    width: 150px;
}

.actions-cell {
    width: 120px;
}

.actions-cell .btn-edit, .actions-cell .btn-delete {
    padding: 4px 8px;
    font-size: 0.8rem;
    margin: 0 2px;
}

.loading, .no-websites {
    text-align: center;
    padding: 30px;
    color: #718096;
    font-style: italic;
}

/* 分页控件 */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
}

.pagination-info {
    color: #4a5568;
    font-size: 0.9rem;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-info {
    color: #4a5568;
    font-size: 0.9rem;
}

.pagination-btn {
    background: white;
    color: #4a5568;
    padding: 8px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #f7fafc;
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 10px;
}

.close:hover,
.close:focus {
    color: black;
}

/* 底部样式 */
footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    main {
        padding: 20px;
    }
    
    .websites-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .websites-controls {
        width: 100%;
        flex-direction: column;
    }
    
    .filter-controls, .search-controls {
        width: 100%;
    }
    
    .search-controls input {
        width: 100%;
    }
    
    .pagination-controls {
        flex-direction: column;
        text-align: center;
    }
    
    .category-management-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .category-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .websites-table {
        font-size: 0.9rem;
    }
    
    .websites-table th, .websites-table td {
        padding: 8px 10px;
    }
    
    .description-cell {
        max-width: 100px;
    }
    
    .date-cell, .category-cell {
        display: none;
    }
}