/* ==================== Reset & Base ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --c-primary: #1a56db;
    --c-primary-dark: #1e40af;
    --c-primary-light: #3b82f6;
    --c-bg: #f0f4f8;
    --c-surface: #ffffff;
    --c-text: #111827;
    --c-text-light: #4b5563;
    --c-text-lighter: #6b7280;
    --c-border: #e5e7eb;
    --c-border-dark: #d1d5db;
    --c-success: #10b981;
    --c-error: #dc2626;
    --c-warning: #f59e0b;
    --c-sidebar: #0f172a;
    --c-sidebar-hover: #1e293b;
    --c-sidebar-active: #1a56db;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --sidebar-w: 240px;
    --header-h: 56px;
}

body {
    font-family: 'Source Han Sans CN', 'Microsoft YaHei', 'PingFang SC', -apple-system, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.6;
    font-size: 14px;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; }
input, textarea, select { font-family: inherit; }

/* ==================== Login ==================== */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #1a56db 100%);
    z-index: 100;
}

.login-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 48px 40px;
    width: 400px;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 32px;
}

.login-form {
    text-align: left;
}

.login-field {
    margin-bottom: 20px;
}

.login-field label {
    display: block;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.login-field input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.login-field input:focus {
    border-color: var(--c-primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.login-btn {
    width: 100%;
    padding: 13px;
    background: var(--c-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
}

.login-btn:hover {
    background: var(--c-primary-dark);
}

.login-btn:active {
    transform: scale(0.98);
}

.login-hint {
    margin-top: 12px;
    font-size: 13px;
    color: #fca5a5;
    min-height: 1em;
}

.login-default-hint {
    margin-top: 24px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
}

/* ==================== Admin Layout ==================== */
.admin-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    height: var(--header-h);
    background: var(--c-sidebar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-md);
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-header-logo {
    height: 32px;
    width: auto;
    filter: brightness(0) invert(1);
    border-radius: 3px;
}

.admin-header-title {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-header-link {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.admin-header-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.admin-logout:hover {
    color: #fca5a5;
    background: rgba(220, 38, 38, 0.15);
}

.admin-body {
    display: flex;
    flex: 1;
}

/* ==================== Sidebar ==================== */
.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--c-sidebar);
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    flex-shrink: 0;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    background: var(--c-sidebar-hover);
    color: #fff;
}

.sidebar-item.active {
    background: var(--c-sidebar-hover);
    color: #fff;
    border-left-color: var(--c-primary-light);
    font-weight: 500;
}

.sidebar-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* ==================== Content Area ==================== */
.admin-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    max-width: calc(100vw - var(--sidebar-w));
}

.admin-page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 8px;
}

.admin-page-desc {
    font-size: 14px;
    color: var(--c-text-lighter);
    margin-bottom: 24px;
}

/* ==================== Forms ==================== */
.admin-card {
    background: var(--c-surface);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--c-border);
}

.admin-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--c-border);
}

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

.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text);
    margin-bottom: 6px;
}

.form-field .field-hint {
    font-size: 12px;
    color: var(--c-text-lighter);
    margin-top: 4px;
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="number"],
.form-field input[type="url"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field input[type="date"],
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--c-border-dark);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--c-text);
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.form-field textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.form-field input[type="text"]:read-only,
.form-field input[type="text"]:disabled {
    background: var(--c-bg);
    color: var(--c-text-lighter);
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--c-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--c-primary-dark);
}

.btn-secondary {
    background: var(--c-bg);
    color: var(--c-text);
    border: 1px solid var(--c-border-dark);
}

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

.btn-danger {
    background: #fef2f2;
    color: var(--c-error);
    border: 1px solid #fecaca;
}

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

.btn-success {
    background: var(--c-success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
}

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

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ==================== News List ==================== */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-list-item {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.2s;
}

.news-list-item:hover {
    box-shadow: var(--shadow-md);
}

.news-item-info {
    flex: 1;
    min-width: 0;
}

.news-item-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-item-meta {
    font-size: 13px;
    color: var(--c-text-lighter);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.news-item-cat {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(26, 86, 219, 0.08);
    color: var(--c-primary);
    border-radius: 4px;
    font-size: 12px;
}

.news-item-featured {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(245, 158, 11, 0.1);
    color: var(--c-warning);
    border-radius: 4px;
    font-size: 12px;
}

.news-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.news-item-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--c-text-lighter);
    font-size: 15px;
}

/* ==================== Feature List ==================== */
.feature-list-item {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
}

.feature-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.feature-list-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text);
}

.feature-list-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.feature-tags-editor {
    margin-top: 12px;
}

.tag-editor {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--c-border-dark);
    border-radius: var(--radius-sm);
    min-height: 42px;
    background: #fff;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(26, 86, 219, 0.08);
    color: var(--c-primary);
    border-radius: 100px;
    font-size: 13px;
}

.tag-remove {
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.tag-remove:hover {
    opacity: 1;
}

.tag-add-input {
    border: none;
    outline: none;
    font-size: 13px;
    min-width: 100px;
    background: transparent;
}

/* ==================== Stats Editor ==================== */
.stats-editor {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.stat-edit-card {
    background: var(--c-bg);
    border-radius: var(--radius-sm);
    padding: 12px;
    position: relative;
}

.stat-edit-card .stat-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--c-error);
    font-size: 14px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.stat-edit-card .stat-remove:hover {
    opacity: 1;
}

/* ==================== Dashboard ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-stat {
    background: var(--c-surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--c-border);
}

.dashboard-stat-num {
    font-size: 32px;
    font-weight: 700;
    color: var(--c-primary);
}

.dashboard-stat-label {
    font-size: 13px;
    color: var(--c-text-lighter);
    margin-top: 4px;
}

.dashboard-quick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.dashboard-quick-item {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.dashboard-quick-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--c-primary-light);
}

.dashboard-quick-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(26, 86, 219, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--c-primary);
    flex-shrink: 0;
}

.dashboard-quick-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--c-text);
}

/* ==================== Save Bar ==================== */
.admin-save-bar {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--c-sidebar);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    animation: slideUp 0.3s ease;
}

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

.save-bar-text {
    font-size: 14px;
}

.save-btn {
    background: var(--c-primary);
    color: #fff;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}

.save-btn:hover {
    background: var(--c-primary-dark);
}

.discard-btn {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.discard-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* ==================== Toast ==================== */
.admin-toast {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-item {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: #fff;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    min-width: 200px;
}

@keyframes toastIn {
    from { transform: translateX(40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-success { background: var(--c-success); }
.toast-error { background: var(--c-error); }
.toast-warning { background: var(--c-warning); }
.toast-info { background: var(--c-primary); }

/* ==================== Misc ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--c-text-lighter);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.section-divider {
    height: 1px;
    background: var(--c-border);
    margin: 24px 0;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-blue { background: rgba(26, 86, 219, 0.1); color: var(--c-primary); }
.badge-green { background: rgba(16, 185, 129, 0.1); color: var(--c-success); }
.badge-orange { background: rgba(245, 158, 11, 0.1); color: var(--c-warning); }
.badge-gray { background: var(--c-bg); color: var(--c-text-lighter); }

.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
}

.import-zone {
    border: 2px dashed var(--c-border-dark);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.import-zone:hover,
.import-zone.dragover {
    border-color: var(--c-primary);
    background: rgba(26, 86, 219, 0.03);
}

.import-zone-icon {
    font-size: 36px;
    color: var(--c-text-lighter);
    margin-bottom: 12px;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: -240px;
        z-index: 60;
        transition: left 0.3s;
    }

    .admin-sidebar.open {
        left: 0;
    }

    .admin-content {
        padding: 20px 16px;
        max-width: 100vw;
    }

    .form-row-2,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .feature-list-body {
        grid-template-columns: 1fr;
    }

    .news-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-save-bar {
        left: 16px;
        right: 16px;
        justify-content: center;
    }
}
