/* ========================================
   WELDERNEED Admin Panel - Stylesheet
   ======================================== */

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

:root {
    --primary-900: #0f172a;
    --primary-800: #1e3a5f;
    --primary-700: #2b6cb0;
    --primary-600: #3182ce;
    --primary-500: #4299e1;
    --primary-100: #ebf8ff;
    --primary-50: #f0f9ff;
    --accent-500: #f59e0b;
    --accent-400: #fbbf24;
    --success-600: #16a34a;
    --success-100: #dcfce7;
    --danger-600: #dc2626;
    --danger-100: #fee2e2;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;
    --sidebar-width: 240px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

html, body {
    height: 100%;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-900);
    background: var(--gray-50);
}

a { color: var(--primary-700); text-decoration: none; }
a:hover { color: var(--primary-600); }

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-900), var(--primary-700));
}
.login-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 400px;
    max-width: 90%;
    text-align: center;
}
.login-logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-900);
    letter-spacing: 2px;
}
.login-subtitle {
    color: var(--gray-500);
    margin-bottom: 28px;
    font-size: 0.95rem;
}
.login-form { text-align: left; }
.login-hint {
    text-align: center;
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--gray-400);
}

/* Admin Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}
.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 1.5px;
}
.sidebar-tagline {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.65);
    transition: all 0.15s;
    font-size: 0.9rem;
}
.nav-item:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}
.nav-item.active {
    color: white;
    background: rgba(255,255,255,0.08);
    border-left: 3px solid var(--accent-500);
}
.nav-icon { font-size: 0.8rem; opacity: 0.6; }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.btn-view-site {
    display: block;
    text-align: center;
    padding: 8px;
    color: rgba(255,255,255,0.5);
    font-size: 0.82rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.15s;
}
.btn-view-site:hover {
    color: white;
    border-color: rgba(255,255,255,0.2);
}
.btn-logout {
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.15s;
}
.btn-logout:hover {
    color: var(--danger-600);
    border-color: var(--danger-600);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
}

/* Page Content */
.page-content { display: none; }
.page-content.active { display: block; }

.page-title {
    font-size: 1.5rem;
    color: var(--gray-900);
    margin-bottom: 24px;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.page-header .page-title { margin-bottom: 0; }
.page-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    text-align: center;
}
.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-700);
    line-height: 1.1;
}
.stat-label {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Dashboard Sections */
.dashboard-section { margin-bottom: 28px; }
.section-title {
    font-size: 1.05rem;
    color: var(--gray-700);
    margin-bottom: 12px;
}
.category-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.cat-stat-item {
    background: white;
    padding: 14px;
    border-radius: 10px;
    border-left: 4px solid var(--primary-700);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.cat-stat-name { font-size: 0.88rem; font-weight: 600; color: var(--gray-700); }
.cat-stat-count { font-size: 1.5rem; font-weight: 700; color: var(--primary-700); margin-top: 2px; }

.recent-inquiries {
    background: white;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.filter-select, .filter-input {
    padding: 8px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.88rem;
    background: white;
}
.filter-input { flex: 1; }
.filter-select { min-width: 200px; }
.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* Data Table */
.data-table-wrap {
    background: white;
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--gray-50);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.88rem;
    vertical-align: middle;
}
.data-table tr:hover { background: var(--gray-50); }
.data-table img {
    width: 50px; height: 40px;
    object-fit: contain;
    border-radius: 6px;
}
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}
.status-active { background: var(--success-100); color: var(--success-600); }
.status-draft { background: var(--gray-200); color: var(--gray-600); }
.status-archived { background: var(--danger-100); color: var(--danger-600); }
.status-published { background: var(--success-100); color: var(--success-600); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-primary { background: var(--primary-700); color: white; }
.btn-primary:hover { background: var(--primary-600); }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}
.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: var(--font);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px var(--primary-100);
}
.form-group textarea { resize: vertical; }
.form-group.full-width { grid-column: 1 / -1; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

/* Form Sections */
.form-section {
    margin: 20px 0;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 10px;
}
.form-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.form-section-header h3 {
    font-size: 0.95rem;
    color: var(--gray-700);
}
.badge-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.badge-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 0.82rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.badge-checkbox:hover {
    border-color: var(--primary-400);
    background: var(--primary-50);
}
.badge-checkbox input {
    width: 14px; height: 14px;
    accent-color: var(--primary-600);
    cursor: pointer;
}
.badge-checkbox:has(input:checked) {
    background: var(--primary-100);
    border-color: var(--primary-500);
    color: var(--primary-800);
    font-weight: 600;
}
.badge-checkbox-custom {
    border-style: dashed;
    color: var(--primary-600);
}

.spec-row, .feature-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.spec-row select.spec-label {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    background: white;
    color: var(--gray-800);
    min-width: 140px;
}
.spec-row input.spec-value,
.spec-row input.spec-custom {
    flex: 1.2;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--font-sans);
}
.spec-row input.spec-custom {
    border-color: var(--primary-400);
    background: var(--primary-50);
}
.feature-row input { flex: 1; }
.row-remove {
    flex-shrink: 0;
    width: 32px; height: 32px;
    background: var(--danger-100);
    color: var(--danger-600);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s;
}
.row-remove:hover { background: var(--danger-600); color: white; }

/* Image Upload */
.image-upload-area {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
}
.image-preview-wrap {
    width: 160px;
    height: 160px;
    flex-shrink: 0;
    background: white;
    border: 2px dashed var(--gray-300);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.image-preview-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.image-placeholder {
    text-align: center;
    color: var(--gray-400);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.placeholder-icon {
    font-size: 40px;
    margin-bottom: 6px;
}
.placeholder-text {
    font-size: 0.78rem;
}
.image-upload-controls {
    flex: 1;
    min-width: 0;
}
.image-upload-hint {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 8px;
    margin-bottom: 12px;
    line-height: 1.5;
}
.image-path-row {
    margin-top: 8px;
}
.image-path-row label {
    display: block;
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-bottom: 4px;
    font-weight: 500;
}
.image-path-row input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: monospace;
    background: white;
}
.image-path-row input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.image-uploading {
    opacity: 0.6;
    pointer-events: none;
}
.image-uploading::after {
    content: '上传中...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}
.modal {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-large { max-width: 800px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-200);
}
.modal-header h2 { font-size: 1.15rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: var(--gray-600); }
.modal-body {
    padding: 24px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
}

/* Settings */
.settings-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.data-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.settings-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 10px;
    line-height: 1.5;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--primary-900);
    color: white;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 2000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--gray-400);
    padding: 24px;
}

/* Action buttons in table */
.table-actions { display: flex; gap: 6px; }
.action-btn {
    padding: 4px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--gray-700);
    transition: all 0.15s;
}
.action-btn:hover { border-color: var(--primary-600); color: var(--primary-600); }
.action-btn.danger:hover { border-color: var(--danger-600); color: var(--danger-600); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo, .sidebar-tagline, .nav-item span:last-child, .btn-view-site { display: none; }
    .nav-item { justify-content: center; }
    .main-content { margin-left: 60px; padding: 16px; }
    .stats-grid, .category-stats { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
