/* === Visitor Theme Bridge for CFFCS Category/SubCategory Layouts ===
   Purpose:
   - Keeps the existing ASCX layout intact.
   - Makes the existing cff/cffcs classes use the visitor theme variables.
   - Supports both body.theme-* and body.visitor-theme-* naming.
*/

/* Page shell */
.cff-page-wrap,
.cffcs-cat-wrap {
    margin-left: auto;
    margin-right: auto;
    padding: 50px 34px;
    color: var(--visitor-text);
}

/* Header / content panels */
.cff-list-header,
.cff-list-tools,
.cff-result-row,
.cff-empty,
.cff-pager,
.cffcs-cat-card,
.cffcs-cat-card-shell {
    color: var(--visitor-text);
}

.cff-list-header,
.cff-result-row,
.cff-empty,
.cffcs-cat-card {
    border: none !important;
    border-radius: 20px;
    background: color-mix(in srgb, var(--visitor-bg) 94%, #ffffff 6%) !important;
    box-shadow: 0 4px 12px rgba(15,23,42,0.024) !important;
}

.cff-list-header {
    padding: 22px;
    margin-bottom: 18px;
}

.cff-list-header h1,
.cffcs-cat-title,
.cff-result-main h3 {
    color: var(--visitor-text) !important;
}

.cff-list-header p,
.cff-result-main p,
.cffcs-cat-right,
.cff-result-count,
.cff-page-size,
.cffcs-cat-count,
.cff-empty {
    color: var(--visitor-muted) !important;
}

.cff-list-tools {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0;
    padding: 10px 14px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--visitor-bg) 92%, #ffffff 8%) !important;
    box-shadow: 0 3px 10px rgba(15,23,42,0.018);
}

/* Category card grid */
.cffcs-cat-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 15px;
}

.cffcs-cat-card-shell a,
.cff-result-row a {
    display: block;
    color: #666 !important;
    text-decoration: none;
}

.cffcs-cat-card {
    padding: 20px;
}

.cffcs-cat-card,
.cff-result-row {
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.cffcs-cat-card:hover,
.cff-result-row:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--visitor-bg) 88%, #ffffff 12%) !important;
    box-shadow: 0 7px 18px rgba(15,23,42,0.04) !important;
}

.cffcs-cat-left,
.cff-result-row a {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cffcs-cat-left {
    justify-content: space-between;
}

.cffcs-cat-title,
.cff-result-main h3 {
    font-weight: 900;
}

.cffcs-cat-right {
    margin-top: 10px;
    line-height: 1.75;
}

.cffcs-cat-arrow,
.cff-arrow {
    color: var(--visitor-soft);
}

/* SubCategory article list */
.cff-result-list {
    display: grid;
    gap: 12px;
}

.cff-result-row {
    padding: 0;
}

.cff-result-row a {
    padding: 16px 18px;
}

.cff-result-number {
    min-width: 42px;
    min-height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #666;
    background: color-mix(in srgb, var(--visitor-bg) 86%, #ffffff 14%);
    font-weight: 900;
}

.cff-result-main {
    min-width: 0;
    flex: 1;
}

.cff-result-main h3 {
    margin: 0 0 6px;
}

.cff-result-main p {
    margin: 0;
    line-height: 1.7;
}

.cff-result-action {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--visitor-soft);
    font-size: .9em;
    white-space: nowrap;
}

/* Pager */
.cff-pager {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 28px;
}

.cff-pager a,
.cff-pager span {
    padding: 10px 14px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--visitor-bg) 92%, #ffffff 8%) !important;
    color: #666 !important;
    font-weight: 800;
    text-decoration: none;
}

.cff-pager .active,
.cff-pager .selected,
.cff-pager .current {
    background: #666 !important;
    color: #ffffff !important;
}

/* Admin / tag rows already use visitor classes, this keeps CFF aliases aligned. */
.cff-admin-row,
.cff-tag-row,
.cff-location-bar,
.cff-top-nav {
    color: var(--visitor-soft);
}

/* Dark theme */
body.theme-dark .cff-list-header,
body.theme-dark .cff-result-row,
body.theme-dark .cff-empty,
body.theme-dark .cffcs-cat-card,
body.visitor-theme-dark .cff-list-header,
body.visitor-theme-dark .cff-result-row,
body.visitor-theme-dark .cff-empty,
body.visitor-theme-dark .cffcs-cat-card {
    background: #080b13 !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.22) !important;
}

body.theme-dark .cff-list-tools,
body.theme-dark .cff-result-number,
body.theme-dark .cff-pager a,
body.theme-dark .cff-pager span,
body.visitor-theme-dark .cff-list-tools,
body.visitor-theme-dark .cff-result-number,
body.visitor-theme-dark .cff-pager a,
body.visitor-theme-dark .cff-pager span {
    background: #0a0e18 !important;
}

body.theme-dark .cffcs-cat-card:hover,
body.theme-dark .cff-result-row:hover,
body.visitor-theme-dark .cffcs-cat-card:hover,
body.visitor-theme-dark .cff-result-row:hover {
    background: #0a0e18 !important;
}

/* Mobile */
@media screen and (max-width: 900px) {
    .cffcs-cat-grid {
        grid-template-columns: 1fr;
    }

    .cff-result-row a {
        align-items: flex-start;
    }

    .cff-result-action {
        display: none;
    }
}

@media screen and (max-width: 620px) {
    .cff-page-wrap,
    .cffcs-cat-wrap {
        padding: 28px 18px;
    }

    .cff-list-tools {
        flex-direction: column;
    }

    .cffcs-cat-left,
    .cff-result-row a {
        align-items: flex-start;
    }
}
/* === End Visitor Theme Bridge for CFFCS Category/SubCategory Layouts === */
