/* ================================================================
 * 58-category-photo-strip.css — [CATEGORY PHOTO STRIP 2026-11-04]
 * ----------------------------------------------------------------
 * Strip moja ya kategoria zenye PICHA inayotumika kwenye Home pekee
 * (Nyumbani). Inachukua nafasi ya "Kategoria: Bidhaa Zote" +
 * "Gundua Soko" — hivyo sponsored ads zinazoingizwa juu ya feed
 * hazionekani kabla ya kategoria (kategoria zinakuja kwanza).
 *
 * Tab ya Bidhaa/Huduma/Usafiri inaendelea kutumia Category Explorer
 * ile ile ya mfumo; explorer hiyo inapata picha za kategoria
 * (js/app/83-category-photos.js).
 *
 * Ni nyongeza pekee — hakuna CSS iliyoandikwa upya.
 * ================================================================ */

/* ---------- SECTION ---------- */
.cps-section {
    margin: 12px 0 6px;
    padding: 14px 14px 12px;
    background: var(--sokohai-surface);
    border: 1px solid var(--sokohai-border);
    border-radius: 18px;
    position: relative;
    overflow: hidden;
}

/* hairline ya dhahabu juu (mapambo mepesi) */
.cps-section::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg,
        rgba(216, 184, 58, 0), rgba(216, 184, 58, .55) 22%,
        rgba(216, 184, 58, .18) 62%, rgba(216, 184, 58, 0));
    pointer-events: none;
}

.cps-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
}

.cps-title {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: .2px;
    text-transform: uppercase;
    color: var(--skh-ink, #0F2C46);
    white-space: nowrap;
}

.cps-title-bar {
    width: 5px;
    height: 20px;
    border-radius: 3px;
    background: linear-gradient(180deg, #F0D98A, var(--sokohai-gold));
}

.cps-head-rule {
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(90deg, rgba(216, 184, 58, .45), rgba(216, 184, 58, 0));
}

.cps-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--sokohai-green);
    cursor: pointer;
    white-space: nowrap;
}

.cps-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.cps-more:focus-visible { outline: 2px solid var(--sokohai-gold); outline-offset: 3px; border-radius: 6px; }

/* ---------- SCROLLER ---------- */
.cps-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.cps-strip::-webkit-scrollbar { height: 6px; }
.cps-strip::-webkit-scrollbar-thumb { background: rgba(24, 169, 130, .35); border-radius: 999px; }
.cps-strip::-webkit-scrollbar-track { background: transparent; }

/* ---------- CARD ---------- */
.cps-card {
    flex: 0 0 auto;
    width: 152px;
    padding: 0;
    border: 1px solid var(--sokohai-border);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    scroll-snap-align: start;
    box-shadow: 0 2px 8px rgba(15, 44, 70, .05);
    transition: border-color .16s ease, box-shadow .18s ease, transform .16s ease;
    -webkit-tap-highlight-color: transparent;
}

.cps-card:hover {
    border-color: rgba(24, 169, 130, .5);
    box-shadow: 0 8px 20px rgba(15, 44, 70, .12);
    transform: translateY(-2px);
}

.cps-card:active { transform: translateY(0) scale(.99); }
.cps-card:focus-visible { outline: 2px solid var(--sokohai-gold); outline-offset: 2px; }

.cps-card-img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--sokohai-surface-soft);
    line-height: 0;
}

.cps-card-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.cps-card:hover .cps-card-img img { transform: scale(1.04); }

.cps-card-name {
    display: block;
    padding: 9px 6px 10px;
    font-size: 12.5px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--sokohai-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- HALI YA KUCHAGULIWA ---------- */
.cps-card.is-active {
    border-color: var(--sokohai-green);
    box-shadow: 0 0 0 2px rgba(24, 169, 130, .28), 0 10px 22px rgba(24, 169, 130, .18);
}

.cps-card.is-active .cps-card-name {
    color: var(--sokohai-green-dark);
    background: var(--sokohai-green-soft);
}

/* tiki ya uthibitisho */
.cps-card.is-active .cps-card-img::after {
    content: "";
    position: absolute;
    top: 8px; right: 8px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--sokohai-green) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center/14px 14px no-repeat;
    box-shadow: 0 2px 6px rgba(15, 44, 70, .28);
}

.cps-card-img { position: relative; }

/* card ya "Zaidi" */
.cps-card--more {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-style: dashed;
    border-color: rgba(24, 169, 130, .45);
    background: linear-gradient(180deg, #EAF8F2, #F6FCF9 70%, #fff);
    min-height: 150px;
    color: var(--sokohai-green);
}

.cps-card--more .cps-more-ico {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--sokohai-green);
    color: #fff;
}

.cps-card--more b { font-size: 14px; font-weight: 900; }
.cps-card--more:hover { border-color: var(--sokohai-green); }

/* ---------- CATEGORY EXPLORER: picha ---------- */
/* EXPLORER: tumia flex-wrap (deterministic) badala ya grid yenye row-height
   isiyoendana na picha — hivyo hakuna kugongana kwa tiles. */
#categoryModal .cat-grid {
    display: flex !important;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    padding-right: 0;
    align-items: stretch;
}

#categoryModal .cat-grid > .cat-box {
    flex: 0 0 calc((100% - 24px) / 3);
    max-width: calc((100% - 24px) / 3);
}

@media (max-width: 860px) {
    #categoryModal .cat-grid > .cat-box { flex-basis: calc((100% - 12px) / 2); max-width: calc((100% - 12px) / 2); }
}

#categoryModal .cat-box {
    display: flex;
    flex-direction: column;
    height: auto !important;
    min-height: 0;
    padding: 0 !important;
    cursor: pointer;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--sokohai-border);
    transition: transform .15s ease, box-shadow .18s ease, border-color .15s ease;
}

#categoryModal .cat-box:hover {
    transform: translateY(-2px);
    border-color: rgba(24, 169, 130, .5);
    box-shadow: 0 8px 20px rgba(15, 44, 70, .12);
}

#categoryModal .cat-box.is-active {
    border-color: var(--sokohai-green);
    box-shadow: 0 0 0 2px rgba(24, 169, 130, .26);
}

#categoryModal .cat-icon.skh-cat-photo {
    position: relative;
    display: block;
    width: 100% !important;
    height: 118px !important;
    flex: 0 0 auto;
    background: var(--sokohai-surface-soft);
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0;
    overflow: hidden;
    line-height: 0;
}

#categoryModal .cat-icon.skh-cat-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

#categoryModal .cat-box.is-active .cat-icon.skh-cat-photo::after {
    content: "";
    position: absolute;
    top: 6px; right: 6px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--sokohai-green) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center/13px 13px no-repeat;
    box-shadow: 0 2px 6px rgba(15, 44, 70, .28);
}

#categoryModal .cat-name {
    padding: 8px 5px 9px;
    font-size: 11.5px;
    font-weight: 800;
    line-height: 1.2;
    margin-top: auto;
}

/* tile isiyo na picha (ZOTE): ibaki ndogo na ilingane kwa urefu */
#categoryModal .cat-box:not(:has(.skh-cat-photo)) {
    justify-content: center;
    min-height: 158px;
    gap: 6px;
}

#categoryModal .cat-box:not(:has(.skh-cat-photo)) .cat-icon {
    display: flex; align-items: center; justify-content: center;
    width: 54px; height: 54px; margin: 14px auto 0;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
    .cps-section { margin: 10px 0 4px; padding: 12px 10px 10px; border-radius: 16px; }
    .cps-title { font-size: 14px; gap: 7px; }
    .cps-title-bar { height: 17px; width: 4px; }
    .cps-more { font-size: 12px; }
    .cps-card { width: 128px; }
    .cps-card-name { font-size: 11.5px; padding: 8px 5px 9px; }
    .cps-strip { gap: 10px; }
    .cps-card--more { min-height: 132px; }
}

@media (max-width: 400px) {
    .cps-card { width: 116px; }
    .cps-card-name { font-size: 11px; }
    .cps-more-ico, .cps-card--more .cps-more-ico { width: 38px; height: 38px; }
}

/* ---------- SUB-CATEGORY CHIPS: picha ndogo ---------- */
.cps-chip {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    padding-left: 6px !important;
    scroll-behavior: smooth;
}

.cps-chip-ico {
    display: inline-flex;
    width: 24px; height: 24px;
    flex: 0 0 auto;
    border-radius: 7px;
    overflow: hidden;
    background: var(--sokohai-surface-soft);
}

.cps-chip-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* strip ya Home: tembea kwa ulaini */
.cps-strip { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { .cps-strip { scroll-behavior: auto; } }

/* ---------- ENEO LA JUU KABISA SI LA MATANGAZO (Job 13 R5b) ----------
   #topAnnouncement inabaki kwa taarifa za mfumo tu; ikiwa kitupu haichukui nafasi
   na haipati kadi ya tangazo. */
#topAnnouncement:empty,
#topAnnouncement.is-empty,
#topAnnouncement[hidden] {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
}

#topAnnouncement .skh-ann-card,
#topAnnouncement.skh-home-ad {
    display: none !important;
}
