/* ============================================================
   Frontend Blog Manager — Stylesheet
   All classes are namespaced with .fbm- to avoid conflicts.
   Uses CSS custom properties for easy theming.
   ============================================================ */

:root {
    --fbm-primary:       #1a1a2e;
    --fbm-primary-h:     #16213e;
    --fbm-accent:        #e94560;
    --fbm-accent-h:      #c73652;
    --fbm-accent-2:      #0f3460;
    --fbm-surface:       #ffffff;
    --fbm-surface-2:     #f8f9fb;
    --fbm-border:        #e2e8f0;
    --fbm-text:          #1a1a2e;
    --fbm-text-muted:    #64748b;
    --fbm-text-light:    #94a3b8;
    --fbm-success:       #059669;
    --fbm-success-bg:    #ecfdf5;
    --fbm-error:         #dc2626;
    --fbm-error-bg:      #fef2f2;
    --fbm-warning:       #d97706;
    --fbm-warning-bg:    #fffbeb;
    --fbm-info:          #0ea5e9;
    --fbm-info-bg:       #f0f9ff;
    --fbm-radius:        12px;
    --fbm-radius-sm:     8px;
    --fbm-shadow:        0 4px 24px rgba(26,26,46,.08);
    --fbm-shadow-lg:     0 12px 48px rgba(26,26,46,.14);
    --fbm-font:          'Georgia', 'Times New Roman', serif;
    --fbm-font-ui:       -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --fbm-transition:    0.2s cubic-bezier(.4,0,.2,1);
}

/* ── Wrapper ──────────────────────────────────────────────────────────── */
.fbm-wrap {
    font-family: var(--fbm-font-ui);
    color: var(--fbm-text);
    line-height: 1.6;
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 16px;
    box-sizing: border-box;
}

.fbm-wrap *, .fbm-wrap *::before, .fbm-wrap *::after {
    box-sizing: border-box;
}

/* ── Card ─────────────────────────────────────────────────────────────── */
.fbm-card {
    background: var(--fbm-surface);
    border: 1px solid var(--fbm-border);
    border-radius: var(--fbm-radius);
    box-shadow: var(--fbm-shadow);
    padding: 40px;
    max-width: 480px;
    margin: 0 auto;
}

@media (max-width: 520px) {
    .fbm-card { padding: 28px 20px; }
}

.fbm-card__header {
    text-align: center;
    margin-bottom: 28px;
}

.fbm-logo-icon {
    font-size: 2.4rem;
    margin-bottom: 10px;
    display: block;
}

.fbm-card__title {
    font-family: var(--fbm-font);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--fbm-primary);
    margin: 0 0 6px;
    line-height: 1.2;
}

.fbm-card__sub {
    color: var(--fbm-text-muted);
    margin: 0;
    font-size: .92rem;
}

.fbm-card__footer {
    margin-top: 24px;
    text-align: center;
    font-size: .88rem;
    color: var(--fbm-text-muted);
}

/* ── Forms ────────────────────────────────────────────────────────────── */
.fbm-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fbm-form--post { gap: 20px; }

.fbm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fbm-field-row {
    display: flex;
    justify-content: flex-end;
    margin-top: -6px;
}

.fbm-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--fbm-text);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.fbm-hint {
    font-size: .78rem;
    color: var(--fbm-text-light);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.fbm-hint--center { text-align: center; margin: 0; }

.fbm-input-wrap {
    position: relative;
}

.fbm-input,
.fbm-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--fbm-border);
    border-radius: var(--fbm-radius-sm);
    font-size: .95rem;
    font-family: var(--fbm-font-ui);
    color: var(--fbm-text);
    background: var(--fbm-surface);
    transition: border-color var(--fbm-transition), box-shadow var(--fbm-transition);
    outline: none;
    -webkit-appearance: none;
}

.fbm-input--lg { font-size: 1.1rem; padding: 13px 16px; }

.fbm-input:focus,
.fbm-textarea:focus {
    border-color: var(--fbm-accent);
    box-shadow: 0 0 0 3px rgba(233,69,96,.12);
}

.fbm-input-wrap .fbm-input { padding-right: 42px; }

.fbm-eye-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    opacity: .6;
    transition: opacity var(--fbm-transition);
}
.fbm-eye-toggle:hover { opacity: 1; }

.fbm-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.fbm-textarea--sm { min-height: 60px; font-size: .88rem; }

.fbm-form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.fbm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border-radius: var(--fbm-radius-sm);
    font-size: .9rem;
    font-weight: 600;
    font-family: var(--fbm-font-ui);
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: background var(--fbm-transition), color var(--fbm-transition),
                border-color var(--fbm-transition), box-shadow var(--fbm-transition), opacity var(--fbm-transition);
    text-decoration: none;
    white-space: nowrap;
}

.fbm-btn:disabled { opacity: .55; cursor: not-allowed; }

.fbm-btn--primary {
    background: var(--fbm-accent);
    color: #fff;
    border-color: var(--fbm-accent);
}
.fbm-btn--primary:hover:not(:disabled) {
    background: var(--fbm-accent-h);
    border-color: var(--fbm-accent-h);
    box-shadow: 0 4px 14px rgba(233,69,96,.35);
}

.fbm-btn--ghost {
    background: transparent;
    color: var(--fbm-text-muted);
    border-color: var(--fbm-border);
}
.fbm-btn--ghost:hover:not(:disabled) {
    background: var(--fbm-surface-2);
    color: var(--fbm-text);
}

.fbm-btn--outline {
    background: transparent;
    color: var(--fbm-accent-2);
    border-color: var(--fbm-accent-2);
}
.fbm-btn--outline:hover:not(:disabled) {
    background: var(--fbm-accent-2);
    color: #fff;
}

.fbm-btn--danger {
    background: transparent;
    color: var(--fbm-error);
    border-color: var(--fbm-error);
}
.fbm-btn--danger:hover:not(:disabled) {
    background: var(--fbm-error);
    color: #fff;
}

.fbm-btn--full { width: 100%; }
.fbm-btn--sm   { padding: 7px 14px; font-size: .82rem; }

/* ── Notices ──────────────────────────────────────────────────────────── */
.fbm-notice {
    padding: 12px 16px;
    border-radius: var(--fbm-radius-sm);
    font-size: .88rem;
    line-height: 1.5;
    margin-bottom: 4px;
}
.fbm-notice--error   { background: var(--fbm-error-bg);   color: var(--fbm-error);   border: 1px solid #fecaca; }
.fbm-notice--success { background: var(--fbm-success-bg); color: var(--fbm-success); border: 1px solid #a7f3d0; }
.fbm-notice--info    { background: var(--fbm-info-bg);    color: var(--fbm-info);    border: 1px solid #bae6fd; }

/* ── Links ────────────────────────────────────────────────────────────── */
.fbm-link         { color: var(--fbm-accent); text-decoration: none; font-weight: 600; }
.fbm-link:hover   { text-decoration: underline; }
.fbm-link--muted  { color: var(--fbm-text-muted); font-weight: 400; }

/* ── OTP Input Row ────────────────────────────────────────────────────── */
.fbm-otp-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 8px 0;
}

.fbm-otp-digit {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    border: 2px solid var(--fbm-border);
    border-radius: var(--fbm-radius-sm);
    background: var(--fbm-surface-2);
    color: var(--fbm-text);
    outline: none;
    transition: border-color var(--fbm-transition);
}

.fbm-otp-digit:focus {
    border-color: var(--fbm-accent);
    background: var(--fbm-surface);
    box-shadow: 0 0 0 3px rgba(233,69,96,.12);
}

@media (max-width: 360px) {
    .fbm-otp-digit { width: 40px; height: 48px; font-size: 1.2rem; }
}

/* ── Dashboard ────────────────────────────────────────────────────────── */
.fbm-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--fbm-primary);
    color: #fff;
    padding: 14px 20px;
    border-radius: var(--fbm-radius);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.fbm-topbar__left { display: flex; align-items: center; gap: 14px; }

.fbm-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--fbm-accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; color: #fff;
    flex-shrink: 0;
}

.fbm-topbar__name  { font-weight: 600; font-size: .96rem; }
.fbm-topbar__email { font-size: .78rem; opacity: .7; }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.fbm-tabs {
    display: flex;
    border-bottom: 2px solid var(--fbm-border);
    margin-bottom: 24px;
    gap: 0;
    overflow-x: auto;
}

.fbm-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: .9rem;
    font-weight: 600;
    color: var(--fbm-text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color var(--fbm-transition), border-color var(--fbm-transition);
    font-family: var(--fbm-font-ui);
}

.fbm-tab:hover        { color: var(--fbm-text); }
.fbm-tab--active      { color: var(--fbm-accent); border-bottom-color: var(--fbm-accent); }

.fbm-tab-panel--hidden { display: none; }

/* ── Panel ─────────────────────────────────────────────────────────────── */
.fbm-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.fbm-panel-title {
    font-family: var(--fbm-font);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--fbm-primary);
    margin: 0;
}

/* ── My Posts Grid ────────────────────────────────────────────────────── */
.fbm-post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.fbm-post-card {
    background: var(--fbm-surface);
    border: 1px solid var(--fbm-border);
    border-radius: var(--fbm-radius);
    padding: 18px;
    transition: box-shadow var(--fbm-transition), opacity .3s;
}

.fbm-post-card:hover { box-shadow: var(--fbm-shadow); }

.fbm-post-card__header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.fbm-post-card__title {
    font-family: var(--fbm-font);
    font-size: 1rem;
    font-weight: 700;
    color: var(--fbm-text);
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.fbm-post-card__excerpt {
    color: var(--fbm-text-muted);
    font-size: .84rem;
    margin: 0 0 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fbm-post-card__meta {
    display: flex;
    gap: 12px;
    font-size: .78rem;
    color: var(--fbm-text-light);
    margin-bottom: 12px;
}

.fbm-post-card__actions { display: flex; gap: 8px; }

/* ── Badge ────────────────────────────────────────────────────────────── */
.fbm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    flex-shrink: 0;
}

.fbm-badge--publish  { background: #dcfce7; color: #16a34a; }
.fbm-badge--draft    { background: #fef9c3; color: #a16207; }
.fbm-badge--pending  { background: #fee2e2; color: #b91c1c; }
.fbm-badge--private  { background: #f1f5f9; color: #475569; }

/* ── Community Feed ───────────────────────────────────────────────────── */
.fbm-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.fbm-feed-card {
    background: var(--fbm-surface);
    border: 1px solid var(--fbm-border);
    border-radius: var(--fbm-radius);
    padding: 22px;
    transition: box-shadow var(--fbm-transition);
}

.fbm-feed-card:hover { box-shadow: var(--fbm-shadow); }

.fbm-feed-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.fbm-feed-author { font-size: .82rem; font-weight: 600; color: var(--fbm-accent-2); }
.fbm-feed-date   { font-size: .78rem; color: var(--fbm-text-light); }

.fbm-feed-card__title {
    font-family: var(--fbm-font);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--fbm-text);
    margin: 0 0 8px;
    line-height: 1.3;
}

.fbm-feed-card__excerpt {
    color: var(--fbm-text-muted);
    font-size: .88rem;
    margin: 0 0 14px;
    line-height: 1.6;
}

.fbm-feed-card__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--fbm-border);
}

/* ── Like Button ──────────────────────────────────────────────────────── */
.fbm-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1.5px solid var(--fbm-border);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: .85rem;
    cursor: pointer;
    color: var(--fbm-text-muted);
    font-weight: 600;
    transition: all var(--fbm-transition);
    font-family: var(--fbm-font-ui);
}

.fbm-like-btn:hover {
    border-color: var(--fbm-accent);
    color: var(--fbm-accent);
    background: rgba(233,69,96,.05);
}

.fbm-like-btn--liked {
    border-color: var(--fbm-accent);
    color: var(--fbm-accent);
    background: rgba(233,69,96,.07);
}

.fbm-like-icon { font-size: .95rem; }

.fbm-comment-toggle {
    background: none;
    border: none;
    font-size: .85rem;
    color: var(--fbm-text-muted);
    cursor: pointer;
    font-family: var(--fbm-font-ui);
    padding: 5px 8px;
    border-radius: 6px;
    transition: background var(--fbm-transition), color var(--fbm-transition);
}

.fbm-comment-toggle:hover { background: var(--fbm-surface-2); color: var(--fbm-text); }

/* ── Comments ─────────────────────────────────────────────────────────── */
.fbm-comments-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--fbm-surface-2);
}

.fbm-comments-list { margin-bottom: 12px; display: flex; flex-direction: column; gap: 10px; }

.fbm-comment {
    background: var(--fbm-surface-2);
    border-radius: var(--fbm-radius-sm);
    padding: 10px 14px;
}

.fbm-comment--new { animation: fbm-slide-in .3s ease; }

@keyframes fbm-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fbm-comment__author {
    font-weight: 700;
    font-size: .8rem;
    color: var(--fbm-accent-2);
    margin-right: 8px;
}

.fbm-comment__time {
    font-size: .74rem;
    color: var(--fbm-text-light);
}

.fbm-comment__text {
    margin: 4px 0 0;
    font-size: .86rem;
    color: var(--fbm-text);
    line-height: 1.5;
}

.fbm-add-comment {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.fbm-add-comment .fbm-textarea { flex: 1; }

/* ── Pagination ───────────────────────────────────────────────────────── */
.fbm-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}

.fbm-page-btn {
    width: 36px; height: 36px;
    border-radius: var(--fbm-radius-sm);
    border: 1.5px solid var(--fbm-border);
    background: var(--fbm-surface);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--fbm-text-muted);
    transition: all var(--fbm-transition);
    font-family: var(--fbm-font-ui);
}

.fbm-page-btn:hover       { border-color: var(--fbm-accent); color: var(--fbm-accent); }
.fbm-page-btn--active     { background: var(--fbm-accent); border-color: var(--fbm-accent); color: #fff; }

/* ── Loading / Empty ──────────────────────────────────────────────────── */
.fbm-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--fbm-text-muted);
    font-size: .9rem;
    animation: fbm-pulse 1.4s infinite;
}

@keyframes fbm-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}

.fbm-empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--fbm-text-muted);
}

.fbm-empty__icon { font-size: 2.6rem; margin-bottom: 12px; }
.fbm-empty p     { margin: 0 0 16px; font-size: .92rem; }

/* ── Responsive tweaks ────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .fbm-post-grid         { grid-template-columns: 1fr; }
    .fbm-topbar            { padding: 12px 14px; }
    .fbm-tab               { padding: 9px 14px; font-size: .82rem; }
    .fbm-feed-card         { padding: 16px; }
    .fbm-otp-row           { gap: 7px; }
}
