/* ==========================================================================
   Sosial Media Khusus Agent — Social CSS
   ========================================================================== */

:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --accent: #0ea5e9;
    --accent-dark: #0284c7;
    --danger: #ef4444;
    --dark: #0f172a;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.main {
    flex: 1;
    padding-top: 28px;
    padding-bottom: 40px;
}

/* ---------- Alert ---------- */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

/* ---------- Tombol ---------- */
.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: 0;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-block {
    width: 100%;
    text-align: center;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--dark);
    color: #fff;
}

.site-header .nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    font-size: 1.15rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
    list-style: none;
}

.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

.nav-avatar img,
.nav-avatar .avatar-svg {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

/* ---------- Avatar ---------- */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), #6366f1);
}

.avatar-svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}

/* ---------- Feed layout ---------- */
.feed-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    align-items: start;
}

.feed-side {
    position: sticky;
    top: 78px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.feed-main {
    min-width: 0;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 18px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

/* ---------- Compose ---------- */
.compose-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 90px;
}

.compose-form textarea:focus {
    outline: 2px solid var(--accent);
    border-color: transparent;
}

.compose-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.file-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--accent-dark);
    font-weight: 600;
    font-size: 0.9rem;
}

.chars-hint {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.78rem;
}

.stats-card .stat-line {
    margin-bottom: 6px;
    font-size: 0.92rem;
}

.stats-card .muted {
    color: var(--muted);
}

.small {
    font-size: 0.82rem;
}

/* ---------- Post ---------- */
.post {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.post-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-link {
    display: inline-flex;
}

.post-user {
    flex: 1;
    min-width: 0;
}

.post-name {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    color: var(--text);
}

.post-name:hover {
    color: var(--accent-dark);
}

.post-username {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.post-time {
    color: var(--muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.post-content {
    margin: 12px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.98rem;
}

.post-content a {
    color: var(--accent-dark);
    text-decoration: underline;
}

.post-content .mention {
    color: var(--accent-dark);
    font-weight: 600;
    text-decoration: none;
}

.post-image {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 12px;
    margin: 8px 0;
}

.post-actions {
    display: flex;
    gap: 14px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.action-btn {
    background: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    transition: background 0.2s;
}

.action-btn:hover {
    background: #f1f5f9;
}

.like-btn.liked {
    color: var(--danger);
}

.comments {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.comment {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.comment .avatar {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

.comment-body {
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    flex: 1;
}

.comment-user {
    font-weight: 600;
    color: var(--accent-dark);
    text-decoration: none;
}

.comment-time {
    color: var(--muted);
    font-size: 0.75rem;
}

.comment-form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.comment-form input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.9rem;
}

.comment-form input:focus {
    outline: 2px solid var(--accent);
    border-color: transparent;
}

.comment-form button {
    background: var(--accent);
    border: 0;
    color: #fff;
    border-radius: 999px;
    padding: 8px 18px;
    font-weight: 600;
    cursor: pointer;
}

/* ---------- Profile ---------- */
.profile-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 26px;
}

.profile-avatar-wrap {
    position: relative;
}

.profile-avatar-wrap .avatar {
    width: 96px;
    height: 96px;
    font-size: 2.2rem;
    border: 4px solid #fff;
    box-shadow: 0 4px 12px rgba(2, 6, 23, 0.15);
}

.avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--accent);
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 800;
}

.profile-username {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 2px 0 8px;
}

.badge {
    display: inline-block;
    background: #e0f2fe;
    color: var(--accent-dark);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.profile-bio {
    margin: 8px 0;
    font-size: 0.98rem;
    white-space: pre-wrap;
}

.profile-joined {
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 12px;
}

.profile-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
}

.profile-stats span {
    font-size: 0.9rem;
    color: var(--muted);
}

.profile-stats strong {
    color: var(--text);
    font-size: 1.05rem;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 16px;
}

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-head h2 {
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: 0;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}

/* ---------- Form umum ---------- */
.field {
    display: block;
    margin-bottom: 14px;
}

.field span {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.field input,
.field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.95rem;
}

.field input:focus,
.field textarea:focus {
    outline: 2px solid var(--accent);
    border-color: transparent;
}

.field small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.78rem;
}

/* ---------- Halaman auth ---------- */
.auth-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #0ea5e9 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 16px;
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 30px 60px rgba(2, 6, 23, 0.35);
}

.auth-card--wide {
    max-width: 480px;
}

.auth-logo {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 16px;
}

.auth-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.3;
}

.auth-tagline {
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 22px;
    font-style: italic;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-switch {
    text-align: center;
    margin-top: 18px;
    font-size: 0.92rem;
    color: var(--muted);
}

.auth-switch a {
    color: var(--accent-dark);
    font-weight: 600;
}

.auth-note {
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

/* ---------- Empty & misc ---------- */
.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 22px 0 10px;
    font-size: 0.9rem;
    color: var(--muted);
}

.pagination a {
    color: var(--accent-dark);
    font-weight: 600;
    text-decoration: none;
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--dark);
    color: #94a3b8;
    padding: 30px 0;
    text-align: center;
}

.site-footer p {
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.footer-small {
    font-size: 0.78rem;
    color: #64748b;
}

/* ---------- Back to top ---------- */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: var(--dark);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 40;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media screen and (max-width: 860px) {
    .feed-layout {
        grid-template-columns: 1fr;
    }

    .feed-side {
        position: static;
    }
}

@media screen and (max-width: 640px) {
    .brand-text {
        display: none;
    }

    .profile-hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-stats {
        justify-content: center;
    }

    .profile-actions {
        display: flex;
        justify-content: center;
    }

    .nav-links {
        gap: 12px;
    }

    .nav-links a {
        font-size: 0.82rem;
    }
}