/*
 * CC Service Explorer — frontend.css
 *
 * Two states:
 *  - Default (no JS): full semantic list, all descriptions visible.
 *  - .cc-exp-js active: interactive card grid — descriptions hidden
 *    until a card is clicked (.cc-exp-sel).
 */

/* ── Controls (search + filters) ───────────────────────────────────────── */

.cc-exp-controls {
    display: none; /* hidden until JS injects content */
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1rem;
}

.cc-exp-js .cc-exp-controls {
    display: flex;
}

.cc-exp-search {
    width: 100%;
    max-width: 380px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a1a;
    background: #fff;
    box-sizing: border-box;
}

.cc-exp-search:focus {
    outline: none;
    border-color: #6b4b95;
    box-shadow: 0 0 0 2px rgba(107,75,149,0.12);
}

.cc-exp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cc-exp-filter-btn {
    padding: 5px 13px;
    border-radius: 20px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid #bbb;
    background: transparent;
    color: #555;
    transition: background 0.15s, color 0.15s;
    line-height: 1.5;
}

.cc-exp-filter-btn.active {
    background: #6b4b95;
    border-color: #6b4b95;
    color: #fff;
}

/* ── Count display ──────────────────────────────────────────────────────── */

.cc-exp-count {
    font-size: 12px;
    color: #888;
    margin: 0 0 1rem;
}

/* ── Category sections ──────────────────────────────────────────────────── */

.cc-exp-cat {
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.cc-exp-cat-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    background: #f8f8f8;
    border-bottom: 1px solid #e5e5e5;
}

/* Clickable heading in JS mode */
.cc-exp-js .cc-exp-cat-heading {
    cursor: pointer;
    user-select: none;
}

.cc-exp-js .cc-exp-cat-heading:hover {
    background: #f0f0f0;
}

.cc-exp-cat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    /* background set inline via server-rendered style */
}

.cc-exp-cat-count {
    font-size: 12px;
    font-weight: 400;
    color: #888;
    background: #eee;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

.cc-exp-chevron {
    font-size: 10px;
    color: #aaa;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.cc-exp-cat.cc-exp-collapsed .cc-exp-chevron {
    transform: rotate(-90deg);
}

/* ── Collapse: hide cards when collapsed ─────────────────────────────────── */

.cc-exp-js .cc-exp-cat.cc-exp-collapsed .cc-exp-cards {
    display: none;
}

/* ── Service card grid ───────────────────────────────────────────────────── */

.cc-exp-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    padding: 12px;
    list-style: none;
    margin: 0;
}

.cc-exp-service {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px 14px;
    transition: border-color 0.15s ease;
}

/* Clickable in JS mode */
.cc-exp-js .cc-exp-service {
    cursor: pointer;
}

.cc-exp-js .cc-exp-service:hover {
    border-color: #bbb;
}

.cc-exp-svc-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 4px;
    line-height: 1.4;
}

.cc-exp-svc-type {
    font-size: 11px;
    color: #888;
    display: block;
    margin-bottom: 6px;
}

/* Description: always visible without JS; hidden by default with JS */

.cc-exp-svc-desc {
    font-size: 13px;
    color: #555;
    line-height: 1.65;
    margin: 0;
}

.cc-exp-js .cc-exp-svc-desc {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

/* Show description when card is selected */
.cc-exp-js .cc-exp-service.cc-exp-sel {
    border-color: currentColor; /* overridden inline per category colour */
    border-width: 1.5px;
}

.cc-exp-js .cc-exp-service.cc-exp-sel .cc-exp-svc-desc {
    display: block;
}

/* ── No results message ──────────────────────────────────────────────────── */

.cc-exp-no-results {
    font-size: 14px;
    color: #888;
    padding: 2rem;
    text-align: center;
}

/* ── Print ───────────────────────────────────────────────────────────────── */

@media print {
    .cc-exp-controls,
    .cc-exp-count,
    .cc-exp-chevron { display: none !important; }

    .cc-exp-js .cc-exp-svc-desc { display: block !important; }
    .cc-exp-js .cc-exp-cat.cc-exp-collapsed .cc-exp-cards { display: grid !important; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .cc-exp-cards {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 360px) {
    .cc-exp-cards {
        grid-template-columns: 1fr;
    }
}
