/* Filename = ascend-locations.css */

.ascend-store-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.ascend-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0;                 
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    max-width: 800px;
    height: auto;                /* CHANGED: Auto height */
    min-height: 180px;          /* ADDED: Minimum height for consistency */
    display: flex;
    flex-direction: row;
}

.ascend-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.ascend-card.large {
    background: #fff;
    border: 2px solid #007cba;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.2);
    width: 100%;                
    max-width: 850px;           
    height: auto;               /* CHANGED: Auto height */
    min-height: 200px;          /* ADDED: Slightly larger minimum */
    margin: 20px auto;
}

.ascend-card-image {
    width: 300px !important;
    min-width: 300px !important;
    height: 100% !important;    /* This will now match the content height */
    margin: 0 !important;
    padding: 0 !important;
    border-top-left-radius: 7px;
    border-bottom-left-radius: 7px;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    position: relative;
}

.ascend-card-image img {
    display: none !important; /* Hide the original img tag */
}



.ascend-card-content {
    padding: 20px;
    text-align: left;
    flex: 1;                /* ADDED: Fill remaining space */
    display: flex;          /* ADDED: For button positioning */
    flex-direction: column; /* ADDED: Stack content vertically */
}

/* Ascend Brand Label */
.ascend-brand {
	background-color: transparent !important;
	color: #77c3ec !important;
    font-size: 0.8em;
    font-weight: 600;
    padding: 0 !important;
    margin: 0 0 0 0 !important;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Store Name */
.ascend-card h3 {
    margin: 0 !important;
    color: #333;
    font-size: 1.5em;
    font-weight: 700;
    line-height: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 !important;
    margin: 0;
}

.ascend-card.large h3 {
    font-size: 1.7em;
    color: #333;
}

/* Address Styling */
.ascend-card-address {
    color: #666;
    margin: 0;
    line-height: 1.4;
    font-size: 0.9em;
}

.ascend-card-phone a {
    color: #007cba !important;
    margin: 8px 0 16px 0;
    font-weight: 600;
}



.ascend-distance {
    color: #28a745;
    /* font-weight: bold; */
    /* margin: 10px 0 10px 10px; */
    /* font-size: 2em; */
    padding-bottom: 10px;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 4px;
    display: inline-block;
}

/* Button Container */
.ascend-buttons {
    margin-top: auto;       /* CHANGED: Push buttons to bottom */
    display: flex;
    gap: 8px;
}

/* Button Styling to Match Image */
.ascend-btn {
    flex: 1;
    display: inline-block;
    padding: 12px 12px;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 12px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ascend-btn-directions {
    background-color: #77c3ec;
    color: black;
}

.ascend-btn-directions:hover {
    background-color: #10152b;
    color: white;
    transform: translateY(-1px);
}

.ascend-btn-shop {
    background-color: #77c3ec;
    color: black;
}

.ascend-btn-shop:hover {
    background-color: #10152b;
    color: white;
    transform: translateY(-1px);
}

/* Section Titles */
.ascend-section-title {
    font-size: 2em;
    margin: 30px 0 20px 0;
    color: #333;
    font-weight: 700;
    text-align: center;
}

.ascend-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 1.1em;
}

.ascend-error {
    text-align: center;
    padding: 40px 20px;
}

.ascend-error p {
    margin-bottom: 20px;
    color: #666;
}

.ascend-error button {
    padding: 12px 24px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    font-weight: 600;
}

.ascend-error button:hover {
    background: #005a87;
}

.ascend-no-stores {
    text-align: center;
    color: #666;
    margin: 20px 0;
    font-style: italic;
}

/* Cards Container for Grid Layout */
.ascend-cards-container {
    display: grid;
    grid-template-columns: 1fr; /* Single column */
    gap: 20px;
    justify-items: center;
    max-width: 800px; /* Limit width for better readability */
    margin: 0 auto;
}

.ascend-closest-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    max-width: 800px;
    margin: 20px auto;
}


/* Responsive Design */
@media (max-width: 768px) {
    .ascend-store-page {
        padding: 15px;
    }
    
    .ascend-card {
        flex-direction: column;     /* Stack vertically on mobile */
        height: auto;               /* Auto height on mobile */
        max-width: 400px;
        margin: 15px auto;
    }
    
    .ascend-card.large {
        max-width: 450px;
        height: auto;
    }
    
    .ascend-card-image {
        width: 100%;                /* Full width on mobile */
        height: 200px;              /* Fixed height */
        min-width: unset;
    }
    
    .ascend-cards-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ascend-card-content {
        padding: 15px;
    }
    
    .ascend-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .ascend-btn {
        flex: none;
    }
    
    .ascend-section-title {
        font-size: 1.6em;
    }
    
    .ascend-card h3 {
        font-size: 1.3em;
    }
    
    .ascend-card.large h3 {
        font-size: 1.5em;
    }
}


@media (max-width: 480px) {
    .ascend-store-page {
        padding: 10px;
    }
    
    .ascend-card-content {
        padding: 12px;
    }
    
    .ascend-section-title {
        font-size: 1.4em;
        margin: 20px 0 15px 0;
    }
    
    .ascend-cards-container {
        grid-template-columns: 1fr;
    }
}


/* Fixed Shop Now Button - Top Right */
.ascend-fixed-shop-button {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
    cursor: pointer;
}

/* Main Pill Button */
.ascend-shop-pill {
    background-color: #00d4e7;
    color: white;
    padding: 6px 25px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 212, 231, 0.3);
    transition: all 0.2s ease;
    white-space: nowrap;
    border: #FFFFFF 1px solid;
}

.ascend-shop-pill:hover {
    background-color: #00bcd4;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 212, 231, 0.4);
}

/* Arrow Icon */
.ascend-shop-arrow {
    width: 8px;
    height: 8px;
    fill: white;
    transition: transform 0.2s ease;
}

.ascend-fixed-shop-button:hover .ascend-shop-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.ascend-shop-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: #00d4e7;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 212, 231, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 8px;
    overflow: hidden;
}

.ascend-fixed-shop-button:hover .ascend-shop-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Items */
.ascend-dropdown-item {
    display: block;
    padding: 10px 10px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.ascend-dropdown-item:last-child {
    border-bottom: none;
}

.ascend-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    padding-left: 25px;
}



/* Mobile Responsive*/
@media (max-width: 768px) {
    .ascend-fixed-shop-button {
        right: 15px;
    }
    
    .ascend-shop-pill {
        padding: 5px 20px;
        font-size: 12px;
    }
    
    .ascend-shop-dropdown {
        min-width: 180px;
    }
    
    .ascend-dropdown-item {
        padding: 10px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .ascend-fixed-shop-button {
        right: 10px;
    }
    
    .ascend-shop-pill {
        padding: 5px 16px;
        font-size: 11px;
    }
    
    .ascend-shop-dropdown {
        min-width: 180px;
        right: -10px;
    }
}



/* =========================
   DYNAMIC CSS WITH CUSTOM COLORS
========================= */

private function add_dynamic_css() {
    $options = get_option($this->option_key);
    
    $button_bg = $options['button_bg_color'] ?? '#00bcd4';
    $button_bg_hover = $options['button_bg_hover_color'] ?? '#0097a7';
    $button_text = $options['button_text_color'] ?? '#ffffff';
    $button_text_hover = $options['button_text_hover_color'] ?? '#ffffff';

    $custom_css = "
    <style id='ascend-dynamic-colors'>
    /* Main Button Styles */
    .ascend-shop-pill {
        background: {$button_bg} !important;
        color: {$button_text} !important;
    }
    
    .ascend-shop-pill:hover {
        background: {$button_bg_hover} !important;
        color: {$button_text_hover} !important;
    }
    
    .ascend-shop-arrow {
        fill: {$button_text} !important;
    }
    
    .ascend-fixed-shop-button:hover .ascend-shop-arrow {
        fill: {$button_text_hover} !important;
    }
    
    /* Dropdown Menu Styles */
    .ascend-shop-dropdown {
        background: {$button_bg} !important;
        border: 2px solid {$button_bg_hover} !important;
    }
    
    .ascend-dropdown-item {
        color: {$button_text} !important;
        border-bottom: 1px solid {$button_bg_hover} !important;
    }
    
    .ascend-dropdown-item:hover {
        background: {$button_bg_hover} !important;
        color: {$button_text_hover} !important;
    }
    
    .ascend-dropdown-item:last-child {
        border-bottom: none !important;
    }
    </style>
    ";

    echo $custom_css;
}



.ascend-shop-dropdown {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 200px;
}

.ascend-shop-dropdown a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #eee;
}

.ascend-shop-dropdown a:hover {
    background-color: #f5f5f5;
}

.ascend-shop-dropdown a:last-child {
    border-bottom: none;
}

.ascend-fixed-shop-button:hover .ascend-shop-dropdown {
    display: block; /* Show dropdown on button hover */
}

.ascend-shop-dropdown {
    display: none; /* Hide dropdown by default */
    position: absolute; /* Position dropdown below the button */
    z-index: 1000; /* Ensure dropdown appears above other elements */
}

.ascend-shop-dropdown {
    display: none; /* Hide dropdown by default */
    position: absolute; /* Position dropdown below the button */
    z-index: 1000; /* Ensure dropdown appears above other elements */
    transition: opacity 0.3s ease, transform 0.3s ease; /* Smooth transition */
}

.ascend-no-nearby {
    text-align: center;
    padding: 40px 20px;
}

.ascend-no-nearby p {
    font-size: 16px;
    margin: 10px 0;
}