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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    min-height: 100vh;
}

/* ===== 主页 ===== */
.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    text-align: center;
    padding: 3rem 1rem 2rem;
}

.main-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #8898aa;
    font-size: 1rem;
}

.content { flex: 1; }

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.site-card {
    background: white;
    border-radius: 16px;
    padding: 1.8rem 1.5rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e6e9f0;
    user-select: none;
}

.site-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.15);
    border-color: #c5cae9;
}

.card-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #f8f9fe;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 2rem;
}

.card-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.card-desc {
    font-size: 0.875rem;
    color: #718096;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty, .error {
    text-align: center;
    color: #a0aec0;
    padding: 3rem;
    grid-column: 1 / -1;
}

.error { color: #e53e3e; }

.main-footer {
    text-align: center;
    padding: 2rem 0;
}

.footer-text {
    color: #a0aec0;
    font-size: 0.9rem;
}

/* ===== 后台管理 ===== */
.admin-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.admin-header h1 {
    font-size: 1.5rem;
    color: #2d3748;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: #667eea;
    color: white;
}
.btn-primary:hover { background: #5a6fd6; }

.btn-secondary {
    background: #edf2f7;
    color: #4a5568;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-danger {
    background: #fed7d7;
    color: #c53030;
}
.btn-danger:hover { background: #fcbbbb; }

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.toolbar {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.data-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
}

.data-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    color: #2d3748;
    font-size: 0.9rem;
}

.data-table tr:hover td {
    background: #f7fafc;
}

.site-icon-preview {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
    background: #f8f9fe;
    padding: 2px;
}

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

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal h2 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    color: #2d3748;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

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

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

.form-hint {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 0.3rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.hidden { display: none !important; }

/* ===== 响应式 ===== */
@media (max-width: 600px) {
    .main-title { font-size: 1.8rem; }
    .sites-grid { grid-template-columns: 1fr; }
    .admin-header { flex-direction: column; gap: 1rem; align-items: flex-start; }
    .data-table { font-size: 0.85rem; }
    .data-table th, .data-table td { padding: 0.75rem 0.5rem; }
}
