@import url('https://fonts.googleapis.com/css2?family=Urbanist:wght@400;500;600;700&display=swap');

.thsf-branches-container {
    width: 100%;
    font-family: 'Urbanist', sans-serif;
    box-sizing: border-box; /* Include padding in width calculation */
    max-width: 1440px;
    margin: 18px auto 40px;
    padding: 0 20px;
    overflow-x: hidden; /* Prevent horizontal scroll */
    text-align: left; /* Ensure children align left */
}

@media (min-width: 1520px) {
    .thsf-branches-container {
        padding: 0 40px;
        margin-left: auto;
        margin-right: auto;
    }
}

.thsf-branches-container *:not(.thsf-branches-container) {
    box-sizing: border-box;
}

.thsf-branches-header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    min-height: 45px;
    margin-bottom: 16px;
    padding: 0;
    width: 100%;
}

@media (max-width: 768px) {
    .thsf-branches-header {
        gap: 12px;
    }
}

.thsf-branches-title {
    margin: 0;
    color: #BA1B1B;
    font-family: "Urbanist", sans-serif;
    font-size: 40px;
    font-weight: 500;
    font-style: normal;
    letter-spacing: 0;
    line-height: 100%;
}

.thsf-branches-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: nowrap;
    margin-left: auto;
}

.thsf-branches-controls > p {
    display: none !important;
}

.thsf-branches-wrapper-outer {
    display: contents;
}

@media (max-width: 768px) {
    .thsf-branches-controls {
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
    }
}

.thsf-branches-view-all {
    color: #BA1B1B;
    text-decoration: underline;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.thsf-branches-view-all:hover {
    color: #8b1515;
    text-decoration-thickness: 2px;
}

.thsf-branches-nav {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-left: 12px;
}

.thsf-nav-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #BA1B1B;
    color: white;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(186, 27, 27, 0.2);
    flex-shrink: 0;
}

.thsf-nav-btn:hover:not(:disabled) {
    background: #9a1616;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(186, 27, 27, 0.3);
}

.thsf-nav-btn:active {
    transform: scale(0.95);
}

.thsf-nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.thsf-nav-btn svg {
    width: 26px;
    height: 26px;
}

.thsf-page-indicator {
    font-family: "Urbanist", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 100%;
    letter-spacing: 0;
    color: #373738;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 6px;
    white-space: nowrap;
    min-width: auto;
    text-align: center;
}

.thsf-branches-slider-wrapper {
    overflow: hidden;
    width: 100%;
    padding: 0;
    margin: 0;
}

.thsf-branches-slider {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    margin: 0;
    padding: 0;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    gap: 24px;
    box-sizing: border-box;
    justify-content: flex-start; /* Align cards to the left */
}

.thsf-branch-card {
    /* Default to 4 columns if JS hasn't run yet */
    flex: 0 0 calc(25% - 18px);
    margin: 0;
    height: 450px;
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    color: white;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Column classes managed by JS */ 
.thsf-cols-4 .thsf-branch-card { flex: 0 0 calc(25% - 18px); }
.thsf-cols-3 .thsf-branch-card { flex: 0 0 calc(33.333% - 16px); }
.thsf-cols-2 .thsf-branch-card { flex: 0 0 calc(50% - 12px); }
.thsf-cols-1 .thsf-branch-card { flex: 0 0 100%; }

.thsf-branch-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.thsf-branch-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.thsf-branch-bg-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.thsf-branch-card:hover .thsf-branch-bg-image {
    transform: scale(1.05);
}

.thsf-branch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 40%, rgba(0,0,0,0.4) 70%, rgba(0,0,0,0.9) 100%);
    z-index: 2;
}

.thsf-branch-content {
    position: relative;
    z-index: 3;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 30px 25px;
    text-align: left;
}

.thsf-branch-title {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 12px 0;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.thsf-branch-excerpt {
    font-size: 15px;
    margin-bottom: 25px;
    line-height: 1.5;
    opacity: 0.95;
    color: #ffffff;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.thsf-branch-btn {
    display: inline-block;
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(8px);
    width: fit-content;
    transition: all 0.3s ease;
}

.thsf-branch-btn:hover {
    background: #ffffff;
    color: #D32F2F;
    border-color: #ffffff;
}

/* Responsive */
@media (max-width: 1100px) {
    .thsf-nav-btn {
        width: 42px;
        height: 42px;
    }
    
    .thsf-page-indicator {
        font-size: 15px;
    }
}

@media (max-width: 992px) {
    .thsf-branches-container {
        padding: 0 20px;
    }
}

@media (max-width: 900px) {
    .thsf-branches-title {
        font-size: 2.2rem;
    }
    
    .thsf-branches-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .thsf-branches-controls {
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    .thsf-branches-header {
        align-items: flex-start;
    }
    
    .thsf-branches-title {
        font-size: 1.9rem;
    }
    
    .thsf-nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .thsf-nav-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .thsf-page-indicator {
        font-size: 14px;
    }
    
    .thsf-branches-view-all {
        font-size: 0.9rem;
    }
    
    .thsf-branches-controls {
        gap: 10px;
    }
}

@media (max-width: 600px) {
    .thsf-cols-1 .thsf-branch-card {
        height: 400px;
    }
}

/* Grid Layout Styles */
.thsf-branches-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 0;
    width: 100%;
    justify-items: start; /* Align grid items to the left */
}

.thsf-branches-container .thsf-branches-grid .thsf-branch-card {
    flex: unset;
    width: auto;
    max-width: 100%;
}

@media (max-width: 1200px) {
    .thsf-branches-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .thsf-branches-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .thsf-branches-grid {
        grid-template-columns: 1fr;
    }
}

