/* ==========================================================================
   CLOSEST LOCATION PLUGIN STYLES
   ========================================================================== */

/* ==========================================================================
   1. CSS CUSTOM PROPERTIES (Variables)
   ========================================================================== */
:root {
    /* Brand Colors */
    --primary-color: #2b448b;
    --secondary-color: #6c757d;
    
    /* Status Colors */
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    
    /* Neutral Colors */
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --white-color: #ffffff;
    --black-color: #000000;
    --blue-color: #0d6efd;
    
    /* Gray Scale */
    --gray-light: #e9ecef;
    --gray-medium: #666666;
    --gray-border: #eee;
    --gray-background: #f9f9f9;
    
    /* Links */
    --link-color: #0073aa;

    --freshpoint-green: #83b135;
}

/* ==========================================================================
   2. BASE LAYOUT & CONTAINER STYLES
   ========================================================================== */
#top-menu-nav:has(#cl-location-dropdown) {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
}

#cl-location-dropdown {
    margin: 0px;
    width: 100%;
    padding: 0px !important;
}

#cl-location-dropdown .row {
    margin: 0px !important;
}

#cl-location-select {
    padding: 5px;
    min-width: 250px;
    max-width: 100%;
}

#cl-find-closest {
    padding: 5px 15px;
    display: none;
}

#cl-closest-result {
    margin-top: 15px;
    font-weight: bold;
    display: none;
}

/* ==========================================================================
   3. DROPDOWN WRAPPER & ICON STYLES
   ========================================================================== */
.cl-dropdown-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

.cl-dropdown-wrapper .select2-container {
    flex: 1;
}

/* Search Icon */
.cl-search-icon,
.cl-search-icon:disabled {
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    padding: 6px !important;
    width: 30px;
    height: 30px;
    border: 1px solid var(--primary-color);
    background-color: var(--primary-color);
    color: var(--white-color);
}

.cl-search-icon svg {
    width: 16px;
    height: 16px;
    fill: var(--white-color);
    transition: all 0.2s ease;
    opacity: 0.8;
}

.cl-search-icon:hover,
.cl-search-icon:disabled {
    opacity: 1;
}

/* ==========================================================================
   4. HEADER & INFO TEXT STYLES
   ========================================================================== */
#db-info-text:has(#cl-location-dropdown) {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
}

#db-info-text:has(#cl-location-dropdown) .header-button {
    margin: 0px !important;
    min-width: fit-content;
    padding: 5px 10px !important;
}

#top-info .textwidget {
    justify-content: flex-end;
}

/* ==========================================================================
   5. MODAL STYLES
   ========================================================================== */
.modal.show {
    z-index: 109999955;
}

.modal-backdrop {
    z-index: 99998;
}

.modal.show .modal-dialog {
    transform: translateY(-50%);
    top: 50%;
}

/* Body states when modal is open/closed */
body.modal-open {
    overflow: hidden;
}

body:not(.modal-open) .modal-backdrop {
    display: none !important;
}

/* Modal Content */
#cl-location-modal .modal-title {
    color: var(--black-color);
    z-index: 99999;
}

.modal-body li,
.modal-body p.text-muted {
    margin-top: 10px;
}

/* ==========================================================================
   6. SELECT2 BASE STYLES
   ========================================================================== */

.cl-shop li{
    margin-bottom: 0px !important;
}

#cl-location-dropdown .select2-container {
    width: 80% !important;
}

.select2-container {
    max-width: 100% !important;
}

.select2-container--open .select2-dropdown {
    z-index: 99999;
}

.select2-results__options {
    max-height: 300px;
}

/* Selection Box */
.select2-container--default .select2-selection--single {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 20px;
    color: var(--black-color) !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--gray-medium) !important;
}

/* Dropdown */
.select2-dropdown {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* Options */
.select2-container--default .select2-results__option {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    color: var(--black-color) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-color) !important;
    color: var(--white-color) !important;
}

.cl-shop.select2-container--default .select2-results__option--highlighted{
    background-color: var(--freshpoint-green) !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--gray-light) !important;
    color: var(--black-color) !important;
}

.cl-shop.select2-container--default .select2-results,
.cl-shop.select2-container--default .select2-results #select2-cl-location-select-results,
.cl-shop.select2-container--default .select2-dropdown{
    border-color: var(--freshpoint-green) !important;
    border-radius: 5px !important;
}

/* ==========================================================================
   7. BUTTON STYLES
   ========================================================================== */
.btn-corporate {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--white-color) !important;
}

.btn-corporate:hover {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--white-color) !important;
    opacity: 0.9;
}

/* ==========================================================================
   8. OSM ATTRIBUTION FOOTER
   ========================================================================== */
#cl-osm-attribution {
    text-align: center;
    padding: 15px 0;
    font-size: 12px;
    color: var(--gray-medium);
    border-top: 1px solid var(--gray-border);
    background-color: var(--gray-background);
}

#cl-osm-attribution a {
    color: var(--link-color);
    text-decoration: none;
}

#cl-osm-attribution a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   9. SHOP BUTTON LAYOUT
   Enabled via settings page
   ========================================================================== */
.cl-shop-layout {
    width: auto !important;
    display: inline-block;
}

/* Hide the search icon in shop layout */
.cl-shop-layout .cl-search-icon {
    display: none !important;
}

/* Style Select2 as a button */
.cl-shop-layout .select2-container {
    width: auto !important;
    min-width: 120px;
}

.cl-shop-layout .select2-container--default .select2-selection--single {
    background-color: #8fb146;
    background-image: url(../images/bk-green.png);
    background-position: 0 100%;
    background-repeat: repeat-x;
    border: none;
    border-radius: 5px;
    height: 30px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cl-shop-layout .select2-container--default .select2-selection--single:hover {
    background-color: #f4722b;
    background-image: url(../images/bk-orange.png);
}

/* Shop Layout Text Styling */
.cl-shop-layout .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #ffffff !important;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 0;
    line-height: 30px;
}

.cl-shop-layout .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #ffffff !important;
}

/* Shop Layout Arrow Styling */
.cl-shop-layout .select2-container--default .select2-selection--single .select2-selection__arrow {
    position: relative;
    top: auto;
    right: auto;
    height: auto;
    width: auto;
    margin-left: 10px;
}

.cl-shop-layout .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #ffffff transparent transparent transparent;
    border-width: 5px 4px 0 4px;
    position: relative;
    top: auto;
    left: auto;
    margin: 0;
    float: left;
}

.cl-shop-layout .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #ffffff transparent;
    border-width: 0 4px 5px 4px;
}

/* Shop Layout Dropdown (now appended to body) */
.select2-container--cl-shop .select2-dropdown {
    width: auto !important;
    min-width: 350px !important;
    margin-top: 5px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 109999999 !important;
    font-family: inherit;
}

.select2-container--cl-shop .select2-results__option {
    white-space: nowrap !important;
    font-size: 14px;
}


/* Hide search and clear button in shop layout */
.cl-shop-layout .select2-selection__clear,
.select2-container--cl-shop .select2-search {
    display: none !important;
}

.cl-shop .select2-dropdown{
   max-width: 250px !important;
    position: relative !important;
    left: 0px !important;
    transform: translateX(-25%);
}

/* ==========================================================================
   10. MEDIA QUERIES
   ========================================================================== */

/* Medium screens and below (1100px) */
@media screen and (max-width: 1100px) {
    #db-info-text:has(#cl-location-dropdown) {
        flex-direction: column-reverse;
    }
}

/* Tablet screens (768px) */
@media screen and (max-width: 768px) {
    .cl-dropdown-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    
    #cl-location-dropdown .select2-container {
        width: 100% !important;
    }
    
    .cl-shop-layout .select2-container {
        min-width: 100px;
    }
}

/* Mobile screens (480px) */
@media screen and (max-width: 480px) {
    #cl-location-select {
        min-width: 100%;
    }
    
    .cl-shop-layout .select2-container--default .select2-selection--single {
        padding: 6px 12px;
    }
    
    .cl-shop-layout .select2-container--default .select2-selection--single .select2-selection__rendered {
        font-size: 13px;
    }
}

/* ==========================================================================
   11. THEME SPECIFIC OVERRIDES (Moved from theme custom.css)
   ========================================================================== */
#cl-location-dropdown {
    max-width: 300px;
    float: right;
}

#top-info {
    max-width: 800px;
    width: 100%;
    position: relative;
    top: -50px;
    right: 0;
}

#top-info .textwidget {
    display: flex !important;
    position: absolute;
    right: 0;
    width: 100%;
    gap: 10px;
}

#top-info .textwidget p {
    right: 0px !important;
    top: 0 !important;
}

#headerWrap-sticky-wrapper #headerWrap #headerInner #headerContent #top-info .button.buttonGreen {
    margin-left: 5px;
    margin-right: 0px;
    margin-top: 0px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

#top-info #loginWrap {
    float: right;
}