/* ===== PromptHub - PromptMinder Style ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #ffffff;
    --bg-soft: #f9fafb;
    --surface: #ffffff;
    --surface-hover: #f3f4f6;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --text: #111827;
    --text2: #6b7280;
    --text3: #9ca3af;
    --brand: #3b82f6;
    --brand-hover: #2563eb;
    --brand-bg: #dbeafe;
    --brand-bg-soft: #eff6ff;
    --dark: #1f2937;
    --dark-hover: #111827;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --max-width: 1200px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    --mono: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
}

html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

/* ===== Container ===== */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ===== Header / Nav ===== */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 24px;
    max-width: var(--max-width);
    margin: 0 auto;
}
.site-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.site-header-actions { display: flex; align-items: center; gap: 8px; }

/* ===== Hero Section ===== */
.hero {
    text-align: center;
    padding: 48px 24px 32px;
}
.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.hero p {
    font-size: 1rem;
    color: var(--text2);
    margin-bottom: 4px;
}

/* ===== Search + Filter ===== */
.search-filter {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px 24px;
}
.search-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}
.search-input-wrap {
    position: relative;
    width: 100%;
    max-width: 720px;
}
.search-input-wrap svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text3);
    pointer-events: none;
}
.search-input {
    width: 100%;
    height: 52px;
    padding: 0 18px 0 46px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    color: var(--text);
    background: var(--bg);
    font-family: var(--font);
    box-shadow: var(--shadow);
}
.search-input::placeholder { color: var(--text3); }
.search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* Tag filter bar */
.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag-filter-item {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.12s;
    color: var(--text2);
    background: var(--surface-hover);
    border: none;
    font-family: var(--font);
    text-decoration: none;
    display: inline-block;
}
.tag-filter-item:hover { background: var(--border); color: var(--text); text-decoration: none; }
.tag-filter-item.active {
    background: var(--dark);
    color: #fff;
    font-weight: 500;
}
.tag-filter-item.active:hover { background: var(--dark-hover); color: #fff; }

/* ===== Card Grid ===== */
.card-grid {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px 48px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s, transform 0.15s;
    cursor: default;
    border: 1px solid var(--border-light);
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
}
.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    flex: 1;
    min-width: 0;
    margin-right: 8px;
}
.card-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.card-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text3);
    transition: all 0.12s;
}
.card-action-btn:hover { background: var(--surface-hover); color: var(--text2); }
.card-action-btn.copied { color: var(--success); }

.card-body {
    font-size: 0.84rem;
    color: var(--text2);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    background: var(--brand-bg);
    color: var(--brand);
    border-radius: 4px;
    font-weight: 500;
}
.card-view-btn {
    font-size: 0.78rem;
    color: var(--brand);
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    font-family: var(--font);
}
.card-view-btn:hover { text-decoration: underline; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text3);
    grid-column: 1 / -1;
}
.empty-state p { font-size: 0.95rem; }

/* ===== Detail Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 720px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    transform: translateY(20px);
    transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}
.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--surface-hover);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text2);
    flex-shrink: 0;
    margin-left: 12px;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-tags {
    display: flex;
    gap: 6px;
    padding: 0 24px 12px;
    flex-wrap: wrap;
}

.modal-actions {
    display: flex;
    gap: 8px;
    padding: 0 24px 16px;
    flex-shrink: 0;
}

.modal-body {
    flex: 1;
    overflow: auto;
    padding: 0 24px 24px;
    line-height: 1.75;
    font-size: 0.93rem;
    color: var(--text);
}
.modal-body h1 { font-size: 1.5rem; font-weight: 700; margin: 24px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.modal-body h2 { font-size: 1.3rem; font-weight: 700; margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-light); }
.modal-body h3 { font-size: 1.1rem; font-weight: 600; margin: 16px 0 8px; }
.modal-body h4 { font-size: 1rem; font-weight: 600; margin: 14px 0 6px; }
.modal-body p { margin: 0 0 10px; }
.modal-body ul, .modal-body ol { margin: 0 0 10px; padding-left: 22px; }
.modal-body li { margin-bottom: 3px; }
.modal-body strong { font-weight: 600; }
.modal-body code {
    background: #e8eaed;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 0.85em;
    color: #d63384;
}
.modal-body pre {
    background: #18181b;
    border-radius: 8px;
    padding: 14px;
    overflow: auto;
    margin: 12px 0;
}
.modal-body pre code {
    background: transparent;
    padding: 0;
    color: #e4e4e7;
    font-size: 0.82rem;
    line-height: 1.6;
}
.modal-body blockquote {
    border-left: 4px solid var(--brand);
    padding: 6px 14px;
    margin: 0 0 10px;
    background: #f0f4ff;
    color: #374151;
    border-radius: 0 6px 6px 0;
}
.modal-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.85rem;
}
.modal-body th, .modal-body td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}
.modal-body th { background: #f3f4f6; font-weight: 600; }
.modal-body hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.modal-body a { color: var(--brand); }
.modal-body a:hover { text-decoration: underline; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    cursor: pointer;
    transition: all 0.12s;
    text-decoration: none;
    font-family: var(--font);
    font-weight: 500;
    line-height: 1.3;
}
.btn:hover { text-decoration: none; }
.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: var(--dark-hover); color: #fff; }
.btn-dark.copied { background: var(--success); }
.btn-secondary { background: var(--surface-hover); color: var(--text2); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-hover); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

/* ===== Detail Page (standalone) ===== */
.detail-page { padding: 0 24px; }
.detail-page .container { max-width: 800px; padding-top: 32px; padding-bottom: 48px; }
.detail-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.detail-tags { display: flex; gap: 6px; margin-bottom: 16px; }
.detail-meta { font-size: 0.82rem; color: var(--text3); margin-bottom: 20px; }
.detail-actions { display: flex; gap: 8px; margin-bottom: 24px; }
.detail-code {
    background: #f8f9fa;
    border-radius: var(--radius);
    padding: 24px;
    overflow: auto;
    line-height: 1.75;
    font-size: 0.93rem;
    color: var(--text);
    border: 1px solid var(--border);
}
.detail-code h1 { font-size: 1.6rem; font-weight: 700; margin: 28px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.detail-code h2 { font-size: 1.35rem; font-weight: 700; margin: 24px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border-light); }
.detail-code h3 { font-size: 1.15rem; font-weight: 600; margin: 20px 0 10px; }
.detail-code h4 { font-size: 1.05rem; font-weight: 600; margin: 16px 0 8px; }
.detail-code p { margin: 0 0 12px; }
.detail-code ul, .detail-code ol { margin: 0 0 12px; padding-left: 24px; }
.detail-code li { margin-bottom: 4px; }
.detail-code strong { font-weight: 600; color: #111; }
.detail-code code {
    background: #e8eaed;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 0.85em;
    color: #d63384;
}
.detail-code pre {
    background: #18181b;
    border-radius: 8px;
    padding: 16px;
    overflow: auto;
    margin: 16px 0;
}
.detail-code pre code {
    background: transparent;
    padding: 0;
    color: #e4e4e7;
    font-size: 0.82rem;
    line-height: 1.6;
}
.detail-code blockquote {
    border-left: 4px solid var(--brand);
    padding: 8px 16px;
    margin: 0 0 12px;
    background: #f0f4ff;
    color: #374151;
    border-radius: 0 6px 6px 0;
}
.detail-code table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.88rem;
}
.detail-code th, .detail-code td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.detail-code th { background: #f3f4f6; font-weight: 600; }
.detail-code hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.detail-code a { color: var(--brand); }
.detail-code a:hover { text-decoration: underline; }
.detail-code img { max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }
.detail-back { margin-top: 24px; }

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px;
    text-align: center;
    color: var(--text3);
    font-size: 0.8rem;
}

/* ========================================= */
/* ===== Admin Pages ===== */
/* ========================================= */
.admin-page { background: var(--bg-soft); }

.admin-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.admin-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 52px;
    flex-wrap: wrap;
    gap: 8px;
}
.admin-brand { color: var(--text); font-weight: 600; font-size: 0.88rem; }
.admin-links { display: flex; gap: 20px; flex-wrap: wrap; }
.admin-links a { color: var(--text2); font-size: 0.82rem; }
.admin-links a:hover { color: var(--brand); }

.admin-actions { margin: 24px 0 16px; }

.stats { display: flex; gap: 12px; margin: 24px 0; }
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px 36px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-num { display: block; font-size: 2rem; font-weight: 700; color: var(--brand); }
.stat-label { font-size: 0.82rem; color: var(--text2); }

.admin-table {
    width: 100%;
    background: var(--surface);
    border-collapse: collapse;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.admin-table th, .admin-table td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}
.admin-table th {
    background: var(--bg-soft);
    font-weight: 600;
    color: var(--text2);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface-hover); }
.link-danger { color: var(--danger); }
.link-danger:hover { color: #dc2626; }

.admin-form {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 720px;
    box-shadow: var(--shadow);
}
.admin-form label { display: block; margin-bottom: 20px; }
.admin-form label span { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.85rem; }
.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form textarea,
.admin-form input[type="file"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: var(--font);
    outline: none;
    color: var(--text);
}
.admin-form input:focus,
.admin-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.admin-form textarea { font-family: var(--mono); resize: vertical; }
.admin-form small { display: block; margin-top: 4px; color: var(--text3); font-size: 0.72rem; }

.form-group { margin-bottom: 20px; }
.form-group > span { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.85rem; }
.tag-checkboxes { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-checkbox { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 0.85rem; }
.tag-checkbox input { width: auto; accent-color: var(--brand); }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 24px;
}
.inline-form input[type="text"] {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    width: 200px;
}
.inline-form input:focus { border-color: var(--brand); }

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

.msg-success { color: var(--success); padding: 12px 0; font-weight: 500; }
.msg-error { color: var(--danger); padding: 12px 0; font-weight: 500; }

/* ===== Login ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-soft);
}
.login-form {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-md);
}
.login-form h1 { font-size: 1.1rem; margin-bottom: 28px; text-align: center; }
.login-form label { display: block; margin-bottom: 16px; }
.login-form label span { display: block; font-size: 0.78rem; font-weight: 500; margin-bottom: 6px; color: var(--text2); }
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    outline: none;
    color: var(--text);
}
.login-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.login-form .btn { width: 100%; justify-content: center; margin-top: 8px; }
.login-back { text-align: center; margin-top: 20px; font-size: 0.8rem; }

.captcha-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.captcha-img {
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.captcha-img:hover { opacity: 0.7; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .card-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.5rem; }
    .search-input-wrap { max-width: 100%; }
}
