/* ============================================================
   数据库需求发布平台 - 样式表
   ============================================================ */

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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 20px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navigation */
.navbar { background: white; border-bottom: 1px solid var(--gray-200); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.nav-container { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; height: 60px; }
.nav-brand { font-size: 1.2rem; font-weight: 700; color: var(--gray-900) !important; text-decoration: none !important; white-space: nowrap; }
.nav-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nav-links a { padding: 6px 14px; border-radius: var(--radius); font-size: 0.9rem; color: var(--gray-700); text-decoration: none !important; transition: all 0.2s; white-space: nowrap; }
.nav-links a:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-post { background: var(--primary) !important; color: white !important; font-weight: 500; }
.btn-post:hover { background: var(--primary-dark) !important; }

/* Flash */
.flash-container { padding-top: 16px; }
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 12px; font-size: 0.95rem; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

main { flex: 1; padding: 32px 0; }

/* Page Header */
.page-header { text-align: center; padding: 32px 0; }
.page-header h1 { font-size: 2rem; color: var(--gray-900); margin-bottom: 8px; }
.page-header .subtitle { color: var(--gray-500); font-size: 1.05rem; margin-bottom: 20px; }

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 24px 0; }
.stat-card { background: white; border-radius: var(--radius); padding: 24px; text-align: center; box-shadow: var(--shadow); }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-label { color: var(--gray-500); margin-top: 4px; font-size: 0.95rem; }

/* Sort Bar */
.sort-bar {
    display: flex; align-items: center; gap: 6px;
    margin: 8px 0 16px; flex-wrap: wrap;
}
.sort-label { color: var(--gray-500); font-size: 0.88rem; margin-right: 4px; }
.sort-link {
    padding: 5px 14px; border-radius: 20px; font-size: 0.85rem;
    color: var(--gray-600); text-decoration: none !important;
    background: var(--gray-100); transition: 0.2s;
}
.sort-link:hover { background: var(--gray-200); }
.sort-link.active { background: var(--primary); color: white; }

/* Posts */
.post-list { margin-top: 24px; }
.post-card { background: white; border-radius: var(--radius); padding: 20px 24px; margin-bottom: 12px; box-shadow: var(--shadow); transition: box-shadow 0.2s, transform 0.2s; }
.post-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.post-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.post-title { font-size: 1.15rem; font-weight: 600; }
.post-title a { color: var(--gray-800); text-decoration: none !important; }
.post-title a:hover { color: var(--primary); }
.post-time { color: var(--gray-400); font-size: 0.85rem; white-space: nowrap; }
.post-countdown { font-size: 0.85rem; font-weight: 500; white-space: nowrap; margin-left: 12px; }
.detail-countdown { font-size: 0.9rem; font-weight: 500; }
.post-preview { color: var(--gray-600); font-size: 0.95rem; line-height: 1.7; }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 500; margin-right: 6px; vertical-align: middle; }
.badge-open { background: #fef3c7; color: #92400e; }
.badge-taken { background: #e0e7ff; color: #3730a3; }
.badge-expired { background: #f3f4f6; color: #9ca3af; }

/* Buttons */
.btn { display: inline-block; padding: 8px 20px; border-radius: var(--radius); font-size: 0.95rem; font-weight: 500; cursor: pointer; border: none; text-decoration: none !important; transition: all 0.2s; line-height: 1.5; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 4px 12px; font-size: 0.85rem; }
.btn-lg { padding: 12px 32px; font-size: 1.1rem; }
.btn-block { display: block; width: 100%; }

/* Forms */
.form-card { background: white; border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); max-width: 700px; margin: 0 auto; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; font-size: 0.95rem; }
.required { color: var(--danger); }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300); border-radius: var(--radius);
    font-size: 0.95rem; transition: border-color 0.2s, box-shadow 0.2s; font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.help-text { display: block; color: var(--gray-400); font-size: 0.82rem; margin-top: 4px; }
.form-section { border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.form-section legend { font-weight: 600; color: var(--gray-700); padding: 0 8px; }
.section-note { color: var(--gray-500); font-size: 0.88rem; margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* Detail */
.post-detail { max-width: 760px; margin: 0 auto; }
.breadcrumb { margin-bottom: 16px; }
.breadcrumb a { color: var(--gray-500); font-size: 0.9rem; }
.detail-card { background: white; border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.detail-header h1 { font-size: 1.5rem; margin-bottom: 8px; }
.detail-meta { display: flex; gap: 16px; color: var(--gray-500); font-size: 0.9rem; margin-bottom: 20px; flex-wrap: wrap; }
.detail-content { margin-bottom: 24px; }
.detail-content h3 { font-size: 1.1rem; margin-bottom: 12px; color: var(--gray-700); }
.content-body { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; line-height: 1.8; color: var(--gray-700); white-space: pre-wrap; }

/* Contact */
.contact-section { border-top: 1px solid var(--gray-200); padding-top: 20px; margin-top: 20px; }
.contact-section h3 { font-size: 1.1rem; margin-bottom: 12px; }
.contact-protected { text-align: center; padding: 20px; background: var(--gray-50); border-radius: var(--radius); border: 2px dashed var(--gray-200); }
.lock-icon { font-size: 2rem; margin-bottom: 8px; }
.contact-protected p { color: var(--gray-500); }
.contact-protected .small { font-size: 0.85rem; margin-top: 4px; }
.contact-info { padding: 16px; background: #fefce8; border: 1px solid #fde68a; border-radius: var(--radius); }
.contact-details { display: grid; gap: 8px; }
.contact-item { font-size: 0.95rem; }
.contact-item .label { font-weight: 600; color: var(--gray-700); }
.contact-loading { color: var(--gray-500); font-size: 0.9rem; }
.contact-error { color: var(--danger); font-size: 0.9rem; }
.contact-hint { color: var(--gray-400); font-size: 0.82rem; margin-top: 8px; }
.admin-actions { margin-top: 20px; text-align: center; }

/* Auth */
.auth-page { display: flex; justify-content: center; padding-top: 40px; }
.auth-card { background: white; border-radius: var(--radius); padding: 40px; box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; }
.auth-card h1 { text-align: center; margin-bottom: 8px; }
.auth-card .subtitle { text-align: center; color: var(--gray-500); margin-bottom: 24px; }
.back-link { text-align: center; margin-top: 20px; }

/* Admin Table */
.admin-dashboard h2 { margin: 24px 0 12px; }
.admin-table-wrapper { overflow-x: auto; background: white; border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th { background: var(--gray-50); padding: 12px 14px; text-align: left; font-weight: 600; color: var(--gray-600); border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.admin-table tr:hover { background: var(--gray-50); }
.row-taken { opacity: 0.7; }
.title-cell { font-weight: 500; }
.content-cell { color: var(--gray-500); font-size: 0.85rem; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-cell { white-space: nowrap; }
.contact-inline { margin-top: 6px; padding: 8px; background: #fefce8; border: 1px solid #fde68a; border-radius: 4px; font-size: 0.82rem; }
.contact-details-inline { display: grid; gap: 2px; }
.contact-details-inline div { white-space: nowrap; }
.btn-toggle-contact { background: #fefce8; color: #92400e; border: 1px solid #fde68a; }
.btn-toggle-contact:hover { background: #fef3c7; }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 32px 0 16px; }
.page-info { color: var(--gray-500); font-size: 0.9rem; }

/* Error */
.error-page { text-align: center; padding: 80px 0; }
.error-code { font-size: 6rem; font-weight: 800; color: var(--gray-200); line-height: 1; }
.error-page h2 { font-size: 1.5rem; margin: 16px 0 8px; }
.error-page p { color: var(--gray-500); margin-bottom: 24px; }

/* Empty */
.empty-state { text-align: center; padding: 60px 0; }
.empty-icon { font-size: 4rem; margin-bottom: 16px; }
.empty-state h2 { color: var(--gray-500); margin-bottom: 8px; }
.empty-state p { color: var(--gray-400); margin-bottom: 24px; }

/* Password Change */
.password-card { max-width: 460px; margin: 0 auto; background: white; border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); }
.password-card h2 { text-align: center; margin-bottom: 24px; }
.password-requirements { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 22px; font-size: 0.82rem; color: var(--gray-600); }
.password-requirements ul { list-style: none; padding: 0; }
.password-requirements li::before { content: '▸ '; color: var(--primary); }

/* Footer */
.footer { background: white; border-top: 1px solid var(--gray-200); text-align: center; padding: 20px 0; color: var(--gray-400); font-size: 0.9rem; margin-top: auto; }

.small { font-size: 0.85rem; }

/* ========== About Page ========== */
.about-page { max-width: 860px; margin: 0 auto; }

.promise-section { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 24px 0; }

.promise-card {
    background: white; border-radius: var(--radius); padding: 30px;
    box-shadow: var(--shadow); text-align: center;
}
.promise-card.highlight {
    border: 2px solid var(--primary); position: relative;
}
.promise-card.highlight::before {
    content: '★ 核心承诺'; position: absolute; top: -12px; left: 50%;
    transform: translateX(-50%); background: var(--primary); color: white;
    padding: 2px 16px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
}
.promise-icon { font-size: 2.8rem; margin-bottom: 12px; }
.promise-card h3 { font-size: 1.15rem; margin-bottom: 10px; color: var(--gray-800); }
.promise-card p { color: var(--gray-600); font-size: 0.92rem; line-height: 1.7; }
.promise-card .emph {
    font-size: 1.2rem; font-weight: 700; color: var(--primary);
    margin-bottom: 10px;
}

.section-title { font-size: 1.3rem; color: var(--gray-800); margin: 36px 0 16px; text-align: center; }

.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.skill-item {
    background: white; border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); text-align: center; transition: 0.2s;
}
.skill-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.skill-icon { font-size: 2rem; margin-bottom: 8px; }
.skill-item h4 { font-size: 1rem; margin-bottom: 6px; color: var(--gray-800); }
.skill-item p { color: var(--gray-500); font-size: 0.85rem; }

.tech-stack { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 16px 0 40px; }
.tech-tag {
    background: var(--gray-100); color: var(--gray-700); padding: 8px 18px;
    border-radius: 20px; font-size: 0.88rem; font-weight: 500;
}

.cta-section { text-align: center; padding: 40px 0; }
.cta-section h2 { font-size: 1.5rem; margin-bottom: 8px; }
.cta-section p { color: var(--gray-500); margin-bottom: 20px; }

/* Responsive */
@media (max-width: 768px) {
    .promise-section { grid-template-columns: 1fr; }
    .nav-container { flex-direction: column; height: auto; gap: 8px; padding: 10px 16px; }
    .nav-links { justify-content: center; }
    .form-row { grid-template-columns: 1fr; }
    .detail-card { padding: 20px; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .page-header h1 { font-size: 1.5rem; }
}
