:root {
    --sgl-dark-brand: #1a1a1a;
    --sgl-black-accent: #111111;
    --sgl-gray-light: #f8f9fa;
    --sgl-border-color: #eef0f2;
    --sgl-text-main: #2d3436;
    --sgl-text-muted: #7f8c8d;

    --primary-color-brch: #e60000;
    --primary-gradient-brch: linear-gradient(45deg, #a01414, #eb4c4c);
    --accent-color: #cc0000;
    --light-color: #ffffff;
    --bg-gray: #f9f9f9;

    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 15px 35px rgba(255, 51, 102, 0.15);
    --sgl-shadow-premium: 0 12px 40px rgba(0, 0, 0, 0.04);

    --radius-lg: 24px;
    --radius-md: 12px;
    --sgl-radius-main: 16px;
}

.sgl-branch-master-container {
    font-family: 'Noto Sans Thai', sans-serif;
    display: flex;
    width: 100%;
    height: calc(100vh - 70px);
    background-color: var(--sgl-gray-light);
    overflow: hidden;
    margin-bottom: 100px;
}

.sgl-branch-sidebar {
    width: 440px;
    background: #ffffff;
    border-right: 1px solid var(--sgl-border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    flex-shrink: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.01);
}

.sgl-sidebar-header-block {
    padding: 24px;
    background: #ffffff;
    border-bottom: 1px solid var(--sgl-border-color);
}

.sgl-brand-identity-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.sgl-brand-logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    padding: 2px;
}

.sgl-brand-title-group h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--sgl-dark-brand);
    line-height: 1.2;
}

.sgl-brand-title-group h1 span {
    font-size: 2rem;
    color: var(--primary-color-brch);
}

.sgl-brand-title-group p {
    font-size: 0.85rem;
    color: var(--sgl-text-muted);
}



.sgl-search-input-box {
    position: relative;
    margin-bottom: 12px;
}

.sgl-search-icon-inside {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sgl-text-muted);
    transition: color 0.25s ease;
}

.sgl-search-field {
    font-family: 'Noto Sans Thai', sans-serif;
    width: 100%;
    padding: 14px 16px 14px 46px;
    border: 1px solid #e0e0e0;
    /* border-radius: var(--sgl-radius-main); */
    outline: none;
    font-size: 0.92rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--sgl-gray-light);
}

.sgl-search-field:focus {
    border-color: var(--primary-color);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(255, 51, 102, 0.1);
}

.sgl-search-field:focus+.sgl-search-icon-inside {
    color: var(--primary-color);
}

.sgl-quick-filters {
    display: flex;
    gap: 8px;
    margin: 4px 0 14px 0;
    flex-wrap: wrap;
}

.sgl-filter-tag {
    font-family: 'Kanit', sans-serif;
    font-size: 0.82rem;
    padding: 6px 14px;
    /* border-radius: 20px; */
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
}

.sgl-filter-tag i {
    font-size: 0.78rem;
    color: #718096;
}

.sgl-filter-tag:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.sgl-filter-tag.active {
    background: #e60a0a; 
    color: #ffffff;
    border-color: #ff3366;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(255, 51, 102, 0.2);
}

.sgl-filter-tag.active i {
    color: #ffffff;
}



.sgl-branch-item-card {
    background: #ffffff;
    border: 4px solid #edf2f7;
    /* border-radius: 12px; */
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.sgl-branch-item-card:hover {
    border-color: #ff3366;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.sgl-branch-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.sgl-branch-card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
    line-height: 1.4;
}

.sgl-status-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
    /* border-radius: 4px; */
    font-weight: 800;
    white-space: nowrap;
}

.sgl-status-badge.open { background: #e6fffa; color: #319795; }
.sgl-status-badge.closed { background: #fff5f5; color: #e53e3e; }

.sgl-branch-item-card p {
    font-size: 0.82rem;
    color: #718096;
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sgl-branch-item-card p i {
    width: 14px;
    color: #a0aec0;
}

.sgl-branch-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #edf2f7;
}

.sgl-btn-card-action {
    flex: 1;
    padding: 8px;
    font-size: 0.78rem;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.sgl-btn-card-action.phone { background: #edf2f7; color: #2d3748; }
.sgl-btn-card-action.phone:hover { background: #e2e8f0; }

.sgl-btn-card-action.navigate { background: #fff5f5; color: #ff3366; border: 1px solid #fed7d7; }
.sgl-btn-card-action.navigate:hover { background: #ffebee; }

.sgl-btn-locate-client {
    font-family: 'Noto Sans Thai', sans-serif;
    width: 100%;
    padding: 14px;
    background: var(--primary-gradient-brch);
    color: #ffffff;
    border: none;
    /* border-radius: var(--sgl-radius-main); */
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-soft);
    transition: all 0.25s ease;
}

.sgl-btn-locate-client:hover {
    box-shadow: var(--shadow-hover);
    opacity: 0.95;
}

.sgl-btn-locate-client:active {
    transform: scale(0.99);
}



.sgl-branch-cards-scroll-zone {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-gray);
}

.sgl-branch-cards-scroll-zone::-webkit-scrollbar {
    width: 5px;
}

.sgl-branch-cards-scroll-zone::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 10px;
}

.sgl-premium-branch-card {
    background: #ffffff;
    border: 4px solid var(--sgl-border-color);
    /* border-radius: var(--sgl-radius-main); */
    padding: 20px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow-soft);
}

.sgl-premium-branch-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 12px 24px rgba(255, 51, 102, 0.08);
    transform: translateY(-2px);
}

.sgl-premium-branch-card.sgl-active-state {
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 12px 30px rgba(255, 51, 102, 0.12);
}

.sgl-premium-branch-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--sgl-black-accent);
    margin-bottom: 12px;
    padding-right: 85px;
}

.sgl-card-type-pill {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 4px 12px;
    /* border-radius: 30px; */
    /* background: #fff0f3; */
    color: var(--primary-color);
    border: 1px solid rgba(255, 51, 102, 0.15);
}

.sgl-premium-branch-card.sgl-active-state .sgl-card-type-pill {
    background: var(--primary-gradient);
    color: #ffffff;
    border-color: transparent;
}

.sgl-card-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--sgl-text-main);
    margin-bottom: 8px;
    line-height: 1.4;
}

.sgl-card-detail-row i {
    margin-top: 3px;
    color: var(--primary-color-brch);
    font-size: 0.9rem;
    width: 14px;
}

.sgl-btn-map-redirect {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 8px 18px;
    background: #ffffff;
    color: var(--primary-color-brch);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    /* border-radius: 30px; */
    border: 1px solid var(--primary-color-brch);
    transition: all 0.2s ease;
}

.sgl-btn-map-redirect:hover {
    background: var(--primary-gradient-brch);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(255, 51, 102, 0.2);
}

.sgl-branch-cards-text-tips {
    display: none; 
    justify-content: center;
    align-items: center;
    margin: 5px 0;
    width: 100%;
}

.sgl-tips-content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    /* background-color: #FAF9F6;  */
    padding: 6px 16px;
    border-radius: 50px;      
    border: 1px solid var(--premium-border);
}

.sgl-swipe-icon {
    font-size: 0.85rem;
    color: var(--premium-primary); 
    animation: sglSimpleSwipe 2s infinite ease-in-out;
}

.sgl-tips-content p {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--premium-muted); 
    letter-spacing: 0.3px;
}

@keyframes sglSimpleSwipe {
    0%, 100% {
        transform: translateX(0);
        opacity: 0.6;
    }
    50% {
        transform: translateX(4px); 
        opacity: 1;
    }
}

@media (max-width: 992px) {
    .sgl-branch-cards-text-tips {
        display: flex; 
    }
}


.sgl-map-canvas-container {
    flex-grow: 1;
    height: 100%;
    position: relative;
}

#branch-map {
    width: 100%;
    height: 100%;
}

.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md) !important;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid var(--sgl-border-color);
}

.leaflet-popup-content b {
    color: var(--sgl-black-accent);
    font-size: 0.95rem;
    display: block;
    margin-bottom: 4px;
}

.sgl-custom-black-pin {
    position: relative;
    width: 42px;
    height: 42px;
    background: var(--sgl-dark-brand);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    border: 2.5px solid var(--primary-color);
}

.sgl-pin-logo-inside {
    position: absolute;
    width: 26px;
    height: 26px;
    top: 5.5px;
    left: 5.5px;
    background-image: url('/assets/images/logos/samglur-logo สามเกลอ.png');
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    transform: rotate(45deg);
    background-color: #ffffff;
}

.sgl-branch-choice-title {display: none;}

@media (max-width: 992px) {
    .sgl-branch-master-container {
        flex-direction: column-reverse;
        height: auto;
        margin-bottom: 0;
    }

    .sgl-branch-sidebar {
        width: 100%;
        height: auto;
        max-height: 100vh;
    }

    .sgl-map-canvas-container {
        width: 100%;
        height: 320px;
        position: relative;
    }

    .sgl-branch-choice-title {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 1.15rem;
        font-weight: 700;
        color: #111111;
        padding: 16px 20px 8px 20px;
        margin: 0;
        letter-spacing: 0.5px;
        position: relative;
        background: #ffffff;
    }

    .sgl-branch-choice-title::before {
        content: '';
        display: inline-block;
        width: 4px;
        height: 18px;
        background: linear-gradient(to bottom, #ff3366, #ff6633);
        border-radius: 2px;
    }

    .sgl-branch-choice-title::after {
        content: '';
        flex: 1;
        height: 1px;
        background: linear-gradient(to right, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0));
        margin-left: 8px;
    }
}

.leaflet-gesture-handling-warning {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.leaflet-gesture-handling-warning.is-active {
    opacity: 1;
}