* { box-sizing: border-box; }
html { overflow-x: hidden; }
body {
    margin: 0;
    overflow-x: hidden;
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #f4f6f9;
    color: #222;
}
.navbar {
    background: #1b2a41;
    color: #fff;
    padding: 10px 20px;
}
.navbar-top {
    display: flex;
    align-items: center;
    gap: 12px;
}
.navbar .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 18px; flex-shrink: 0; }
.nav-search { display: flex; flex: 1; max-width: 420px; margin: 0 auto 0 16px; }
.nav-search input {
    margin-bottom: 0;
    border-radius: 6px 0 0 6px;
    border-right: none;
    font-size: 13px;
    padding: 8px 10px;
}
.nav-search button {
    margin-bottom: 0;
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    background: #2563eb;
}
.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    width: auto;
    margin-bottom: 0;
    padding: 4px 8px;
    cursor: pointer;
}
.notif-bell-wrap { position: relative; flex-shrink: 0; }
#notif-bell-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    width: auto;
    margin-bottom: 0;
    padding: 4px 8px;
    cursor: pointer;
    position: relative;
}
.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 5px;
    line-height: 1.4;
}
.notif-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-width: 90vw;
    max-height: 420px;
    overflow-y: auto;
    background: #fff;
    color: #222;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 200;
    margin-top: 6px;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
}
.notif-item {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f2f2f2;
    text-decoration: none;
    color: #222;
    align-items: flex-start;
}
.notif-item:hover { background: #f7f9fc; }
.notif-item.unread { background: #eef4ff; }
.notif-item img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}
.nav-links a {
    color: #cfd8e3;
    text-decoration: none;
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 6px;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,0.08); }
.points-badge {
    background: #ffb703;
    color: #1b2a41;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
}
.page-layout {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    max-width: 1400px;
    margin: 24px auto;
    padding: 0 16px;
}
.left-sidebar {
    width: 190px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 12px 0;
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
}
.left-sidebar a {
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.left-sidebar a:hover { background: #f4f6f9; }
.left-sidebar a.active { background: #eef4ff; border-left-color: #2563eb; color: #2563eb; font-weight: 600; }
.right-sidebar {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 16px;
}
.container { flex: 1; min-width: 0; margin: 0; padding: 0; max-width: none; }
.profile-cover { height: 160px; background-size: cover; background-repeat: no-repeat; }
.profile-header-row {
    padding: 0 20px 16px;
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: -56px;
}
.profile-avatar-img {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    background: #fff;
    flex-shrink: 0;
}
.profile-header-info { flex: 1; min-width: 220px; padding-top: 56px; }
.profile-header-actions { padding-top: 56px; display: flex; gap: 8px; flex-wrap: wrap; }
.profile-stats-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 20px 16px;
    border-top: 1px solid #f0f0f0;
}
.profile-stats-bar > div { margin-right: 10px; }
.profile-stats-bar .stat-sep { color: #ccc; }
@media (max-width: 600px) {
    .profile-header-row { flex-direction: column; align-items: center; text-align: center; margin-top: -40px; }
    .profile-avatar-img { width: 88px; height: 88px; }
    .profile-header-info { padding-top: 0; min-width: 0; width: 100%; }
    .profile-header-actions { padding-top: 10px; justify-content: center; width: 100%; }
    .profile-stats-bar { justify-content: center; padding: 12px; }
}
.list-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.list-row-info { flex: 1; min-width: 140px; }
.list-row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
/* ---- Shorts: fullscreen auto-play scroll-snap vertical feed ---- */
.shorts-fullscreen {
    height: calc(100vh - 160px);
    max-height: 820px;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    border-radius: 12px;
    background: #000;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.shorts-fullscreen::-webkit-scrollbar { display: none; }
.short-item {
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    background: #000;
}
.short-video-wrap { position: relative; width: 100%; height: 100%; cursor: pointer; }
.short-real-video, .short-ad-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}
.short-ad-overlay { position: absolute; inset: 0; background: #000; }
.short-ad-tag {
    position: absolute; top: 12px; left: 12px;
    background: rgba(0,0,0,0.6); color: #fff; font-size: 11px;
    padding: 3px 8px; border-radius: 4px;
}
.short-ad-link { position: absolute; inset: 0; }
.short-ad-skip-btn {
    position: absolute; bottom: 90px; right: 12px; width: auto;
    background: rgba(0,0,0,0.7); color: #fff; border: 1px solid #888; margin: 0;
}
.short-mute-btn {
    position: absolute; top: 12px; right: 12px; width: 40px; height: 40px;
    border-radius: 50%; border: none; background: rgba(0,0,0,0.5); color: #fff;
    font-size: 18px; margin: 0; z-index: 5;
}
.short-center-icon {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 74px; height: 74px; border-radius: 50%;
    background: rgba(0,0,0,0.45); color: #fff;
    align-items: center; justify-content: center;
    font-size: 30px; pointer-events: none; z-index: 4;
}
.short-info-overlay {
    position: absolute; left: 0; right: 60px; bottom: 0;
    padding: 16px; color: #fff;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
}
.short-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; }
.short-username { color: #fff; font-weight: 700; text-decoration: none; }
.short-views { margin-left: auto; font-size: 13px; opacity: 0.9; }
.short-caption { margin: 8px 0 0; font-size: 14px; }
@media (max-width: 700px) {
    .shorts-fullscreen { height: calc(100vh - 120px); border-radius: 0; margin: 0 -10px; }
}

.short-nav-buttons {
    position: absolute;
    right: 14px;
    bottom: 110px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 6;
}
.short-nav-btn {
    width: 40px; height: 40px; border-radius: 50%; border: none;
    background: rgba(0,0,0,0.5); box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    font-size: 15px; color: #fff; cursor: pointer; margin: 0;
}
.short-nav-btn:hover { background: rgba(0,0,0,0.7); }
@media (max-width: 900px) {
    .short-nav-buttons { display: none; } /* touch swipe / scroll-snap works fine on mobile */
}

.auth-page { display: flex; align-items: center; justify-content: center; gap: 32px; min-height: 70vh; flex-wrap: wrap; }
.auth-card { max-width: 400px; width: 100%; margin: 0; }
.auth-illustration { width: 220px; text-align: center; flex-shrink: 0; }
.auth-illustration svg { width: 100%; height: auto; }
.auth-illustration p { color: #6b7280; font-size: 14px; margin-top: 8px; }
@media (max-width: 900px) { .auth-illustration { display: none; } }
.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e6f7ec; color: #1e7e34; border: 1px solid #b7ebc6; }
.alert-error { background: #fdecea; color: #b71c1c; border: 1px solid #f5c6cb; }
input, select, textarea, button {
    font-family: inherit;
    font-size: 16px; /* 16px prevents iOS Safari from auto-zooming on focus */
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #ccd3db;
    width: 100%;
    margin-bottom: 12px;
    max-width: 100%;
}
button, .btn {
    background: #2563eb;
    color: #fff;
    border: none;
    cursor: pointer;
    width: auto;
    display: inline-block;
    text-decoration: none;
    padding: 10px 18px;
    font-size: 14px;
}
button:hover, .btn:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #6b7280; }
.btn-secondary:hover { background: #4b5563; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px 12px; border-bottom: 1px solid #eee; text-align: left; font-size: 14px; }
th { background: #f0f2f5; }
.badge { padding: 3px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.google-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: #fff; color: #444; border: 1px solid #ccc;
}
.chat-wrap { display: flex; height: 500px; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.chat-list { width: 260px; border-right: 1px solid #eee; overflow-y: auto; flex-shrink: 0; }
.chat-list a { display: block; padding: 12px; text-decoration: none; color: #222; border-bottom: 1px solid #f2f2f2; }
.chat-list a.active, .chat-list a:hover { background: #f0f4ff; }
.chat-messages { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.messages-body { flex: 1; overflow-y: auto; padding: 16px; }
.msg { max-width: 70%; margin-bottom: 10px; padding: 8px 12px; border-radius: 10px; font-size: 14px; word-break: break-word; }
.msg.me { background: #2563eb; color: #fff; margin-left: auto; }
.msg.them { background: #eef0f3; color: #222; }
.chat-input { display: flex; padding: 10px; border-top: 1px solid #eee; gap: 8px; }
.chat-input textarea { margin-bottom: 0; resize: none; height: 42px; }
.chat-input button { margin-bottom: 0; }
.small { font-size: 12px; color: #777; }
img { max-width: 100%; }
code.embed { display:block; background:#0d1117; color:#c9d1d9; padding:14px; border-radius:6px; overflow-x:auto; font-size:13px; }

/* ============ Responsive breakpoints ============ */
@media (max-width: 900px) {
    .ads-col { display: none; }
}

@media (max-width: 768px) {
    .navbar-top { flex-wrap: wrap; }
    .nav-search { order: 3; max-width: 100%; margin: 8px 0 0; width: 100%; }
    .notif-bell-wrap { order: 2; margin-left: auto; }
    .notif-dropdown { right: -60px; }
    .nav-toggle { display: block; margin-left: auto; }
    .nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin-top: 10px;
        gap: 2px;
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 10px 12px; }
    .points-badge { align-self: flex-start; margin-bottom: 4px; }

    .container { padding: 0 10px; margin: 14px auto; }
    .card { padding: 14px; }
    h2 { font-size: 20px; }

    .page-layout { flex-direction: column; padding: 0 10px; margin: 14px auto; gap: 10px; }
    .left-sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        position: static;
        padding: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .left-sidebar a { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
    .left-sidebar a.active { border-left-color: transparent; border-bottom-color: #2563eb; }
    .right-sidebar { width: 100%; position: static; order: 99; }
    h3 { font-size: 17px; }

    /* stack any inline flex rows of buttons/info so they don't overflow on narrow screens */
    .card > div[style*="display:flex"] { flex-wrap: wrap; }

    table { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; }

    .messages-body { padding: 10px; }
    .msg { max-width: 85%; }
}

@media (max-width: 700px) {
    .chat-wrap { flex-direction: column; height: auto; }
    .chat-list { width: 100%; max-height: 160px; border-right: none; border-bottom: 1px solid #eee; }
    .chat-messages { height: 420px; }
    #local-video { width: 84px !important; height: 112px !important; bottom: 84px !important; right: 10px !important; }
}

@media (max-width: 480px) {
    .navbar .brand { font-size: 16px; }
    button, .btn { padding: 10px 14px; font-size: 14px; }
    .card { border-radius: 6px; }
}

/* ============ Friends online widget (bottom-right) ============ */
.friends-widget {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 230px;
    background: #fff;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
    z-index: 150;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
}
.friends-widget-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    cursor: pointer;
    background: #1b2a41;
    color: #fff;
    border-radius: 8px 8px 0 0;
    user-select: none;
}
.friends-widget-header .small { color: #9fd8b1; }
.friends-widget-arrow { margin-left: auto; }
.friends-widget-body {
    overflow-y: auto;
    padding: 6px 0;
}
.friends-widget-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    text-decoration: none;
    color: #222;
}
.friends-widget-item:hover { background: #f4f6f9; }
.friends-widget-avatar-wrap { position: relative; flex-shrink: 0; }
.friends-widget-avatar-wrap img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: block; }
.friends-widget-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
}
.friends-widget-dot.online { background: #22c55e; }
.friends-widget-dot.offline { background: #9ca3af; }

@media (max-width: 768px) {
    .friends-widget { right: 10px; width: 180px; max-height: 50vh; }
    .friends-widget-body { display: none; }
}
