/* ===== AdminAi.online Community CSS ===== */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --accent: #8b5cf6;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ===== Header ===== */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    padding: 0;
}
.header-inner {
    display: flex; justify-content: space-between; align-items: center;
    height: 56px;
}
.logo {
    font-size: 20px; font-weight: 700; color: var(--primary-light);
    display: flex; align-items: center; gap: 8px;
}
.logo:hover { text-decoration: none; }
.logo-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
    color: var(--text-muted); padding: 8px 14px; border-radius: 8px;
    font-weight: 500; font-size: 14px; transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
    color: var(--text); background: var(--bg-input); text-decoration: none;
}

.user-menu { display: flex; align-items: center; gap: 12px; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; color: #fff; cursor: pointer;
}
.btn-login, .btn-register {
    padding: 6px 16px; border-radius: 8px; font-size: 14px; font-weight: 500;
    border: none; cursor: pointer; transition: all 0.2s;
}
.btn-login { background: transparent; color: var(--text-muted); }
.btn-login:hover { color: var(--text); }
.btn-register { background: var(--primary); color: #fff; }
.btn-register:hover { background: var(--primary-dark); }

/* ===== Hero ===== */
.hero {
    text-align: center; padding: 48px 16px 32px;
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg) 100%);
}
.hero h1 { font-size: 32px; font-weight: 700; margin-bottom: 12px; }
.hero p { color: var(--text-muted); font-size: 16px; max-width: 560px; margin: 0 auto; }

/* ===== Product Cards ===== */
.products-section { padding: 32px 0; }
.products-section h2 { font-size: 20px; font-weight: 600; margin-bottom: 20px; }
.products-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.product-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    transition: all 0.2s; cursor: pointer; position: relative; overflow: hidden;
}
.product-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.product-icon { font-size: 36px; margin-bottom: 12px; }
.product-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.product-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.product-status {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
}
.status-active { background: rgba(34,197,94,0.15); color: var(--success); }
.status-coming { background: rgba(245,158,11,0.15); color: var(--warning); }
.status-beta { background: rgba(139,92,246,0.15); color: var(--accent); }

/* ===== Community Feed ===== */
.feed-section { padding: 32px 0; }
.feed-section h2 { font-size: 20px; font-weight: 600; margin-bottom: 20px; }

.post-composer {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin-bottom: 20px;
}
.post-composer textarea {
    width: 100%; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 8px; padding: 12px; color: var(--text); font-family: inherit;
    font-size: 14px; resize: vertical; min-height: 80px;
}
.post-composer textarea::placeholder { color: var(--text-muted); }
.post-composer textarea:focus { outline: none; border-color: var(--primary); }
.composer-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

.post-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.post-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.post-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--accent); display: flex; align-items: center; justify-content: center;
    font-weight: 600; color: #fff; font-size: 16px; flex-shrink: 0;
}
.post-meta { flex: 1; }
.post-author { font-weight: 600; font-size: 14px; }
.post-time { color: var(--text-muted); font-size: 12px; }
.post-content { font-size: 15px; line-height: 1.7; margin-bottom: 12px; white-space: pre-wrap; }
.post-media img { width: 100%; border-radius: 8px; margin-bottom: 12px; }
.post-actions { display: flex; gap: 4px; border-top: 1px solid var(--border); padding-top: 12px; }
.post-action-btn {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    padding: 6px 12px; border-radius: 6px; font-size: 13px; font-family: inherit;
    display: flex; align-items: center; gap: 4px; transition: all 0.2s;
}
.post-action-btn:hover { background: var(--bg-input); color: var(--text); }
.post-action-btn.active { color: var(--primary-light); }

.post-comments { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.comment {
    display: flex; gap: 10px; margin-bottom: 12px; padding: 8px 0;
}
.comment-avatar {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background: var(--bg-input); display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.comment-body {
    background: var(--bg-input); border-radius: 12px; padding: 8px 12px; flex: 1;
}
.comment-author { font-weight: 600; font-size: 13px; }
.comment-text { font-size: 13px; color: var(--text); }
.comment-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.comment-input-wrap { display: flex; gap: 8px; margin-top: 8px; }
.comment-input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 20px; padding: 8px 14px; color: var(--text);
    font-family: inherit; font-size: 13px;
}
.comment-input:focus { outline: none; border-color: var(--primary); }

/* ===== Buttons ===== */
.btn {
    padding: 8px 20px; border-radius: 8px; font-weight: 600; font-size: 14px;
    border: none; cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }
.btn-sm { padding: 4px 12px; font-size: 13px; }

/* ===== Auth Pages ===== */
.auth-page { min-height: calc(100vh - 56px); display: flex; align-items: center; justify-content: center; }
.auth-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 32px; width: 100%; max-width: 400px;
}
.auth-card h2 { text-align: center; margin-bottom: 24px; font-size: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--text-muted); }
.form-input {
    width: 100%; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 8px; padding: 10px 14px; color: var(--text);
    font-family: inherit; font-size: 14px;
}
.form-input:focus { outline: none; border-color: var(--primary); }
.form-error { color: var(--danger); font-size: 13px; margin-top: 4px; display: none; }
.auth-footer { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-muted); }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px;
}
.alert-error { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.alert-success { background: rgba(34,197,94,0.15); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }

/* ===== Loading ===== */
.spinner {
    width: 24px; height: 24px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center; padding: 48px 16px; color: var(--text-muted);
}
.empty-state p { font-size: 16px; }

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid var(--border); padding: 24px 0;
    text-align: center; color: var(--text-muted); font-size: 13px;
    margin-top: 48px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .hero h1 { font-size: 24px; }
    .products-grid { grid-template-columns: 1fr; }
    .header-inner { padding: 0 4px; }
    .nav-links a { padding: 8px 10px; font-size: 13px; }
}

/* ===== Dropdown ===== */
.dropdown { position: relative; }
.dropdown-menu {
    display: none; position: absolute; right: 0; top: 100%; margin-top: 8px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    min-width: 180px; box-shadow: var(--shadow); z-index: 200; overflow: hidden;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a, .dropdown-menu button {
    display: block; width: 100%; text-align: left; padding: 10px 16px;
    color: var(--text); font-size: 14px; font-family: inherit;
    background: none; border: none; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover {
    background: var(--bg-input); text-decoration: none;
}

/* ===== Reaction Bar ===== */
.reaction-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.reaction-chip {
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 16px; padding: 2px 8px; font-size: 12px;
    display: flex; align-items: center; gap: 3px; cursor: pointer;
}
.reaction-chip.mine { border-color: var(--primary); background: rgba(37,99,235,0.15); }

/* ===== Reaction Wrap & Picker ===== */
.reaction-wrap { position: relative; display: flex; align-items: center; gap: 0; }
.reaction-picker {
    display: none; position: absolute; bottom: 100%; left: 0;
    margin-bottom: 6px; padding: 6px 10px; gap: 2px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 24px; box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    z-index: 50; white-space: nowrap;
}
.reaction-picker::after {
    content: ''; position: absolute; left: 0; right: 0;
    bottom: -10px; height: 10px;
}
.reaction-wrap:hover .reaction-picker { display: flex; }
.reaction-picker:hover { display: flex; }
.reaction-picker button {
    background: none; border: none; font-size: 22px; cursor: pointer;
    padding: 4px 5px; border-radius: 8px; transition: transform 0.15s;
    line-height: 1;
}
.reaction-picker button:hover { transform: scale(1.35); }

/* ===== Reactions Summary ===== */
.reactions-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; padding: 4px 0; }
.reaction-badge {
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 16px; padding: 2px 10px; font-size: 13px;
    display: inline-flex; align-items: center; gap: 3px;
}

/* ===== Post Delete ===== */
.post-delete-btn {
    margin-left: auto; font-size: 14px !important; opacity: 0.5;
}
.post-delete-btn:hover { opacity: 1; }

/* ===== Comment Replies ===== */
.comment-replies {
    margin-left: 38px; border-left: 2px solid var(--border); padding-left: 12px;
}
.comment-reply { padding: 4px 0; }
.reply-toggle { margin-left: 38px; margin-bottom: 4px; }
.btn-reply-link {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 12px; font-family: inherit; padding: 2px 4px;
}
.btn-reply-link:hover { color: var(--primary-light); }
.reply-input-wrap {
    display: flex; gap: 8px; margin-left: 38px; margin-bottom: 8px;
}
.show-more-replies {
    font-size: 12px; color: var(--text-muted); cursor: pointer; padding: 4px 0;
}
.show-more-replies:hover { color: var(--primary-light); }

/* ===== Comment Footer & Like ===== */
.comment-footer {
    display: flex; align-items: center; gap: 10px; margin-top: 4px;
}
.comment-delete {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 12px; margin-left: 8px; opacity: 0.5; float: right;
}
.comment-delete:hover { opacity: 1; color: var(--danger); }
.btn-comment-like {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 12px; font-family: inherit; padding: 0;
}
.btn-comment-like:hover { color: var(--primary-light); }

/* ===== Image Preview (Composer) ===== */
#image-preview { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.preview-thumb {
    position: relative; width: 80px; height: 80px;
    border-radius: 8px; overflow: hidden;
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview-thumb button {
    position: absolute; top: 2px; right: 2px;
    background: rgba(0,0,0,0.7); color: #fff; border: none;
    border-radius: 50%; width: 20px; height: 20px;
    font-size: 12px; cursor: pointer; line-height: 20px; padding: 0;
}

/* ===== Full-screen Image Overlay ===== */
.image-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.9);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.image-overlay img {
    max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 8px;
}
.image-close {
    position: fixed; top: 16px; right: 24px; color: #fff;
    font-size: 32px; cursor: pointer; z-index: 10000;
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
}
.image-close:hover { opacity: 0.7; }

/* ===== Post Media Grid ===== */
.post-media {
    display: grid; gap: 4px; margin-bottom: 12px; border-radius: 8px; overflow: hidden;
}
.post-media img {
    width: 100%; max-height: 500px; object-fit: cover; cursor: pointer; margin: 0;
}
.post-media video { width: 100%; border-radius: 8px; }

/* ===== Composer Actions ===== */
.composer-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 8px; }
