/*
 * Company Collection – WordPress Plugin Stylesheet
 *
 * Design tokens translated from the original Nuxt / SCSS design system:
 *   $color-blue-bay-of-many : #253789
 *   $color-white-wild-sand  : #f6f6f6
 *   $color-orange-flamingo  : #ee5e29
 *   $color-white            : #fff
 *   $grid-max-width         : 1320px
 *   $viewport-medium        : 992px
 *   $viewport-small         : 576px
 */

/* ==========================================================================
   1. Reset helpers scoped to the plugin wrapper
   ========================================================================== */
.cc-wrapper *,
.cc-wrapper *::before,
.cc-wrapper *::after {
    box-sizing: border-box;
}

.cc-wrapper button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
}

/* ==========================================================================
   2. Layout – grid helpers
   ========================================================================== */
.cc-main-grid {
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
}

.cc-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -1.2rem;
    margin-right: -1.2rem;
}

/* ==========================================================================
   3. Filter section container
   ========================================================================== */
.cc-filter-section {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

/* ==========================================================================
   4. Filter title  (mirrors .headline-3.color-blue-bay-of-many.c-mb-xl)
   ========================================================================== */
.cc-filter-title {
    color: #253789;
    font-size: clamp(2.4rem, 3vw, 4rem);
    font-weight: 900;
    margin-bottom: 3.2rem;
}

/* ==========================================================================
   6. Map / List toggle  (mirrors .filter-toggle-buttons in FilterSimple.scss)
   ========================================================================== */
.cc-filter-toggle-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.cc-wrapper .cc-filter-toggle-buttons button {
    cursor: pointer;
    color: #253789;
    border: 1px solid #253789;
    background-color: #fff;
    font-size: 1.4rem;
    font-weight: 900;
    width: 10rem;
    padding: 1.3rem 0;
    transition: background-color 0.2s ease, color 0.2s ease;
    line-height: 1;
}

.cc-wrapper .cc-filter-toggle-buttons button:first-child {
    border-radius: 20rem 0 0 20rem;
    border-right: none;
}

.cc-wrapper .cc-filter-toggle-buttons button:last-child {
    border-radius: 0 20rem 20rem 0;
}

.cc-wrapper .cc-filter-toggle-buttons button:hover, .cc-wrapper .cc-filter-toggle-buttons button:focus {
    background-color: inherit;
}

.cc-wrapper .cc-filter-toggle-buttons button.is-active {
    background-color: #253789;
    color: #fff;
}

/* ==========================================================================
   7. Reset filter button  (mirrors .button-reset)
   ========================================================================== */
.cc-filter-bar {
    margin-bottom: 1rem;
    min-height: 3rem;
}

button.cc-reset-btn {
    color: #253789;
    font-size: 1.6rem;
    font-weight: 900;
    display: none !important;
    align-items: center;
    gap: 1.2rem;
    cursor: pointer;
    position: relative;
    top: -1rem;
    background: none;
    border: none;
}

button.cc-reset-btn svg {
    width: 2.4rem;
    height: 2.4rem;
    flex-shrink: 0;
}

/* ==========================================================================
   8. Filter row: tag filters + sort button
   ========================================================================== */
.cc-filter-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 3.2rem;
}

.cc-filter-tags {
    flex: 1 1 auto;
}

.cc-sort-area {
    flex: 0 0 auto;
}

/* Sort only applies to the list; hide while map view is active */
.cc-wrapper[data-cc-active-view="map"] .cc-sort-area {
    display: none;
}

.cc-filter-label {
    color: #253789;
    font-size: 1.4rem;
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1;
}

.cc-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

@media (max-width: 992px) {
    .cc-filter-buttons {
        gap: 1rem;
    }
}

/* ==========================================================================
   9. Buttons  (mirrors .btn-primary, .btn-primary--outline in _buttons.scss)
   ========================================================================== */
button.cc-btn {
    display: inline-block;
    padding: 1rem 2rem 0.9rem;
    border-radius: 20rem;
    font-size: clamp(1.6rem,1.1267605634vw,1.6rem);
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
    text-transform: none !important;
    white-space: nowrap;
}

button.cc-btn.cc-btn--outline {
    border: 0.1rem solid #253789;
    background-color: #fff;
    color: #253789;
}

.cc-btn--capitalize {
    text-transform: capitalize;
}

button.cc-btn.cc-btn--outline.is-selected {
    background-color: #253789;
    color: #fff;
}
button.cc-btn.cc-btn--outline:hover {
    background-color: #3047b1 !important;
    color: #fff;
}

/* Override inherited theme focus styles (e.g. orange focus background) */
button.cc-btn.cc-btn--outline:focus,
button.cc-btn.cc-btn--outline:focus-visible {
    background-color: #fff !important;
    color: #253789 !important;
    border-color: #253789 !important;
    box-shadow: none;
    outline: none;
}

button.cc-btn.cc-btn--outline.is-selected:focus,
button.cc-btn.cc-btn--outline.is-selected:focus-visible {
    background-color: #253789 !important;
    color: #fff !important;
    border-color: #253789 !important;
}

/* Sort button */
button.cc-btn.cc-btn--sort {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    max-height: 3.7rem;
}

button.cc-btn.cc-btn--sort.is-selected {
    background-color: #253789;
    color: #fff;
}

.cc-sort-icon {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}

/* Load more button */
button.cc-btn.cc-btn--load-more {
    background-color: #253789;
    color: #fff;
    text-transform: uppercase;
    padding: 1.2rem 3rem;
    border-radius: 20rem;
    font-size: 1.4rem;
    font-weight: 900;
    margin-top: 4rem;
    display: inline-block;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button.cc-btn.cc-btn--load-more:hover {
    background-color: #ee5e29;
}

/* ==========================================================================
   10. Company card grid
       (mirrors col-sm-4 col-md-3 col-lg-2 col-6  +  .card-logo in CardLogo)
   ========================================================================== */
.cc-list-container {
    margin-bottom: 4rem;
}

/* Grid columns using flexbox (mirrors Bootstrap-like grid) */
.cc-company-grid {
    display: flex;
    flex-wrap: wrap;
    margin-left: -1.2rem;
    margin-right: -1.2rem;
}

.is-grid-item {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
    /* Default: col-6 (2 per row) */
    width: 50%;
    margin-bottom: 2.4rem;
}

/* col-sm-4 → 3 per row at ≥ 576px */
@media (min-width: 576px) {
    .is-grid-item {
        width: 33.3333%;
    }
}

/* col-md-3 → 4 per row at ≥ 768px */
@media (min-width: 768px) {
    .is-grid-item {
        width: 25%;
    }
}

/* col-lg-2 → 6 per row at ≥ 992px */
@media (min-width: 992px) {
    .is-grid-item {
        width: 16.6667%;
    }
}

/* Card logo component (mirrors .card-logo in CardLogo.scss) */
.cc-card-logo {
    display: block;
    text-decoration: none;
    color: inherit;
}

.cc-card-logo__image-wrap {
    background-color: #f6f6f6; /* $color-white-wild-sand */
    padding: 1.2rem;
    margin-bottom: 0.6rem;
    aspect-ratio: 160 / 100; /* Same as card-logo__image */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cc-card-logo__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Placeholder when there is no logo */
.cc-card-logo__image-wrap--empty {
    background-color: #f6f6f6;
}

.cc-card-logo__title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 1.2rem 0;
    min-height: 6rem;
    margin-bottom: 3rem;
    color: #253789;
}

/* ==========================================================================
   11. Map component  (mirrors mapComponent.scss)
   ========================================================================== */
.cc-map-container {
    margin-bottom: 3.2rem;
}

.map-component {
    position: relative;
}

.map {
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 8;
    display: block;
    background: #e8e8e8;
}

@media (max-width: 1024px) {
    .map {
        aspect-ratio: 73 / 128;
        width: 100%;
    }
}

/* Company info sidebar */
.company-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 384px;
    height: 100%;
    background: #253789;
    color: #fff;
    padding: 20px;
    z-index: 5;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.company-sidebar.is-visible {
    opacity: 1;
}

@media (max-width: 1024px) {
    .company-sidebar {
        width: min(100vw - 24px, 384px);
    }
}

.company-sidebar .content-wrap {
    padding-left: 28px;
    padding-right: 28px;
}

.company-sidebar .header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 20px;
}

.company-sidebar .close-btn {
    color: #fff;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
}

.company-sidebar .company-logo {
    background: #fff;
    padding: 20px;
    margin-bottom: 24px;
    border-radius: 4px;
    display: flex;
    max-height: 125px;
    align-items: center;
    justify-content: center;
}

.company-sidebar .company-logo img {
    height: auto;
    max-height: 85px;
    width: auto;
    object-fit: contain;
    max-width: 100%;
}

.company-sidebar h2 {
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
    margin-bottom: 48px;
    color: #fff;
}

.company-sidebar .divider {
    width: 100%;
    max-width: 288px;
    margin-bottom: 40px;
    display: block;
}

.company-sidebar .info-section {
    margin-bottom: 40px;
}

.company-sidebar .info-section .label {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.company-sidebar .info-section .value {
    font-size: 16px;
    font-weight: 500;
}

.company-sidebar .info-section .value a {
    color: #fff;
    text-decoration: none;
}

.company-sidebar .info-section .value a:hover {
    text-decoration: underline;
}

.company-sidebar .read-more-btn {
    display: block;
    width: 100%;
    max-width: 320px;
    padding: 12px 20px;
    border: 2px solid #fff;
    border-radius: 25px;
    background: #fff;
    color: #253789;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.company-sidebar .read-more-btn:hover {
    background: #f0f0f0;
}

/* Map control buttons */
.map-controls {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 4;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

@media (max-width: 768px) {
    .map-controls {
        left: 0;
    }
}

.map-btn {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    background-color: #253789 !important;
    padding: 12px !important;
    color: #fff !important;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.map-btn:hover {
    background-color: #1b2a6e !important;
}

/* Hide OpenLayers default controls (we provide our own) */
.ol-control,
.ol-attribution {
    display: none !important;
}

/* ==========================================================================
   12. Mobile – responsive adjustments
   ========================================================================== */
@media (max-width: 992px) {
    .cc-filter-row {
        flex-direction: column;
    }

    .cc-sort-area {
        width: 100%;
    }

    .cc-btn--sort {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .cc-filter-toggle-buttons {
        justify-content: flex-start;
    }
}
