/**
 * Shared Location Layout Styles
 * Common styles for both location search results and state display pages
 *
 * @package WP_Company_Manager
 * @category Styles
 * @author WebFX
 * @license GPL-2.0+
 * @link https://www.webfx.com
 */

/* Make entire page body gray when locations layout is present */
main#main {
    padding-block: 0;
    margin-top: -100px;
}

@media (min-width: 600px) {
    main#main {
        padding-block: 0;
        margin-top: -50px;
    }
}

@media (min-width: 1200px) {
    main#main {
        padding-block: 0;
        margin-top: -70px;
    }
}

body:has(.wpcm-locations-container),
body .wpcm-locations-container {
    background: #f8f9fa !important;
}

/* Ensure body covers full height */
body:has(.wpcm-locations-container) {
    background: #f8f9fa !important;
    min-height: 100vh;
}

/* Override any theme body background */
body {
    background: #f8f9fa !important;
}

.breadcrumbs.breadcrumbs {
    display: block !important;
}

/* Breadcrumbs Styling */
.wpcm-breadcrumbs {
    margin-bottom: 0;
    padding: 10px 0;
}

.wpcm-breadcrumbs nav,
.wpcm-breadcrumbs .breadcrumbs {
    font-size: 14px;
    color: #6c757d;
}

.wpcm-breadcrumbs a {
    color: #22366f;
    text-decoration: none;
    transition: color 0.2s ease;
}

.wpcm-breadcrumbs a:hover {
    color: #1565c0;
    text-decoration: underline;
}

.wpcm-breadcrumbs .breadcrumb_last,
.wpcm-breadcrumbs span:last-child {
    color: #404040;
    font-weight: 600;
}

.wpcm-breadcrumbs a:last-child span {
    font-weight: 500;
}

/* Breadcrumb separators - use slashes */
.wpcm-breadcrumbs .breadcrumb-separator,
.wpcm-breadcrumbs span:not(.breadcrumb_last):not(:last-child):after,
.wpcm-breadcrumbs a:not(:last-child):after {
    content: "/";
    color: #adb5bd;
    margin: 0 0 0 10px;
    text-decoration: none;
}

.wpcm-breadcrumbs span:not(.breadcrumb_last):not(:last-child):after {
    display: none;
}

/* Hide default Yoast separators */
.wpcm-breadcrumbs .breadcrumb-separator:not(:empty) {
    display: none;
}

/* Ensure slashes appear between breadcrumb items */
.wpcm-breadcrumbs a + span:before,
.wpcm-breadcrumbs span + span:before {
    content: " / ";
    color: #adb5bd;
    margin: 0 8px;
}

/* Common Container Styles */
.wpcm-locations-container {
    margin: 0 auto;
    padding: 0;
    background: transparent;
    min-height: 100vh;
    max-width: min(95vw, 1354px);
}

/* Header Section */
.wpcm-locations-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.wpcm-locations-header h1 {
    color: #003890;
    margin: 0 0 30px 0;
    font-size: 2.5rem;
    font-weight: 700;
    font-family: Montserrat;
    font-size: 70px;
    font-style: normal;
    font-weight: 800;
    line-height: 70px;
    text-align: left;
}

.wpcm-locations-info {
    color: #6c757d;
    margin: 0 0 30px 0;
    font-size: 1.2rem;
    font-weight: 500;
}

/* Search Form Inside Header */
.wpcm-locations-header .wpcm-search-form {
    display: flex;
    gap: 15px;
    max-width: 100%;
    margin: 0 0;
    align-items: center;
}

.wpcm-locations-header .wpcm-search-input {
    flex: 1;
    padding: 15px 20px;
    border: 1px solid #404040;
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 283px;
    height: 50px;
    padding: 12px 20px;
    color: hsl(0deg 0% 25.1% / 30%);
    font-family: Montserrat;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 26px;
}

.wpcm-locations-header .wpcm-search-input:focus {
    border-color: #1976d2;
}

.wpcm-locations-header .wpcm-location-search-button,
.wpcm-locations-header .wpcm-search-button {
    background: #22366f;
    color: white;
    border: none;
    padding: 12px 30px;
    margin-left: 30px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wpcm-locations-header .wpcm-location-search-button:hover,
.wpcm-locations-header .wpcm-search-button:hover {
    background: #1565c0;
}

/* Error Message Styling */
.wpcm-locations-info .error-message {
    color: #d32f2f;
    background: #ffebee;
    padding: 10px 15px;
    border-radius: 4px;
    border-left: 4px solid #d32f2f;
    display: inline-block;
    margin: 10px 0;
    font-weight: 500;
}

/* Main Layout - Side by Side */
.wpcm-locations-layout {
    display: flex;
    gap: 20px;
    min-height: 600px;
    margin-top: 20px;
}

/* Left Side Map */
.wpcm-locations-map-container {
    flex: 1;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    order: 1;
    min-height: 600px;
}

.wpcm-locations-map {
    width: 100%;
    height: 660px;
    border-radius: 8px;
}

/* Right Sidebar with Location List */
.wpcm-locations-sidebar {
    flex: 0 0 380px;
    /* background: #fff; */
    /* border: 1px solid #e0e0e0; */
    /* border-radius: 8px; */
    overflow: hidden;
    order: 2;
    /* box-shadow: 0 2px 8px rgba(0,0,0,0.1); */
    padding-inline: 0;
    overflow: auto;
}

.wpcm-locations-list-container {
    max-height: 600px;
    overflow-y: auto;
    /* background: #fff; */
    padding-inline: 30px;
}

/* Individual Location Items */
.wpcm-location-item {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.wpcm-location-item:hover {
    background: #f8f9fa;
}

.wpcm-location-item.selected {
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
}

.wpcm-location-item:last-child {
    border-bottom: none;
}

.wpcm-location-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
}

.wpcm-location-item-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
    line-height: 1.3;
}

.wpcm-location-distance {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.wpcm-location-item-details {
    margin-bottom: 15px;
}

.wpcm-location-item-details p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

.wpcm-location-address {
    font-weight: 500;
    color: #333 !important;
}

.wpcm-location-phone a {
    color: #1976d2;
    text-decoration: none;
}

.wpcm-location-phone a:hover {
    text-decoration: underline;
}

.wpcm-location-item-actions {
    text-align: right;
}

.wpcm-go-to-page-btn {
    color: #bb242d;
    border-radius: 4px;
    text-decoration: underline;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    transition: background 0.2s ease;
    display: inline-block;
}

/* Map Info Windows */
.wpcm-map-info-window h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: #2c3e50;
}

.wpcm-map-info-window p {
    margin: 4px 0;
    font-size: 0.9rem;
    color: #666;
}

.wpcm-no-locations {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .wpcm-locations-sidebar {
        flex: 0 0 350px;
    }
}

@media (max-width: 768px) {
    .wpcm-locations-header .wpcm-search-form {
        flex-direction: column;
        gap: 15px;
    }

    .wpcm-locations-header .wpcm-search-input {
        width: 100%;
    }

    .wpcm-locations-header .wpcm-location-search-button,
    .wpcm-locations-header .wpcm-search-button {
        width: 100%;
        padding: 14px 20px;
    }

    .wpcm-locations-layout {
        flex-direction: column;
        gap: 15px;
    }

    .wpcm-locations-map-container {
        flex: none;
        order: 1;
        height: 400px;
    }

    .wpcm-locations-sidebar {
        flex: none;
        order: 2;
    }

    .wpcm-locations-map {
        height: 400px;
    }

    .wpcm-locations-list-container {
        max-height: 400px;
    }

    .wpcm-locations-header h1 {
        font-size: 1.8rem;
    }

    .wpcm-location-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    /* Error message mobile styling */
    .wpcm-locations-info .error-message {
        display: block;
        text-align: left;
        margin: 15px 0;
    }
}

@media (max-width: 480px) {
    .wpcm-location-item {
        padding: 15px;
    }

    .wpcm-location-item-header h4 {
        font-size: 1rem;
    }

    .wpcm-go-to-page-btn {
        font-size: 0.8rem;
    }
}

/* Scrollbar Styling for Location List */
.wpcm-locations-list-container::-webkit-scrollbar {
    width: 6px;
}

.wpcm-locations-list-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.wpcm-locations-list-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.wpcm-locations-list-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.wpcm-location-header[aria-expanded="false"] {
    .fas.fa-map-marker-alt,
    .fas.fa-chevron-down {
        color: #bb242c;
    }
}

.wpcm-locations-list-container {
    /* width */
    &::-webkit-scrollbar {
        width: 15px;
    }

    /* Track */
    &::-webkit-scrollbar-track {
        box-shadow: none;
        border-radius: 10px;
    }

    /* Handle */
    &::-webkit-scrollbar-thumb {
        background: #bb242c;
        border-radius: 10px;
    }

    /* Handle on hover */
    &::-webkit-scrollbar-thumb:hover {
        background: #bb242c;
    }
}
