/* ===== DIRECTORY WRAPPER ===== */
.cdb-directory-wrapper {
    max-width: 90%;
    margin: 0 auto;
    padding: 20px;
}

/* ===== SEARCH BAR ===== */
.cdb-directory-search {
    margin-bottom: 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#cdb-search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 0;
    font-size: 15px;
}

.cdb-search-btn,
.cdb-clear-btn {
    padding: 12px 24px;
    border: none;
    border-width: 0px !important;
    border-radius: 0px;
    font-size: 12px;
    font-family: 'Figtree', Helvetica, Arial, Lucida, sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 0px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.cdb-search-btn {
    background-color: #333C60 !important;
    color: #FFFFFF !important;
}

.cdb-search-btn:hover {
    background-color: #4A8189 !important;
}

.cdb-clear-btn {
    background: #e0e0e0;
    color: #333;
}

.cdb-clear-btn:hover {
    background: #d0d0d0;
}

/* ===== DIRECTORY CONTAINER ===== */
.cdb-directory-container {
    display: flex;
    gap: 30px;
    position: relative;
}

/* ===== FILTERS SIDEBAR - C3 STYLE ===== */
.cdb-directory-filters {
    flex: 0 0 280px;
    background: #fff;
    padding: 0;
    border: none;
    height: fit-content;
    position: sticky;
    top: 20px;
}

/* Hide mobile dropdowns on desktop */
.cdb-mobile-filter-select {
    display: none;
}

/* Hidden filter items */
.cdb-hidden-filter {
    display: none !important;
}

.cdb-directory-filters h3 {
    margin: 0;
    padding: 15px 20px;
    font-size: 16px;
    color: #333;
    background: #f5f5f5;
    border-bottom: none;
    font-weight: 600;
    font-family: 'Lato', Helvetica, Arial, Lucida, sans-serif;
}

.cdb-filter-group {
    padding: 20px;
    border-bottom: none;
}

.cdb-filter-group:last-child {
    border-bottom: none;
}

.cdb-filter-group h4 {
    margin: 0 0 15px 0;
    font-size: 13px;
    color: #666;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Lato', Helvetica, Arial, Lucida, sans-serif;
}

.cdb-filter-options {
    max-height: none; /* Remove max height - full height like C3 */
    overflow-y: visible;
}

.cdb-filter-item {
    margin-bottom: 12px;
    border-bottom: 1px solid #e8e8e8 !important;
    padding: 5px 0;
}

.cdb-filter-item label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    line-height: 1.4;
    position: relative;
    padding-left: 35px !important;
    top: -1px;
    font-family: 'Lato', Helvetica, Arial, Lucida, sans-serif;
}

/* Custom Checkbox Styling - C3 Style */
.cdb-filter-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 25px;
    height: 25px;
    border: none;
    border-radius: 0;
    margin: 0 10px 0 0;
    cursor: pointer;
    flex-shrink: 0;
    position: absolute !important;
    top: -5px;
    left: 0;
    background: #ededed;
    transition: all 0.2s ease;
}

.cdb-filter-item input[type="checkbox"]:checked {
    background-color: #333C60 !important;
    border-color: #333C60;
}

.cdb-filter-item input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
}

.cdb-filter-item label:hover {
    color: #333;
}

/* Indentation for hierarchical terms */
.cdb-filter-item[style*="margin-left"] {
    position: relative;
}

/* Hierarchy Level Classes */
.cdb-filter-item.cdb-level-0 {
    /* Top-level parent */
}

.cdb-filter-item.cdb-level-1 {
    /* First-level child */
}

.cdb-filter-item.cdb-level-2 {
    /* Second-level child (grandchild) */
}

.cdb-filter-item.cdb-level-3 {
    /* Third-level child (great-grandchild) */
}

/* Services Filter - Top Level Parents Only */
.cdb-filter-item.cdb-services-filter.cdb-parent input[type="checkbox"] {
    display: none !important; /* Hide checkbox */
}

.cdb-filter-item.cdb-services-filter.cdb-parent label {
    padding-left: 0 !important; /* Remove left margin space */
    font-weight: 700 !important; /* Bold */
    text-transform: uppercase !important; /* Uppercase */
    letter-spacing: 0.5px;
    color: #333 !important;
}

/* ===== DIRECTORY CONTENT ===== */
.cdb-directory-content {
    flex: 1;
    min-width: 0;
}

.cdb-directory-content.cdb-full-width {
    flex: 1 1 100%;
}

.cdb-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e8e8e8;
}

.cdb-results-count {
    font-size: 15px;
    color: #666;
}

#cdb-results-number {
    font-weight: 600;
    color: #4A8189;
    line-height: 1em;
}

/* ===== DIRECTORY GRID ===== */
.cdb-directory-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* ===== DIRECTORY ITEM - C3 CARD STYLE ===== */
.cdb-directory-item {
    background: #fff;
    border: none;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    box-shadow: 0px 2px 40px -15px rgba(0, 0, 0, 0.3) !important;
    padding-top: 3% !important;
    padding-right: 8% !important;
    padding-bottom: 3% !important;
    padding-left: 8% !important;
    border-radius: 8px !important;
}

.cdb-directory-item:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Title and Logo Row */
.cdb-item-header-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-bottom: none;
    padding-top: 30px;
}

.cdb-item-title-col {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.cdb-item-title {
    margin: 0;
    font-size: 20px !important;
    line-height: 1.3;
    color: #333;
    font-weight: 600;
    font-family: 'Lato', Helvetica, Arial, Lucida, sans-serif;
}

.cdb-item-logo-col {
    flex: 1;
    display: flex;
    justify-content: flex-end !important;
}

.cdb-item-logo-img {
    max-width: 200px;
    height: auto;
    display: block;
    max-height: 100px;
}

/* Item Body */
.cdb-item-body {
    padding: 20px 0;
}

.cdb-item-description {
    margin-bottom: 15px;
    color: #000000 !important;
    font-size: 15px !important;
    line-height: 1.6;
    font-family: 'Lato', Helvetica, Arial, Lucida, sans-serif;
    font-weight: 500 !important;
}

.cdb-item-meta {
    margin-bottom: 15px;
}

.cdb-item-meta p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #007575 !important;
    font-family: 'Lato', Helvetica, Arial, Lucida, sans-serif;
}

.cdb-meta-label {
    font-weight: 700;
    color: #333;
    font-family: 'Lato', Helvetica, Arial, Lucida, sans-serif;
}

/* More Info Button */
.cdb-item-button-row {
    margin-top: 30px;
}

.cdb-more-info-btn {
    display: inline-block;
    padding: 15px 20px;
    background-color: #333C60 !important;
    color: #FFFFFF !important;
    border: none;
    border-width: 0px !important;
    border-radius: 0px;
    cursor: pointer;
    font-size: 12px !important;
    font-family: 'Figtree', Helvetica, Arial, Lucida, sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px;
    transition: background 0.3s ease;
    text-transform: uppercase;
    margin-top: 10px;
}

.cdb-more-info-btn:hover {
    background-color: #4A8189 !important;
}

/* ===== NO RESULTS ===== */
.cdb-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
}

.cdb-no-results p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* ===== PAGINATION ===== */
.cdb-directory-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f5f5f5;
}

.cdb-page-btn {
    padding: 10px 20px;
    background-color: #333C60 !important;
    color: #FFFFFF !important;
    border: none;
    border-width: 0px !important;
    border-radius: 0px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Figtree', Helvetica, Arial, Lucida, sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 0px;
    transition: background 0.3s ease;
}

.cdb-page-btn:hover:not(:disabled) {
    background-color: #4A8189 !important;
}

.cdb-page-btn:disabled {
    background: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.cdb-page-info {
    font-size: 14px;
    color: #666;
}

/* ===== LOADING OVERLAY ===== */
.cdb-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.cdb-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e8e8e8;
    border-top: 4px solid #4A8189;
    border-radius: 50%;
    animation: cdb-spin 1s linear infinite;
}

@keyframes cdb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== MODAL OVERLAY ===== */
.cdb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cdb-modal-container {
    background: #fff;
    max-width: 1080px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    z-index: 100000 !important;
}

/* Scrollbar styling for better visibility */
.cdb-modal-container::-webkit-scrollbar {
    width: 10px;
}

.cdb-modal-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cdb-modal-container::-webkit-scrollbar-thumb {
    background: #4A8189;
    border-radius: 5px;
}

.cdb-modal-container::-webkit-scrollbar-thumb:hover {
    background: #3a6a71;
}

.cdb-modal-close {
    position: absolute; /* Back to absolute - relative to modal container */
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: #4A8189;
    transition: color 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
}

.cdb-modal-close:hover {
    color: #333;
}

.cdb-modal-content-wrapper {
    padding: 6% !important;
    border-radius: 8px !important;
}

.cdb-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

/* ===== MODAL TOP ROW - Title and Logo ===== */
.cdb-modal-top-row {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.cdb-modal-title-col {
    flex: 1;
    min-width: 0;
}

.cdb-modal-title {
    margin: 0 0 20px 0;
    font-size: 26px;
    color: #333;
    font-weight: 600;
    line-height: 1.3;
}

.cdb-modal-content-area {
    color: #000;
    font-size: 14px !important;
    line-height: 1.7;
}

.cdb-modal-content-area p {
    margin-bottom: 15px;
}

.cdb-modal-content-area ul {
    margin: 15px 0;
    padding-left: 20px;
}

.cdb-modal-content-area li {
    margin-bottom: 8px;
}

.cdb-modal-content-area a {
    color: #007575 !important;
    text-decoration: none;
}

.cdb-modal-content-area a:hover {
    text-decoration: underline;
}

.cdb-modal-logo-col {
    flex-shrink: 0;
    width: 30%;
    min-width: 200px;
}

.cdb-modal-logo-img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 20px;
}

.cdb-modal-taxonomies {
    margin-top: 20px;
}

.cdb-modal-tax-item {
    margin-bottom: 12px;
}

.cdb-modal-tax-item p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #000;
}

.cdb-modal-tax-label {
    font-weight: 700;
    color: #333;
}

/* ===== MODAL BOTTOM ROW - Fields and Actions ===== */
.cdb-modal-bottom-row {
    display: flex;
    gap: 30px;
    padding-top: 25px;
    border-top: 1px solid #e8e8e8;
}

.cdb-modal-fields-col {
    flex: 1;
    min-width: 0;
}

.cdb-modal-field-item {
    margin-bottom: 12px;
}

.cdb-modal-field-item p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.cdb-modal-field-label {
    font-weight: 700;
    color: #333;
}

.cdb-modal-field-item a {
    color: #4A8189;
    text-decoration: none;
}

.cdb-modal-field-item a:hover {
    text-decoration: underline;
}

.cdb-modal-website-btn-wrap {
    margin-top: 25px;
}

.cdb-visit-website-btn {
    display: inline-block;
    padding: 12px 25px;
    background-color: #333C60 !important;
    color: #FFFFFF !important;
    text-decoration: none;
    border: none;
    border-width: 0px !important;
    border-radius: 0px;
    font-size: 12px;
    font-family: 'Figtree', Helvetica, Arial, Lucida, sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 0px;
    text-transform: uppercase;
    transition: background 0.3s ease;
}

.cdb-visit-website-btn:hover {
    background-color: #4A8189 !important;
    color: #FFFFFF !important;
}

.cdb-modal-spacer-col {
    flex: 0 0 100px;
}

/* ===== TABLET RESPONSIVE ===== */
@media screen and (max-width: 1024px) {
    .cdb-directory-filters {
        flex: 0 0 240px;
    }
    
    .cdb-item-logo-col {
        width: 100px;
    }
}

/* ===== MOBILE RESPONSIVE ===== */
@media screen and (max-width: 768px) {
    .cdb-directory-container {
        flex-direction: column;
    }
    
    .cdb-directory-filters {
        flex: 1;
        position: static;
        margin-bottom: 0px;
        width: 100%;
        padding: 0;
    }
    
    /* Update filter group padding and remove border on mobile */
    .cdb-filter-group {
        padding: 0;
        border-bottom: none;
        margin-bottom: 10px;
        width: 100%;
    }
    
    /* Hide Filter By title on mobile */
    .cdb-directory-filters h3 {
        display: none;
    }
    
    /* Hide taxonomy headings on mobile */
    .cdb-filter-group h4 {
        display: none;
    }
    
    /* Hide checkbox filters on mobile */
    .cdb-filter-options {
        display: none;
    }
    
    /* Show and style mobile dropdown selects */
    .cdb-mobile-filter-select {
        display: block;
        width: 100%;
        padding: 14px 40px 14px 15px;
        border: 1px solid #ddd;
        border-radius: 0;
        font-size: 16px;
        background: #ffffff;
        color: #000000;
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"%3E%3Cpath fill="%23000000" d="M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z"/%3E%3C/svg%3E');
        background-repeat: no-repeat;
        background-position: right 15px center;
        background-size: 12px;
        margin: 0;
        box-sizing: border-box;
    }
    
    .cdb-mobile-filter-select:focus {
        outline: 2px solid #4A8189;
        outline-offset: -2px;
        border-color: #4A8189;
    }
    
    .cdb-directory-grid {
        grid-template-columns: 1fr;
    }
    
    .cdb-directory-search {
        flex-direction: column;
    }
    
    #cdb-search-input,
    .cdb-search-btn,
    .cdb-clear-btn {
        width: 100%;
    }
    
    /* Stack title and logo on mobile */
    .cdb-item-header-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .cdb-item-logo-col {
        width: 150px;
        margin-top: 15px;
    }
    
    /* Modal mobile adjustments */
    .cdb-modal-top-row {
        flex-direction: column-reverse;
    }
    
    .cdb-modal-logo-col {
        width: 100%;
        text-align: center;
        margin-bottom: 20px;
    }
    
    .cdb-modal-logo-img {
        margin: 0 auto 20px;
        max-width: 200px;
    }
    
    .cdb-modal-bottom-row {
        flex-direction: column;
    }
    
    .cdb-modal-spacer-col {
        display: none;
    }
    
    .cdb-modal-container {
        margin: 10px;
        max-height: 95vh;
    }
    
    .cdb-modal-content-wrapper {
        padding: 30px 20px;
    }
    
    .cdb-modal-title {
        font-size: 22px;
    }
}

/* ===== SMALL MOBILE ===== */
@media screen and (max-width: 480px) {
    .cdb-directory-wrapper {
        padding: 15px;
    }
    
    .cdb-item-header-row,
    .cdb-item-body {
        padding: 15px;
    }
    
    .cdb-item-title {
        font-size: 17px;
    }
    
    .cdb-directory-pagination {
        flex-wrap: wrap;
    }
}
