/**
 * Kilwins Locations Module Styles
 *
 * Responsive styles for the Kilwins store locator module
 * that integrates with Beaver Builder and matches Kilwins branding
 */

/* ==== MODULE CONTAINER ==== */
.kilwins-locations-module {
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #333;
    line-height: 1.6;
}

/* ==== HEADER ==== */
.kilwins-locations-header {
    text-align: center;
    margin-bottom: 2rem;
}

.kilwins-locations-title {
    font-size: 2.5rem;
    color: #8a2b2b;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
    text-align: center;
}

/* ==== MAIN LAYOUT ==== */
.kilwins-locations-wrapper {
    display: flex;
    gap: 0;
    min-height: 600px;
    position: relative;
    align-items: stretch; /* Ensure both columns stretch to same height */
}

/* ==== MAP SECTION (LEFT SIDE) ==== */
.kilwins-locations-map-wrapper {
    flex: 0 0 70%;
    position: relative;
    margin-bottom: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    height: 600px; /* Fixed height */
}

.kilwins-locations-map {
    width: 100%;
    height: 100%;
    min-height: 600px;
    border-radius: 0;
    position: relative;
}

.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #666;
    font-style: italic;
    height: 100%;
}

/* ==== USE MY LOCATION BUTTON ==== */
.use-my-location-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 5;
    background: #ffffff;
    color: #333;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 4px;
    padding: 8px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.use-my-location-btn:hover {
    background: #f7f7f7;
}

.use-location-icon {
    line-height: 1;
}

@media (max-width: 768px) {
    .use-my-location-btn {
        right: 8px;
        bottom: 8px;
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* Custom info window styles */
.kilwins-info-window {
    font-family: inherit;
    max-width: 250px;
}

.kilwins-info-window h4 {
    margin: 0 0 8px 0;
    color: #8B4513;
    font-size: 16px;
    font-weight: 600;
}

.kilwins-info-window p {
    margin: 4px 0;
    font-size: 14px;
    line-height: 1.4;
}

.kilwins-info-window .btn {
    margin-top: 8px;
}

/* ==== RESULTS SECTION (RIGHT SIDE) ==== */
.kilwins-locations-results {
    flex: 0 0 30%;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    height: 600px; /* Match map height exactly */
}

/* ==== SEARCH SECTION (TOP OF RIGHT SIDE) ==== */
.kilwins-locations-search {
    background: #fff;
    padding: 0 1.5rem 1.5rem 1.5rem; /* Remove top padding */
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 0;
    border-radius: 0;
}

.search-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 0;
}

.location-input-wrapper {
    position: relative;
    width: 100%;
}

.location-search-input {
    width: 100%;
    padding: 12px 50px 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.3s ease;
    background: #fff;
}

.location-search-input:focus {
    outline: none;
    border-color: #8a2b2b;
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.location-search-input::placeholder {
    color: #999;
}

.radius-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radius-selector label {
    font-weight: 600;
    color: #333;
    margin: 0;
    font-size: 14px;
}

.radius-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.radius-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
}

.radius-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #8a2b2b;
    border-radius: 50%;
    cursor: pointer;
}

.radius-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #8a2b2b;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.radius-value {
    font-weight: 600;
    color: #8a2b2b;
    min-width: 70px;
    text-align: right;
    font-size: 14px;
}

.search-status {
    min-height: 24px;
    display: flex;
    align-items: center;
}

.status-message {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.status-message.error {
    color: #dc3545;
    font-weight: 600;
}

.results-header {
    display: none;
}

.results-title {
    font-size: 1.5rem;
    color: #8a2b2b;
    margin: 0;
    font-weight: 600;
}

.results-count {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* ==== LOCATIONS GRID ==== */
.kilwins-locations-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    flex: 1; /* Take up remaining space */
    padding: 0;
}

/* Grid layout - force single column for this design */
.kilwins-locations-grid.grid,
.kilwins-locations-grid.list {
    display: flex;
    flex-direction: column;
}

/* ==== LOCATION CARDS ==== */
.kilwins-location-card {
    background: #fff;
    border: none;
    border-bottom: 1px solid #e9ecef;
    border-radius: 0;
    padding: 1.5rem;
    transition: background-color 0.2s ease;
    cursor: pointer;
    position: relative;
    box-shadow: none;
}

.kilwins-location-card:hover {
    background: #f8f9fa;
    transform: none;
    box-shadow: none;
}

.kilwins-location-card.active {
    background: #f8f9fa;
    border-left: 4px solid #8a2b2b;
    box-shadow: none;
}

.kilwins-location-card.active::before {
    display: none;
}

.location-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.location-name {
    font-size: 2rem;
    color: #333;
    margin: 0;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
}

.location-distance {
    display: none;
}

.location-details {
    margin-bottom: 1rem;
}

.location-details > div {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.location-details > div:last-child {
    margin-bottom: 0;
}

.location-details span[class*="-icon"] {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
    width: 16px;
    display: inline-block;
}

.address-text,
.hours-text {
    color: #666;
    font-size: 14px;
}

.phone-link,
.email-link {
    color: #666;
    text-decoration: none;
    font-weight: 400;
    font-size: 14px;
}

.phone-link:hover,
.email-link:hover {
    color: #8a2b2b;
    text-decoration: none;
}

.location-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ==== BUTTONS ==== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    /* font-size: 16px !important; */
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    /* line-height: 1.2; */
    white-space: nowrap;
}

.btn-primary {
    background: #c8372d;
    color: #fff;
    border: none;
}

.btn-primary:hover {
    background: #a82e26;
    color: #fff;
    text-decoration: none;
    transform: none;
}

.btn-secondary {
    background: #c8372d;
    color: #fff;
    border: none;
}

.btn-secondary:hover {
    background: #a82e26;
    color: #fff;
    text-decoration: none;
    transform: none;
}

.btn-directions {
    background: transparent;
    border: 2px solid #c8372d;
    color: #c8372d;
}

.btn-directions:hover {
    background: #c8372d;
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ==== LOADING & EMPTY STATES ==== */
.loading-placeholder {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    font-style: italic;
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

/* ==== RESPONSIVE DESIGN ==== */

/* Tablet styles */
@media (max-width: 1024px) {
    .kilwins-locations-wrapper {
        flex-direction: column;
        min-height: auto; /* prevent forced height on stack */
        align-items: stretch;
    }

    .kilwins-locations-map-wrapper,
    .kilwins-locations-results {
        flex: none;
        width: 100%;
        height: auto;        /* remove fixed desktop heights */
        min-height: 0;
        margin: 0;
    }

    .kilwins-locations-map {
        height: 400px;       /* explicit map height on tablet */
        min-height: 400px;
    }

    .kilwins-locations-grid {
        max-height: none;    /* let it size naturally */
        height: auto;
    }

    .kilwins-locations-search {
        padding-top: 1.5rem;
    }
}

/* Tablet styles */
@media (max-width: 768px) {
    .kilwins-locations-title {
        font-size: 2rem;
    }

    .search-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .location-input-wrapper {
        min-width: auto;
    }

    .kilwins-locations-map {
        height: 320px;      /* slightly smaller on small tablets */
        min-height: 320px;
    }

    .kilwins-locations-grid {
        max-height: none;
        height: auto;
    }
}

/* Mobile styles */
@media (max-width: 480px) {
    .kilwins-locations-module {
        padding: 0;
    }

    .kilwins-locations-title {
        font-size: 1.75rem;
    }

    .kilwins-locations-search {
        padding: 1rem;
    }

    .kilwins-locations-map-wrapper,
    .kilwins-locations-results {
        height: auto;      /* ensure no fixed heights on mobile */
        min-height: 0;
    }

    .kilwins-locations-map {
        height: 280px;     /* comfortable mobile height */
        min-height: 280px;
    }

    .kilwins-location-card {
        padding: 1rem;
    }

    .location-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .location-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}/* ==== ACCESSIBILITY ==== */
@media (prefers-reduced-motion: reduce) {
    .kilwins-location-card,
    .btn,
    .location-search-input,
    .radius-select {
        transition: none;
    }

    .kilwins-location-card:hover {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus,
.location-search-input:focus,
.radius-select:focus {
    outline: 2px solid #8a2b2b;
    outline-offset: 2px;
}

.kilwins-location-card:focus {
    outline: 2px solid #8a2b2b;
    outline-offset: 2px;
}

/* ==== PRINT STYLES ==== */
@media print {
    .kilwins-locations-search,
    .kilwins-locations-map-wrapper,
    .location-actions {
        display: none;
    }

    .kilwins-locations-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .kilwins-location-card {
        break-inside: avoid;
        border: 1px solid #ccc;
        box-shadow: none;
    }
}