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

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --accent-color: #ffc107;
    --red:    #e8001e;
    --dark:   #111;
    --gray:   #555;
    --light:  #f5f5f5;
    --border: #e5e5e5;
    --white:  #fff;
}

body {
    font-family: 'Barlow', sans-serif;
    background: var(--white);
    color: var(--dark);
    font-size: 15px;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Download App Button ── */
.btn-app {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--dark);
    color: #fff;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .2px;
    transition: background .2s;
    flex-shrink: 0;
}
.btn-app:hover { background: #333; color: #fff; }

/* ── Profile Dropdown ── */
.profile-wrap { position: relative; }

.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    min-width: 200px;
    z-index: 300;
    overflow: hidden;
    animation: dropIn .15s ease;
}

.profile-dropdown.open { display: block; }

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.profile-dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-dropdown a,
.profile-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background .15s;
}

.profile-dropdown a:hover,
.profile-dropdown button:hover { background: var(--light); }

.profile-dropdown button.logout-btn { color: var(--primary-color); }

/* ── App Download Modal ── */
.app-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.app-modal-overlay.open { display: flex; }

.app-modal {
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    position: relative;
    animation: dropIn .2s ease;
}
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
    flex-shrink: 0;
}

.logo-dot {
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: .6; }
}

.topbar-auth {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-login {
    padding: 6px 16px;
    border: 1.5px solid var(--primary-color);
    border-radius: 6px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 13px;
    transition: all .2s;
}

.btn-login:hover { background: var(--primary-color); color: #fff; }

.btn-register {
    padding: 6px 16px;
    background: var(--primary-color);
    border-radius: 6px;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.user-initial {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Category Nav ── */
.cat-nav {
    background: var(--white);
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }

.cat-nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.cat-nav a {
    display: inline-block;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.cat-nav a:hover,
.cat-nav a.active { color: var(--primary-color); border-bottom-color: var(--primary-color); }

/* ── States Bar ── */
.states-bar {
    background: var(--light);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.states-bar::-webkit-scrollbar { display: none; }

.states-bar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    min-height: 38px;
}

.states-bar a {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray);
    border-radius: 20px;
    transition: all .2s;
}

.states-bar a:hover,
.states-bar a.active { background: var(--primary-color); color: #fff; }

/* ── Cities Bar ── */
.cities-bar {
    background: #fff8f8;
    border-bottom: 1px solid #fde8e8;
    overflow-x: auto;
    scrollbar-width: none;
}
.cities-bar::-webkit-scrollbar { display: none; }

.cities-bar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    min-height: 36px;
}

.cities-bar a {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    color: var(--gray);
    border-radius: 20px;
    transition: all .2s;
    border: 1px solid transparent;
}

.cities-bar a:hover,
.cities-bar a.active { border-color: var(--primary-color); color: var(--primary-color); }

/* ── Container ── */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ── Post Card ── */
.post-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,.1);
    transform: translateY(-2px);
}

.post-card-thumb {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #eee;
    flex-shrink: 0;
}

.post-card-thumb img,
.post-card-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.post-card-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.post-card-cat {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.post-card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-title:hover { color: var(--primary-color); }

.post-card-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    gap: 8px;
}

.post-card-loc {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
}

.post-card-loc span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Section Header ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 2px;
    display: inline-block;
}

.view-more {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
}

/* ── Grid ── */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* ── Page Title ── */
.page-heading {
    padding: 16px 0 8px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.page-heading h1 { font-size: 22px; font-weight: 800; }

.page-heading p {
    font-size: 13px;
    color: var(--gray);
    margin-top: 4px;
}

/* ── Pagination ── */
.pagination-wrap {
    margin-top: 32px;
    display: flex;
    justify-content: center;
}

.pagination-wrap .pagination { display: flex; gap: 4px; list-style: none; }

.pagination-wrap .page-item .page-link {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
}

.pagination-wrap .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* ── No image placeholder ── */
.no-thumb {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
}

/* ── Ad Unit ── */
.ad-unit {
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 90px;
}

/* ── Skeleton ── */
@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.skeleton-img   { height: 180px; width: 100%; }
.skeleton-line  { height: 14px; margin: 8px 16px; }
.skeleton-line.short  { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-line.full   { width: calc(100% - 32px); }
.skeleton-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: inline-block;
}

.skeleton-body { padding: 12px 0 16px; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .topbar-inner { height: 48px; }
}

@media (max-width: 480px) {
    .posts-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

@media (max-width: 640px) {
    #search-form        { display: none !important; }
    #mobile-search-btn  { display: flex !important; }
}

@keyframes topbar-pulse {
    0%, 100% { opacity: 1;  transform: scale(1); }
    50%       { opacity: .4; transform: scale(.7); }
}

/* ── Responsive Top Bar ── */
@media (max-width: 600px) {
    .topbar-menu  { display: none !important; }
}

@media (max-width: 380px) {
    #install-app-btn { padding: 5px 8px; }
}

footer nav::-webkit-scrollbar { display: none; }
