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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.header-logo .logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
}

.header h1 {
    font-size: 2.5em;
    margin: 0;
    font-weight: 700;
}

.search-box {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    gap: 10px;
}

.search-box input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.search-box button {
    padding: 12px 30px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.search-box button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.admin-entry {
    text-align: right;
    padding: 15px 30px;
    border-bottom: 1px solid #eee;
}

.admin-entry a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.admin-entry a:hover {
    color: #764ba2;
}

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

.search-results {
    padding: 30px;
}

.search-results.hidden {
    display: none;
}

.search-title {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: #333;
}

/* 分类部分 */
.category-section {
    margin-bottom: 40px;
}

.category-title {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
}

.empty-category {
    color: #999;
    font-style: italic;
    padding: 20px;
}

/* 网址卡片网格 */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.site-card {
    display: block;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
    cursor: pointer;
}

.site-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.site-name {
    font-size: 1.2em;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
}

.site-desc {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.site-url {
    color: #999;
    font-size: 0.85em;
    word-break: break-all;
}

.site-category {
    display: block;
    margin-top: 10px;
    font-size: 0.85em;
    color: #667eea;
    font-weight: 500;
}

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

/* 底部 */
.footer {
    background: #f5f5f5;
    text-align: center;
    padding: 20px;
    color: #666;
    border-top: 1px solid #eee;
}

.footer a {
    color: #666;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: none;
}

/* 按钮样式 */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #ff6b6b;
    color: white;
}

.btn-danger:hover {
    background: #ff5252;
}

.btn-success {
    background: #4ecdc4;
    color: white;
}

.btn-success:hover {
    background: #45b7af;
}

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

/* 登录页面 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2em;
}

.login-container .error {
    color: #ff6b6b;
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    background: #ffebeb;
    border-radius: 8px;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-container button {
    width: 100%;
    padding: 14px;
}

.back-link {
    text-align: center;
    margin-top: 20px;
}

.back-link a {
    color: #667eea;
    text-decoration: none;
}

/* 后台布局 */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f5f5f5;
}

.admin-sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    left: 0;
    top: 0;
}

.admin-sidebar h2 {
    padding: 20px;
    font-size: 1.3em;
    border-bottom: 1px solid #34495e;
}

.admin-sidebar nav {
    flex: 1;
    padding: 20px 0;
}

.nav-btn {
    width: 100%;
    padding: 15px 20px;
    background: none;
    border: none;
    color: #bdc3c7;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover,
.nav-btn.active {
    background: #34495e;
    color: white;
    border-left: 4px solid #667eea;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #34495e;
}

.sidebar-footer a {
    display: block;
    color: #bdc3c7;
    text-decoration: none;
    padding: 10px 0;
    transition: color 0.3s;
}

.sidebar-footer a:hover {
    color: white;
}

.admin-main {
    flex: 1;
    margin-left: 250px;
    padding: 30px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-header h2 {
    color: #2c3e50;
    font-size: 1.8em;
}

/* 表格样式 */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

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

table th,
table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
    font-weight: 600;
}

table tr:hover {
    background: #f8f9fa;
}

table td a {
    color: #667eea;
    text-decoration: none;
}

table td a:hover {
    text-decoration: underline;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

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

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

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

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

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    animation: toastSlideIn 0.3s ease;
}

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

.toast.success {
    background: #4ecdc4;
}

.toast.error {
    background: #ff6b6b;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .search-box {
        flex-direction: column;
    }

    .sites-grid {
        grid-template-columns: 1fr;
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .admin-main {
        margin-left: 0;
    }

    .modal-content {
        margin: 20px;
    }
}
