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

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

/* ========== 登录页 ========== */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.login-card h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 22px;
}

.login-desc {
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-bottom: 28px;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    margin-top: 8px;
}

/* ========== 管理后台 ========== */

.admin-header {
    background: #fff;
    padding: 16px 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.admin-container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 24px;
}

.admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: #fff;
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.nav-btn {
    padding: 10px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-btn:hover {
    background: #f0fcfb;
    color: #00b4aa;
}

.nav-btn.active {
    background: #00b4aa;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 180, 170, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.section-header h2 {
    font-size: 18px;
    color: #2c3e50;
    font-weight: 600;
}

.admin-table {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.admin-table th {
    background: #fafbfc;
    font-weight: 600;
    color: #2c3e50;
    font-size: 13px;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: #f8fffe;
}

.admin-table a {
    color: #00b4aa;
    text-decoration: none;
    transition: color 0.2s;
}

.admin-table a:hover {
    color: #009e96;
    text-decoration: underline;
}

.actions {
    display: flex;
    gap: 8px;
    white-space: nowrap;
}

.btn {
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.25s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #00b4aa;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 180, 170, 0.25);
}

.btn-primary:hover {
    background: #009e96;
    box-shadow: 0 4px 12px rgba(0, 180, 170, 0.35);
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

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

.btn-danger {
    background: #fff;
    color: #e74c3c;
    border: 1px solid #fce4e4;
}

.btn-danger:hover {
    background: #fef2f2;
    border-color: #e74c3c;
}

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

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ddd;
    border-radius: 24px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-slider {
    background: #00b4aa;
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-large {
    max-width: 720px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
    font-size: 17px;
    color: #2c3e50;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #333;
}

#friendForm, #blogForm {
    padding: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #00b4aa;
    box-shadow: 0 0 0 3px rgba(0, 180, 170, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-container {
        padding: 0 16px;
        margin: 16px auto;
    }

    .admin-table {
        display: block;
        overflow-x: auto;
    }

    .admin-nav {
        flex-wrap: wrap;
        gap: 4px;
        padding: 6px;
    }

    .nav-btn {
        flex: 1;
        text-align: center;
        min-width: 80px;
        padding: 8px 12px;
        font-size: 13px;
    }

    .section-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

/* ========== Toast ========== */

.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: #00b4aa;
}

.toast-error {
    background: #e74c3c;
}

/* ========== Confirm Modal ========== */

.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s;
}

.confirm-overlay.show {
    opacity: 1;
}

.confirm-box {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: modalIn 0.3s ease;
}

.confirm-box p {
    font-size: 15px;
    color: #333;
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-actions .btn {
    min-width: 80px;
}
