/* NepalChat - Facebook-like UI */
:root {
    --fb-blue: #1877f2;
    --fb-blue-hover: #166fe5;
    --fb-bg: #f0f2f5;
    --fb-white: #ffffff;
    --fb-text: #050505;
    --fb-secondary: #65676b;
    --fb-border: #ced0d4;
    --fb-hover: #e4e6eb;
    --fb-green: #31a24c;
    --fb-red: #e41e3f;
    --shadow: 0 1px 2px rgba(0,0,0,0.1);
    --radius: 8px;
}

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

body {
    font-family: Helvetica, Arial, sans-serif;
    background: var(--fb-bg);
    color: var(--fb-text);
    line-height: 1.34;
}

a { color: var(--fb-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Navbar ===== */
.navbar {
    background: var(--fb-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 16px;
}

.navbar-inner {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--fb-blue);
    letter-spacing: -0.5px;
}

.search-box {
    background: var(--fb-bg);
    border-radius: 50px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    width: 240px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    margin-left: 8px;
    width: 100%;
    font-size: 15px;
}

.nav-icons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--fb-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    position: relative;
}

.nav-icon:hover { background: var(--fb-hover); }

.nav-icon .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--fb-red);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 5px;
    min-width: 18px;
    text-align: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 20px;
}

.user-menu:hover { background: var(--fb-hover); }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--fb-border);
}

.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 48px; height: 48px; }
.avatar-xl { width: 168px; height: 168px; border: 4px solid white; }

/* ===== Layout ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    gap: 16px;
}

@media (max-width: 1100px) {
    .container { grid-template-columns: 1fr 300px; }
    .left-sidebar { display: none; }
}
@media (max-width: 900px) {
    .container { grid-template-columns: 1fr; }
    .right-sidebar { display: none; }
}

/* ===== Cards ===== */
.card {
    background: var(--fb-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 17px;
    border-bottom: 1px solid var(--fb-border);
}

.card-body { padding: 12px 16px; }

/* ===== Create Post ===== */
.create-post {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
}

.create-post textarea,
.create-post input[type="text"] {
    flex: 1;
    border: none;
    background: var(--fb-bg);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 16px;
    outline: none;
    resize: none;
}

.create-actions {
    display: flex;
    border-top: 1px solid var(--fb-border);
    padding: 8px;
}

.create-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--fb-secondary);
    font-size: 14px;
}

.create-action:hover { background: var(--fb-hover); }

/* ===== Post ===== */
.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 0;
}

.post-meta { flex: 1; }
.post-author { font-weight: 600; }
.post-time { font-size: 13px; color: var(--fb-secondary); }

.post-content {
    padding: 12px 16px;
    font-size: 15px;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-media img,
.post-media video {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    background: #000;
    display: block;
}

.post-stats {
    padding: 8px 16px;
    font-size: 15px;
    color: var(--fb-secondary);
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--fb-border);
}

.post-actions {
    display: flex;
    padding: 4px 8px;
}

.post-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--fb-secondary);
    font-size: 15px;
}

.post-action:hover { background: var(--fb-hover); }
.post-action.liked { color: var(--fb-blue); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary {
    background: var(--fb-blue);
    color: white;
}
.btn-primary:hover { background: var(--fb-blue-hover); }

.btn-secondary {
    background: var(--fb-bg);
    color: var(--fb-text);
}
.btn-secondary:hover { background: var(--fb-hover); }

.btn-success {
    background: var(--fb-green);
    color: white;
}

.btn-danger {
    background: var(--fb-red);
    color: white;
}

.btn-block { width: 100%; }

.btn-sm { padding: 4px 10px; font-size: 13px; }

/* ===== Auth pages ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--fb-bg);
}

.auth-box {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.auth-box h1 {
    text-align: center;
    color: var(--fb-blue);
    font-size: 40px;
    margin-bottom: 8px;
}

.auth-box h2 {
    text-align: center;
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--fb-border);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
}

.form-control:focus {
    border-color: var(--fb-blue);
    box-shadow: 0 0 0 2px rgba(24,119,242,0.2);
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group { flex: 1; }

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-danger {
    background: #fce8e6;
    color: #c5221f;
    border: 1px solid #f5c2c0;
}

.alert-success {
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #b7e1c1;
}

.alert-warning {
    background: #fef7e0;
    color: #b06000;
    border: 1px solid #fde293;
}

/* ===== Sidebar ===== */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--fb-text);
}

.sidebar-item:hover { background: var(--fb-hover); text-decoration: none; }

.sidebar-item img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

/* ===== Profile ===== */
.profile-header {
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.cover-photo {
    height: 350px;
    background: linear-gradient(135deg, #1877f2, #42b72a);
    background-size: cover;
    background-position: center;
    position: relative;
}

.profile-info {
    display: flex;
    align-items: flex-end;
    padding: 0 24px 16px;
    margin-top: -80px;
    position: relative;
}

.profile-info .avatar-xl {
    box-shadow: 0 0 0 4px white;
}

.profile-name {
    margin-left: 20px;
    margin-bottom: 12px;
}

.profile-name h1 {
    font-size: 32px;
    font-weight: 700;
}

.profile-name p {
    color: var(--fb-secondary);
}

.profile-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

/* ===== Messaging ===== */
.chat-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: calc(100vh - 56px);
    background: white;
}

.chat-list {
    border-right: 1px solid var(--fb-border);
    overflow-y: auto;
}

.chat-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
}

.chat-item:hover, .chat-item.active {
    background: var(--fb-hover);
}

.chat-item .preview {
    flex: 1;
    overflow: hidden;
}

.chat-item .preview .name { font-weight: 600; }
.chat-item .preview .msg {
    font-size: 13px;
    color: var(--fb-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-window {
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--fb-border);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--fb-bg);
}

.message {
    max-width: 65%;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 15px;
    word-break: break-word;
}

.message.sent {
    background: var(--fb-blue);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.received {
    background: white;
    border-bottom-left-radius: 4px;
}

.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--fb-border);
}

.chat-input input {
    flex: 1;
    border: none;
    background: var(--fb-bg);
    border-radius: 20px;
    padding: 10px 16px;
    outline: none;
    font-size: 15px;
}

/* ===== Admin ===== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--fb-border);
}

.admin-table th {
    background: var(--fb-bg);
    font-weight: 600;
}

.status-pending { color: #b06000; font-weight: 600; }
.status-verified { color: var(--fb-green); font-weight: 600; }

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-muted { color: var(--fb-secondary); }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-100 { width: 100%; }

/* Online indicator */
.online-dot {
    width: 10px;
    height: 10px;
    background: var(--fb-green);
    border-radius: 50%;
    border: 2px solid white;
    position: absolute;
    bottom: 0;
    right: 0;
}

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