/**
 * Screening Locations Map - Frontend Styles
 * 
 * Modern design inspired by wp-google-maps-pro
 */

/* ========================================
   Container & Layout
   ======================================== */

.stm-container {
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.stm-map-container {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

/* ========================================
   Leaflet Map
   ======================================== */

#stm-map {
    width: 100%;
    border: none;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

#stm-map img {
    border: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

/* ========================================
   Search Bar - Modern Store Locator Style
   ======================================== */

.stm-search-wrapper {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    max-width: 70%;
}

.stm-search-inner {
    display: flex;
    align-items: center;
    background: white;
    padding: 6px 8px;
    border-radius: 2px;
    font-family: Roboto, sans-serif;
    box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px;
}

.stm-search-input {
    height: 32px !important;
    padding: 0 10px !important;
    margin: 0 4px 0 0 !important;
    color: #333;
    border: 1px solid #ccc !important;
    border-radius: 2px;
    min-width: 200px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.stm-search-input:focus {
    border-color: #e91e63 !important;
    box-shadow: 0 0 0 1px #e91e63;
}

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

.stm-search-btn {
    height: 32px;
    padding: 0 16px;
    background: #e91e63;
    color: white;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.stm-search-btn:hover {
    background: #c2185b;
}

.stm-search-btn:active {
    background: #ad1457;
}

/* ========================================
   Map Popups
   ======================================== */

.stm-popup {
    min-width: 200px;
    max-width: 300px;
    line-height: 1.5;
}

.stm-popup-title {
    font-weight: 700;
    font-size: 16px;
    color: #333;
    margin-bottom: 6px;
}

.stm-popup-address {
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
}

.stm-popup-type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
}

.stm-popup-type.stm-type-fixed {
    background: #e8f5e9;
    color: #2e7d32;
}

.stm-popup-type.stm-type-mobile {
    background: #fce4ec;
    color: #c2185b;
}

.stm-popup-description {
    font-size: 13px;
    color: #555;
    border-top: 1px solid #eee;
    padding-top: 8px;
    margin-top: 8px;
}

.stm-popup-description p {
    margin: 0 0 0.5em;
}

.stm-popup-description p:last-child {
    margin-bottom: 0;
}

/* ========================================
   Locations List
   ======================================== */

.stm-locations-list {
    margin-top: 20px;
    overflow-x: auto;
    /* Allow horizontal scroll if squeezed */
}

.stm-list-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px;
    color: #333;
}

/* Filters */
.stm-list-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.stm-filter-btn {
    padding: 6px 14px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stm-filter-btn:hover {
    background: #eee;
}

.stm-filter-btn.stm-filter-active {
    background: #e91e63;
    color: white;
    border-color: #e91e63;
}

/* Table */
.stm-locations-table {
    width: 100%;
    /* min-width removed */
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

/* Table Content */
.stm-locations-table th,
.stm-locations-table td {
    padding: 12px 16px;
    text-align: left;
}

.stm-locations-table th {
    background: #fafafa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    border-bottom: 2px solid #eee;
}

.stm-locations-table td {
    border-bottom: 1px solid #eee;
    font-size: 14px;
    color: #333;
}

.stm-locations-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.stm-locations-table tbody tr:hover {
    background-color: #f8f8f8;
}

.stm-locations-table tbody tr:last-child td {
    border-bottom: none;
}

/* Highlight row */
.stm-location-row.stm-row-highlight {
    background-color: #fce4ec !important;
}

/* Column widths */
.stm-col-icon {
    width: 60px;
    text-align: center;
    vertical-align: top;
    /* Align icon to top */
    padding-top: 15px;
    /* Add some spacing */
}

.stm-col-info {
    width: auto;
    /* Flexible width */
}

/* Stacked Info Styles */
.stm-info-unit {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.stm-info-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.stm-info-address {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.stm-info-desc {
    font-size: 13px;
    color: #555;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #eee;
}

.stm-info-desc p {
    margin: 0;
}

/* Type badges */
.stm-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.stm-type-badge.stm-type-fixed {
    background: #e8f5e9;
    color: #2e7d32;
}

.stm-type-badge.stm-type-mobile {
    background: #fce4ec;
    color: #c2185b;
}

/* ========================================
   Responsive Design
   ======================================== */

@media screen and (max-width: 768px) {
    .stm-search-wrapper {
        max-width: calc(100% - 20px);
        left: 10px;
        right: 10px;
    }

    .stm-search-inner {
        flex-direction: column;
        gap: 8px;
    }

    .stm-search-input {
        width: 100%;
        min-width: auto;
    }

    .stm-search-btn {
        width: 100%;
    }

    .stm-col-address {
        display: none;
    }

    .stm-col-name {
        width: 70%;
    }

    .stm-col-type {
        width: 30%;
    }

    .stm-locations-table th,
    .stm-locations-table td {
        padding: 10px 12px;
    }
}

@media screen and (max-width: 480px) {
    .stm-list-filters {
        flex-wrap: wrap;
    }

    .stm-filter-btn {
        flex: 1;
        min-width: 70px;
        text-align: center;
    }
}

/* ========================================
   Leaflet Overrides
   ======================================== */

.leaflet-popup-content-wrapper {
    border-radius: 4px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 12px 16px;
}

.leaflet-popup-close-button {
    padding: 6px !important;
}

.stm-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 15px;
}

.stm-popup-header h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
    flex: 1;
}

.stm-popup-logo-wrapper {
    flex: 0 0 auto;
}

.stm-popup-logo {
    max-height: 40px;
    max-width: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ========================================
   Timeline Shortcode
   ======================================== */

.stm-timeline-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.stm-timeline-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 40px;
}

.stm-timeline-group {
    margin-bottom: 50px;
}

.stm-timeline-group-title {
    font-size: 20px;
    font-weight: 600;
    color: #e91e63;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e91e63;
    display: inline-block;
}

.stm-timeline {
    position: relative;
    padding-left: 50px;
}

/* The vertical line */
.stm-timeline::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #e91e63 0%, #f48fb1 100%);
    border-radius: 2px;
}

.stm-timeline-card {
    position: relative;
    margin-bottom: 25px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stm-timeline-card:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.stm-timeline-card--active {
    border-left: 4px solid #e91e63;
    background: linear-gradient(135deg, #fff 0%, #fce4ec 100%);
}

/* The dot/icon */
.stm-timeline-dot {
    position: absolute;
    left: -50px;
    top: 20px;
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

.stm-timeline-dot img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.stm-timeline-content {
    min-height: 40px;
}

.stm-timeline-name {
    font-size: 17px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.stm-timeline-address {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.stm-timeline-desc {
    font-size: 13px;
    color: #777;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
}

.stm-timeline-desc p {
    margin: 0;
}

/* Responsive */
@media screen and (max-width: 600px) {
    .stm-timeline {
        padding-left: 40px;
    }

    .stm-timeline::before {
        left: 12px;
    }

    .stm-timeline-dot {
        left: -40px;
        width: 28px;
        height: 28px;
    }

    .stm-timeline-dot img {
        width: 18px;
        height: 18px;
    }

    .stm-timeline-card {
        padding: 15px;
    }

    .stm-timeline-name {
        font-size: 15px;
    }
}

/* ========================================
   Timeline Switcher (Tabs)
   ======================================== */

.stm-timeline-switcher {
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.stm-switcher-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

.stm-switcher-tab {
    padding: 12px 24px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    transition: all 0.25s ease;
}

.stm-switcher-tab:hover {
    background: #e91e63;
    border-color: #e91e63;
    color: white;
    transform: translateY(-2px);
}

.stm-switcher-tab--active {
    background: #e91e63;
    border-color: #e91e63;
    color: white;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.stm-switcher-panel {
    display: none;
    animation: stmFadeIn 0.3s ease;
}

.stm-switcher-panel--active {
    display: block;
}

@keyframes stmFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Timeline Grid (Horizontal Layout)
   ======================================== */

.stm-timeline-grid-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.stm-timeline-grid-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 40px;
}

.stm-timeline-grid {
    display: grid;
    grid-template-columns: repeat(var(--stm-grid-columns, 4), 1fr);
    gap: 25px;
}

.stm-timeline-grid-column {
    min-width: 0;
}

.stm-timeline-grid-unit-title {
    font-size: 18px;
    font-weight: 600;
    color: #e91e63;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e91e63;
    text-align: center;
}

/* Compact timeline for grid */
.stm-timeline--compact {
    padding-left: 35px;
}

.stm-timeline--compact::before {
    left: 12px;
    width: 2px;
}

.stm-timeline-card--compact {
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.stm-timeline-card--compact .stm-timeline-name {
    font-size: 14px;
}

.stm-timeline-card--compact .stm-timeline-address {
    font-size: 12px;
}

.stm-timeline-card--compact .stm-timeline-desc {
    font-size: 11px;
    margin-top: 6px;
    padding-top: 6px;
}

.stm-timeline-dot--small {
    left: -35px;
    width: 24px;
    height: 24px;
}

.stm-timeline-dot--small img {
    width: 16px;
    height: 16px;
}

/* Responsive Grid */
@media screen and (max-width: 1200px) {
    .stm-timeline-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .stm-timeline-grid {
        grid-template-columns: 1fr;
    }

    .stm-switcher-tabs {
        justify-content: center;
    }

    .stm-switcher-tab {
        padding: 10px 18px;
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    .stm-switcher-tabs {
        flex-direction: column;
    }

    .stm-switcher-tab {
        width: 100%;
        text-align: center;
    }
}