/* ==============================================================
   TamilAds / TamilMarket — Modern Mobile-First Stylesheet
   - Inspired by Facebook Marketplace simplicity
   - Single CSS file, no preprocessor needed
   - Theme color is injected by header.php from per-domain branding
   ==============================================================*/

/* ---------- 1. Reset + design tokens ---------- */
:root {
    /* primary-color and accent-color come from header.php inline */
    --bg:           #f3f4f6;
    --surface:      #ffffff;
    --surface-2:    #f9fafb;
    --text:         #111827;
    --text-muted:   #6b7280;
    --border:       #e5e7eb;
    --border-strong:#d1d5db;
    --success:      #16a34a;
    --danger:       #dc2626;
    --warning:      #f59e0b;
    --shadow-sm:    0 1px 2px rgba(0,0,0,.05);
    --shadow:       0 2px 8px rgba(0,0,0,.06);
    --shadow-lg:    0 12px 32px rgba(0,0,0,.10);
    --radius:       12px;
    --radius-sm:    8px;
    --radius-lg:    16px;
    --header-h:     60px;
    --max-w:        1240px;

    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --font-tamil: 'Noto Sans Tamil', 'Inter', sans-serif;
}
.lang-ta { font-family: var(--font-tamil); }

* { box-sizing: border-box; }
*, *::before, *::after { -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 16px;
}
.site-main {
    min-height: 60vh;
    padding-top: 16px;
    padding-bottom: 48px;
}

/* ---------- 2. Header ---------- */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 16px;
}
.logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.logo-img {
    height: 36px;
    width: auto;
    flex-shrink: 0;
    object-fit: contain;
}
.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}
@media (max-width: 420px) {
    .logo-text { display: none; }
}

.main-nav {
    display: flex;
    gap: 4px;
    margin-left: 12px;
}
.nav-item {
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 500;
    color: var(--text-muted);
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 900px) { .main-nav { display: none; } }

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-switch {
    display: inline-flex;
    background: var(--surface-2);
    border-radius: 999px;
    padding: 3px;
    border: 1px solid var(--border);
}
.lang-btn {
    padding: 4px 9px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.lang-btn.is-active { background: var(--primary-color); color: #fff; }
@media (max-width: 480px) { .lang-switch { display: none; } }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 0;
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform .12s ease, box-shadow .12s ease, background .15s, opacity .15s;
    cursor: pointer;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { filter: brightness(.94); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }

.post-btn .plus-icon {
    font-size: 1.1rem;
    line-height: 1;
    font-weight: 700;
}
@media (max-width: 540px) {
    .post-btn-text { display: none; }
    .post-btn { width: 38px; height: 38px; padding: 0; }
}

.auth-area {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
}
.auth-area .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}
.auth-area .user-name {
    font-size: 0.85rem;
    font-weight: 500;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 720px) {
    .auth-area .user-name { display: none; }
}

.mobile-menu-toggle {
    background: transparent;
    border: 0;
    width: 38px;
    height: 38px;
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    border-radius: 8px;
}
.mobile-menu-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}
@media (max-width: 900px) { .mobile-menu-toggle { display: flex; } }

.mobile-drawer {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    transform: translateY(-120%);
    transition: transform .25s ease;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 90;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}
.mobile-drawer.is-open { transform: translateY(0); }
.mobile-drawer a {
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    background: var(--surface-2);
}
.mobile-drawer a.btn-primary {
    background: var(--primary-color);
    color: #fff;
    text-align: center;
    margin-top: 8px;
}
.mobile-lang-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 16px;
}

/* ---------- 3. Compact Hero ---------- */
.hero-compact {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 18px 16px 16px;
    margin: 8px 0 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.hero-compact h1 {
    font-size: 1.15rem;
    margin: 0 0 2px;
    font-weight: 700;
    line-height: 1.25;
}
.hero-compact p {
    margin: 0 0 10px;
    font-size: 0.82rem;
    opacity: .9;
}
@media (min-width: 720px) {
    .hero-compact { padding: 22px 24px 20px; }
    .hero-compact h1 { font-size: 1.35rem; }
    .hero-compact p { font-size: 0.9rem; }
}

/* Hero search form */
.hero-search {
    display: flex;
    flex-wrap: wrap;
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 5px;
    gap: 4px;
    max-width: 580px;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0,0,0,.10);
}
.hero-search select {
    border: 1px solid var(--border);
    background: var(--surface-2);
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text);
    font-size: 0.82rem;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}
.hero-search input[type="text"] {
    flex: 2;
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text);
    background: #fff;
    outline: none;
    font-size: 0.88rem;
    min-width: 0;
}
.hero-search input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0,0,0,.06);
}
.hero-search button {
    padding: 8px 16px;
    border-radius: 6px;
    border: 0;
    background: #fff;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    border: 2px solid var(--primary-color);
    transition: background .15s, color .15s;
}
.hero-search button:hover { background: var(--primary-color); color: #fff; }
@media (max-width: 540px) {
    .hero-search { border-radius: var(--radius); }
    .hero-search select { flex: 1 1 100%; }
    .hero-search input[type="text"] { flex: 1 1 60%; }
    .hero-search button { flex: 0 0 auto; }
}

.search-row {
    display: flex;
    background: #fff;
    border-radius: 999px;
    padding: 6px;
    gap: 4px;
    max-width: 640px;
    margin: 0 auto;
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.search-row input[type="search"] {
    flex: 1;
    border: 0;
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--text);
    background: transparent;
    outline: none;
    font-size: 0.95rem;
}
.search-row .btn { padding: 10px 18px; }

/* ---------- 4. Category icons grid ---------- */
.section-title {
    margin: 18px 0 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-title a {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--primary-color);
}

.cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
@media (min-width: 540px) { .cat-grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 900px) { .cat-grid { grid-template-columns: repeat(9, 1fr); } }

.cat-tile,
.cat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 4px;
    text-align: center;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    color: var(--text);
}
.cat-tile:hover,
.cat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}
.cat-tile .cat-icon,
.cat-card .cat-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 4px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}
.cat-tile .cat-icon .material-icons,
.cat-card .cat-icon .material-icons {
    font-size: 20px;
    line-height: 1;
}
.cat-tile .cat-icon img,
.cat-card .cat-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.cat-tile .cat-name,
.cat-card .cat-name {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ---------- 5. Ad cards grid ---------- */
.ad-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (min-width: 600px)  { .ad-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .ad-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .ad-grid { grid-template-columns: repeat(5, 1fr); gap: 16px; } }

.ad-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}
.ad-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.ad-card a { display: flex; flex-direction: column; height: 100%; color: inherit; }
.ad-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: var(--surface-2);
}
.ad-card-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 4px;
}
.ad-card-price {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}
.ad-card-price.is-free { color: var(--success); }
.ad-card-title {
    font-size: 0.85rem;
    line-height: 1.35;
    color: var(--text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 2.7em;
}
.ad-card-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    margin-top: auto;
}
.ad-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 0.65rem;
    padding: 3px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
}

#load-more-container { text-align: center; margin: 24px 0; }
#load-more-btn { padding: 12px 28px; }

/* ---------- 6. Forms ---------- */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    max-width: 720px;
    margin: 0 auto;
}
.form-card h1 { margin: 0 0 4px; font-size: 1.45rem; }
.form-card .subtitle { color: var(--text-muted); margin: 0 0 22px; }

.form-field,
.form-group { margin-bottom: 16px; }
.form-field label, .form-field > .label,
.form-group label, .form-group > .label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.form-field .help {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="url"],
.form-field input[type="email"],
.form-field select,
.form-field textarea,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,0,0,.05);
}
.form-row { display: grid; gap: 16px; }
@media (min-width: 720px) { .form-row { grid-template-columns: 1fr 1fr; } }

/* Image picker */
.image-uploader {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.image-uploader:hover { border-color: var(--primary-color); background: #fff; }
.image-uploader input[type="file"] { display: none; }
.image-uploader .upload-icon { font-size: 1.8rem; }

.image-previews {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 12px;
}
@media (max-width: 540px) { .image-previews { grid-template-columns: repeat(3, 1fr); } }
.image-preview {
    position: relative;
    aspect-ratio: 1/1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,.6);
    color: #fff;
    border: 0;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.85rem;
    line-height: 1;
}

/* ---------- 7. Quill rich-text editor ---------- */
.ql-toolbar.ql-snow { border-radius: var(--radius-sm) var(--radius-sm) 0 0; border-color: var(--border-strong); }
.ql-container.ql-snow { border-radius: 0 0 var(--radius-sm) var(--radius-sm); border-color: var(--border-strong); min-height: 220px; font-family: var(--font-sans); font-size: 1rem; background: #fff; }
.ql-editor { min-height: 220px; }
.lang-ta .ql-editor { font-family: var(--font-tamil); }

/* Quill alignment classes (used in stored HTML output) */
.ql-align-center, .view-description .ql-align-center { text-align: center; }
.ql-align-right,  .view-description .ql-align-right  { text-align: right; }
.ql-align-justify, .view-description .ql-align-justify { text-align: justify; }

/* ---------- 8. Video preview ---------- */
.video-embed {
    margin-top: 10px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    position: relative;
    aspect-ratio: 16/9;
}
.video-play-btn {
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    position: relative;
    cursor: pointer;
    display: block;
}
.video-play-btn .video-thumb { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.video-play-btn .video-play-icon {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}
.video-play-btn .video-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,.7);
    color: #fff;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.video-embed iframe { width: 100%; height: 100%; border: 0; }

/* ---------- 9. View ad page ---------- */
.view-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 12px;
}
@media (min-width: 960px) { .view-grid { grid-template-columns: 2fr 1fr; gap: 28px; } }

.view-gallery {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.view-gallery .main-image {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: #f3f4f6;
}
.view-thumbs {
    display: flex;
    gap: 6px;
    padding: 8px;
    overflow-x: auto;
    background: var(--surface-2);
}
.view-thumbs img {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
}
.view-thumbs img.is-active { border-color: var(--primary-color); }

.view-info { padding: 18px 0 0; }
.view-title {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
}
.view-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 6px;
}
.view-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 18px;
}
.view-description {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    word-wrap: break-word;
}
.view-description img { border-radius: var(--radius-sm); margin: 8px 0; }

.view-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: calc(var(--header-h) + 16px);
    align-self: start;
}
.side-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.side-card h3 {
    margin: 0 0 10px;
    font-size: 0.95rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.seller-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}
.seller-row img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}
.seller-row strong { font-weight: 600; }

.share-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.share-row .share-btn {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    color: #fff;
    border: 0;
    font-weight: 600;
}
.share-btn.whatsapp { background: #25D366; }
.share-btn.facebook { background: #1877F2; }
.share-btn.copy     { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.share-btn.copy.is-copied { background: var(--success); color: #fff; }

/* ---------- 10. Footer ---------- */
.site-footer {
    background: #111827;
    color: #d1d5db;
    margin-top: 48px;
    padding: 36px 0 0;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
}
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-col h4 {
    color: #fff;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 10px;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.footer-col a { color: #9ca3af; }
.footer-col a:hover { color: #fff; }
.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
}
.footer-logo img { height: 32px; filter: brightness(1.1); }
.footer-tagline { color: #9ca3af; font-size: 0.85rem; margin: 8px 0 0; }
.footer-contact { font-size: 0.8rem; color: #9ca3af; margin: 4px 0 0; }
.footer-contact a { color: #d1d5db; }
.footer-contact a:hover { color: #fff; }

.footer-bottom {
    margin-top: 22px;
    padding: 16px 0;
    border-top: 1px solid #1f2937;
    text-align: center;
    color: #6b7280;
    font-size: 0.8rem;
}

/* ---------- 11. Misc ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state h2 { color: var(--text); margin-bottom: 8px; }

.loader {
    width: 36px;
    height: 36px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* page wrapper for non-listing pages */
.page-narrow {
    max-width: 760px;
    margin: 0 auto;
    background: var(--surface);
    padding: 30px 28px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.page-narrow h1 { margin-top: 0; }

/* admin layout */
.admin-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
    margin-top: 12px;
}
@media (max-width: 900px) { .admin-shell { grid-template-columns: 1fr; } }
.admin-side {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow-sm);
    align-self: start;
    position: sticky;
    top: calc(var(--header-h) + 16px);
}
.admin-side a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
}
.admin-side a.is-active,
.admin-side a:hover { background: var(--surface-2); color: var(--primary-color); }
.admin-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.stat-card .label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; color: var(--text); margin-top: 2px; }

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
table.admin-table th, table.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
table.admin-table th { background: var(--surface-2); font-weight: 600; }
table.admin-table tr:hover { background: var(--surface-2); }

/* blog */
.blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 720px) { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .blog-grid { grid-template-columns: repeat(3, 1fr); } }
.blog-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}
.blog-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.blog-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.blog-card .body { padding: 14px 16px 18px; }
.blog-card h3 { margin: 0 0 6px; font-size: 1.05rem; line-height: 1.35; }
.blog-card p { margin: 0 0 8px; color: var(--text-muted); font-size: 0.85rem; }
.blog-card .read-more { color: var(--primary-color); font-weight: 600; font-size: 0.85rem; }

.blog-article {
    max-width: 760px;
    margin: 0 auto;
    background: var(--surface);
    padding: 30px 28px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.blog-article h1 { margin-top: 0; font-size: 1.8rem; line-height: 1.25; }
.blog-article .blog-meta { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 18px; }
.blog-article .blog-content { font-size: 1.05rem; line-height: 1.75; }
.blog-article .blog-content img { border-radius: var(--radius-sm); margin: 16px 0; }
.blog-article .blog-content h2 { margin-top: 24px; }

/* ---------- 12. View page (ad detail) ---------- */
.view-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
@media (min-width: 800px) {
    .view-layout { grid-template-columns: 1fr 300px; }
}
.view-gallery { margin-bottom: 16px; }

/* Slideshow */
.slideshow {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: #000;
}
.slideshow-slide {
    display: none;
    animation: slideFadeIn .4s ease;
}
.slideshow-slide.is-active { display: block; }
@keyframes slideFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.view-main-image {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    background: #000;
    border-radius: var(--radius);
}
/* Arrows */
.slide-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,.45);
    color: #fff;
    border: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    backdrop-filter: blur(4px);
}
.slide-arrow:hover { background: rgba(0,0,0,.7); }
.slide-prev { left: 10px; }
.slide-next { right: 10px; }
@media (max-width: 540px) {
    .slide-arrow { width: 34px; height: 34px; font-size: 1rem; }
    .slide-prev { left: 6px; }
    .slide-next { right: 6px; }
}
/* Dots */
.slide-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}
.slide-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 0;
    background: rgba(255,255,255,.5);
    cursor: pointer;
    padding: 0;
    transition: background .2s, transform .2s;
}
.slide-dot.is-active {
    background: #fff;
    transform: scale(1.3);
}
/* Counter */
.slide-counter {
    position: absolute;
    top: 10px;
    right: 12px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    z-index: 5;
    backdrop-filter: blur(4px);
}
/* Thumbs */
.slide-thumb {
    cursor: pointer;
    transition: opacity .15s, border-color .15s;
}
.view-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
}
.view-thumbs img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    opacity: .6;
    transition: opacity .15s;
}
.view-thumbs img.is-active,
.view-thumbs img:hover { opacity: 1; border-color: var(--primary-color); }
.view-title { font-size: 1.5rem; margin: .5rem 0; line-height: 1.3; }
.view-meta-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    font-size: .9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.view-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}
.view-price.is-free { color: var(--success); }
.view-description {
    line-height: 1.75;
    font-size: 1rem;
    margin-bottom: 16px;
}
.view-description img { border-radius: var(--radius-sm); margin: 12px 0; }
.view-share {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: .9rem;
}
.view-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
@media (min-width: 800px) {
    .view-sidebar { position: sticky; top: calc(var(--header-h) + 16px); align-self: start; }
}
.sidebar-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.sidebar-block h3 {
    margin: 0 0 10px;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}
.seller-card {
    display: flex;
    align-items: center;
    gap: 10px;
}
.seller-card .avatar,
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}
.seller-name { font-weight: 600; }

/* ---------- 13. Breadcrumb ---------- */
.breadcrumb {
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.breadcrumb a { color: var(--primary-color); }
.breadcrumb a:hover { text-decoration: underline; }

/* ---------- 14. Material Icons for category grid ---------- */
.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    -webkit-font-smoothing: antialiased;
}
.cat-count {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---------- 15. Admin layout (sidebar) ---------- */
.admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    min-height: 60vh;
}
@media (max-width: 900px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 12px;
}
.admin-sidebar-head {
    padding-bottom: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.admin-sidebar-head strong { display: block; font-size: 1.1rem; }
.admin-sidebar-head small { color: var(--text-muted); font-size: .75rem; word-break: break-all; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.admin-sidebar nav a {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    color: var(--text);
}
.admin-sidebar nav a.is-active,
.admin-sidebar nav a:hover { background: var(--surface-2); color: var(--primary-color); }
.admin-content {
    padding: 20px 24px;
    overflow-x: auto;
}
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.stat-num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--primary-color); }

/* ---------- 16. Blog card body ---------- */
.blog-card-body { padding: 14px 16px 18px; }
.blog-card-body h2,
.blog-card-body h3 { margin: 0 0 6px; font-size: 1.05rem; line-height: 1.35; }
.blog-card-body p { margin: 0 0 8px; color: var(--text-muted); font-size: .85rem; }
.blog-card-body time { font-size: .78rem; color: var(--text-muted); }
.blog-card-image { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.blog-cover { width: 100%; max-height: 400px; object-fit: cover; border-radius: var(--radius); margin-bottom: 1rem; }
.blog-content { font-size: 1.05rem; line-height: 1.75; }
.blog-content img { border-radius: var(--radius-sm); margin: 16px 0; }
.blog-cat { background: var(--surface-2); padding: 2px 8px; border-radius: 4px; font-size: .78rem; }

/* ---------- 17. Page title ---------- */
.page-title { font-size: 1.6rem; margin: 0 0 1rem; }

/* ---------- 18. Ad card actions ---------- */
.ad-card-actions {
    display: flex;
    gap: .5rem;
    padding: .5rem;
    border-top: 1px solid var(--border);
}

/* ---------- 19. Image delete overlay for edit form ---------- */
.image-preview.existing-image { position: relative; }
.img-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(220, 38, 38, .85);
    color: #fff;
    border: 2px solid #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    transition: transform .15s, background .15s;
    z-index: 2;
}
.img-delete-btn:hover { transform: scale(1.15); background: rgba(220, 38, 38, 1); }
.image-preview.is-marked-delete { opacity: .4; }
.image-preview.is-marked-delete img { filter: grayscale(1); }
.image-preview.is-marked-delete .img-delete-btn {
    background: rgba(22, 163, 74, .85);
}
.image-preview.is-marked-delete .img-delete-btn:hover {
    background: rgba(22, 163, 74, 1);
}
.delete-checkbox.hidden { display: none !important; }
.remove-check,
.delete-check {
    display: block;
    font-size: .75rem;
    margin-top: 4px;
    text-align: center;
}

/* ---------- 20. Breadcrumb navigation ---------- */
.breadcrumb { margin-bottom: 12px; font-size: .85rem; }
.breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}
.breadcrumb li { display: flex; align-items: center; gap: 4px; color: var(--text-muted); }
.breadcrumb li + li::before { content: '\203A'; color: var(--text-muted); margin-right: 2px; }
.breadcrumb a { color: var(--primary-color); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb li[aria-current] { color: var(--text); font-weight: 500; }

/* utility */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ---------- 20. Login page (matrimony.fr style) ---------- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem 1rem;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    max-width: 420px;
    width: 100%;
    text-align: center;
}
.login-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    color: #fff;
    font-weight: 800;
    font-size: 1.6rem;
    margin: 0 auto 20px;
}
.login-card h1 {
    font-size: 1.4rem;
    margin: 0 0 8px;
    font-weight: 700;
}
.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 28px;
    line-height: 1.5;
}
.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    font-family: inherit;
}
.btn-google:hover {
    background: var(--surface-2);
    box-shadow: var(--shadow);
}
.btn-google:disabled {
    opacity: .6;
    cursor: not-allowed;
}
.login-privacy {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 20px;
    line-height: 1.5;
}

/* ---------- 21. Marquee scrolling (view page related ads) ---------- */
.marquee-container {
    overflow: hidden;
    position: relative;
    margin: 1rem 0;
}
.marquee-track {
    display: flex;
    gap: 12px;
    animation: marquee-scroll 30s linear infinite;
    width: max-content;
}
.marquee-track:hover {
    animation-play-state: paused;
}
@keyframes marquee-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.marquee-card {
    flex-shrink: 0;
    width: 160px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}
.marquee-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.marquee-card img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: var(--surface-2);
}
.marquee-card .marquee-card-body {
    padding: 8px 10px;
}
.marquee-card .marquee-card-title {
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--text);
}
.category-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.category-filter-bar a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    transition: background .15s, border-color .15s;
}
.category-filter-bar a:hover,
.category-filter-bar a.is-active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* ---------- 22. Share buttons with SVG icons ---------- */
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 0;
    cursor: pointer;
    transition: opacity .15s;
    text-decoration: none;
}
.share-btn:hover { opacity: .85; }
.share-btn svg { flex-shrink: 0; }
.share-btn.whatsapp { background: #25D366; color: #fff; }
.share-btn.facebook { background: #1877F2; color: #fff; }
.share-btn.copy { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.share-btn.copy.is-copied { background: var(--success); color: #fff; border-color: var(--success); }

/* ---------- 23. Back to top button ---------- */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    border: 0;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s, transform .2s;
}
.back-to-top:hover { transform: scale(1.1); }

/* ---------- 24. Toast notification ---------- */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1f2937;
    color: #fff;
    padding: 12px 24px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    transition: opacity .3s, transform .3s;
    pointer-events: none;
}
.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- 25. Accessibility: focus-visible ---------- */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

/* ---------- 26. Print styles ---------- */
@media print {
    .site-header, .site-footer, .mobile-drawer, .back-to-top,
    .share-btn, .load-more-btn, .hero-compact, .post-btn { display: none !important; }
    .site-main { padding: 0; }
    body { background: #fff; }
}
