/* ATM Finder V3 - Modern styling for Premium UX & Content Enhancements */

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

.v2-theme {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    position: relative;
    width: 100%;
    height: 100%;
    color: #1a1a1a;
}

/* Side-by-Side Flex Layout Grid */
.v2-main-layout {
    display: flex;
    flex-direction: row;
    gap: 24px;
    width: 100%;
    margin-bottom: 24px;
    min-height: 650px; /* Reserve layout space to prevent CLS layout shift */
    padding: 10px;
}

.v2-sidebar {
    width: 360px;
    height: 650px;
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.v2-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.v2-sidebar-header h3 {
    margin: 0 0 6px 0 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #034C8C !important;
    line-height: 1.2 !important;
}

.v2-results-count {
    font-size: 13px !important;
    color: #7d7d7d !important;
    font-weight: 500 !important;
    display: block !important;
}

.v2-locations-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Location Card Styles */
.v2-location-card {
    background: #fcfcfc !important;
    border: 1px solid #eaeaea !important;
    border-radius: 10px !important;
    padding: 12px 14px !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    box-sizing: border-box !important;
}

.v2-location-card:hover {
    background: #ffffff !important;
    border-color: #034C8C !important;
    box-shadow: 0 4px 12px rgba(3, 76, 140, 0.08) !important;
    transform: translateY(-2px) !important;
}

.v2-location-card.active {
    background: #f4f8fc !important;
    border-color: #034C8C !important;
    box-shadow: 0 4px 16px rgba(3, 76, 140, 0.12) !important;
}

.v2-location-card.v2-hidden {
    display: none !important;
}

.v2-card-title {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #034C8C !important;
    margin: 0 0 2px 0 !important;
    line-height: 1.3 !important;
}

.v2-card-address {
    font-size: 12px !important;
    color: #555555 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

.v2-card-meta {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-top: 4px !important;
    font-size: 11px !important;
    color: #777777 !important;
}

.v2-card-badge {
    padding: 3px 6px !important;
    border-radius: 4px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    display: inline-block !important;
    line-height: 1.0 !important;
}

.v2-badge-branch { background: #faebd7; color: #c58e01; }
.v2-badge-withdrawal { background: #e6f0fa; color: #034C8C; }
.v2-badge-deposit { background: #f0e6ff; color: #7954bc; }
.v2-badge-cash2card { background: #eaf6e2; color: #7ac142; }

/* Placeholder and Empty State styling */
.v2-placeholder-card {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 13px;
    line-height: 1.6;
}

.v2-map-wrapper {
    flex-grow: 1;
    height: 650px;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Glassmorphism Search Box Container */
.v2-search-container {
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    margin: 16px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    max-width: 480px;
    width: calc(100% - 32px);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.v2-search-container:focus-within {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
    border-color: rgba(3, 76, 140, 0.4);
}

/* Search Controls */
.v2-search-input {
    border: none !important;
    background: transparent !important;
    padding: 10px 0 !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    color: #1a1a1a !important;
    flex-grow: 1 !important;
    box-sizing: border-box !important;
    outline: none !important;
    box-shadow: none !important;
}

.v2-search-input::placeholder {
    color: #7d7d7d;
}

/* Geolocation spinner loading animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.v2-spinner-active {
    animation: spin 1s linear infinite;
    color: #c58e01 !important;
}

.v2-icon-button {
    background: transparent !important;
    color: #034C8C !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 20px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    outline: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    transition: all 0.2s ease !important;
}

#v2-geo-btn {
    width: 60px !important;
    border-radius: 18px !important;
}

.v2-icon-button:hover {
    background: rgba(3, 76, 140, 0.08) !important;
    color: #022f57 !important;
    transform: scale(1.05) !important;
}

.v2-icon-button:active {
    transform: scale(0.95) !important;
}

.v2-hamburger {
    font-size: 22px !important;
}

/* Upward filter panel drawer */
.v2-filters-outer-container {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    z-index: 1000;
    overflow: hidden;
    transform-origin: bottom center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.v2-filters-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
}

.v2-filter-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.v2-filter-label:hover {
    background: rgba(0, 0, 0, 0.04);
}

.v2-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.v2-checkbox:checked {
    border-color: #034C8C;
    background-color: #034C8C;
}

.v2-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Modern Markers */
.v2-marker-pin {
    width: 32px;
    height: 40px;
    position: relative;
    cursor: pointer;
    transform: translate(-50%, -100%);
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.25));
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.v2-marker-pin:hover {
    transform: translate(-50%, -105%) scale(1.15);
    z-index: 9999 !important;
}

.v2-marker-inner {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Custom Infowindow styling */
.v2-infowindow-content {
    padding: 8px;
    min-width: 280px !important;
    max-width: 320px !important;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
}

.v2-infowindow-content h3 {
    margin: 0 0 8px 0 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #034C8C !important;
    line-height: 1.3 !important;
}

.v2-infowindow-content img {
    width: 100% !important;
    height: auto !important;
    max-height: 140px !important;
    object-fit: contain !important;
    border-radius: 8px;
    margin: 8px 0 !important;
    border: 1px solid #eee;
    background: #fff;
    padding: 4px;
    box-sizing: border-box;
}

.v2-infowindow-content p {
    margin: 6px 0 !important;
    font-size: 13px !important;
    color: #444 !important;
    line-height: 1.4 !important;
}

.v2-infowindow-content a {
    color: #034C8C;
    text-decoration: none;
    font-weight: 500;
}

.v2-infowindow-content a:hover {
    text-decoration: underline;
}

.v2-directions-btn {
    display: block !important;
    margin-top: 12px !important;
    padding: 8px 16px !important;
    background: #034C8C !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    text-align: center !important;
    transition: background 0.2s ease !important;
}

.v2-directions-btn:hover {
    background: #022f57;
    text-decoration: none !important;
}

/* Custom No Results Alert Card on Map */
.v2-no-results-alert {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 235, 235, 0.95);
    border: 1px solid #ffcccc;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #cc0000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
}

/* Modern Legend styling */
.v2-legend {
    margin-top: 24px;
    padding: 20px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    margin-right: 10px !important;
    margin-left: 10px !important;
}

.LegendHeader {
    font-size: 14px;
    color: #444;
    margin-bottom: 16px;
    line-height: 1.5;
    text-align: center;
}

.LegendGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.LegendSet {
    display: flex;
    align-items: center;
    gap: 12px;
}

.v2-legend .onblBlock {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.v2-legend .onbBranch { background-color: #c58e01; }
.v2-legend .onbWith { background-color: #034C8C; }
.v2-legend .onbDepos { background-color: #7954bc; }
.v2-legend .onbUserL { background-color: #55c3f1; }
.v2-legend .onbCashB { background-color: #7ac142; }

.v2-legend .onblName {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

/* Branch Accordion Sections styling */
.v2-branch-details-section {
    margin-top: 40px;
    margin-bottom: 40px;
}

.v2-section-title {
    font-size: 22px;
    font-weight: 700;
    color: #034C8C;
    margin: 0 0 8px 0;
}

.v2-section-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0 0 24px 0;
}

.v2-accordion-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.v2-accordion-item {
    border: 1px solid #eaeaea;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: all 0.2s ease;
}

.v2-accordion-item.active {
    border-color: #034C8C;
    box-shadow: 0 4px 15px rgba(3, 76, 140, 0.05);
}

.v2-accordion-header {
    width: 100%;
    padding: 16px 20px;
    background: #fafafa;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-align: left;
    transition: background 0.2s ease;
}

.v2-accordion-header:hover {
    background: #f5f5f5;
    color: #034C8C;
}

.v2-accordion-icon {
    font-size: 18px;
    font-weight: 700;
    color: #034C8C;
}

.v2-accordion-content {
    max-height: 0;
    overflow: hidden;
    padding: 0 20px;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    background: #fff;
}

.v2-branch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    font-size: 14px;
    line-height: 1.5;
}

.v2-branch-grid a {
    color: #034C8C;
    text-decoration: none;
}

.v2-branch-grid a:hover {
    text-decoration: underline;
}

.v2-branch-grid ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.v2-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #f0f4f8;
    color: #034C8C;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 6px;
    margin-bottom: 8px;
}

/* Mobile view toggle wrapper - mobile-first display defaults */
.v2-mobile-toggle-wrapper {
    display: flex;
    width: 100% !important;
    margin: 0 0 16px 0 !important;
    background: #f0f0f0 !important;
    border-radius: 8px !important;
    padding: 4px !important;
    box-sizing: border-box !important;
    gap: 4px !important;
}

/* Hide toggle wrapper on desktop viewports */
@media (min-width: 993px) {
    .v2-mobile-toggle-wrapper {
        display: none !important;
    }
}

.v2-mobile-toggle-btn {
    flex: 1 !important;
    text-align: center !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    background: transparent !important;
    border: none !important;
    color: #555555 !important;
    cursor: pointer !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    outline: none !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    height: auto !important;
    min-height: unset !important;
}

.v2-mobile-toggle-btn.active {
    background: #ffffff !important;
    color: #034C8C !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    border: none !important;
}

@media (max-width: 992px) {
    .v2-mobile-toggle-wrapper {
        margin: 10px !important;
        width: calc(100% - 20px) !important;
    }
    .v2-main-layout {
        flex-direction: column;
        gap: 0;
        min-height: 500px; /* Reserve layout space on tablet/mobile to prevent CLS */
    }
    
    /* Toggle Visibility on Mobile */
    .v2-theme:not(.show-list-view) #v2-sidebar {
        display: none !important;
    }
    .v2-theme.show-list-view .v2-map-wrapper {
        display: none !important;
    }
    
    .v2-sidebar {
        width: 100%;
        height: 500px;
        border-radius: 16px;
    }
    
    .v2-map-wrapper {
        width: 100%;
        height: 500px;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    .v2-theme:not(.show-list-view) .v2-legend {
        margin-top: 9.5rem !important;
    }
}

@media (max-width: 768px) {
    .v2-map-wrapper,
    .v2-sidebar {
        height: 450px;
    }
    
    .v2-main-layout {
        min-height: 450px; /* Reserve height for smaller screen viewports */
    }
    
    .v2-search-container {
        margin: 12px;
        padding: 6px 12px;
        width: calc(100% - 32px);
        max-width: calc(100% - 32px);
    }
    
    .LegendGrid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .v2-branch-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .v2-theme:not(.show-list-view) .v2-legend {
        margin-top: 12.5rem !important;
    }
}

@media (max-width: 480px) {
    .LegendGrid {
        grid-template-columns: 1fr;
    }
    .v2-infowindow-content {
        min-width: 220px !important;
        max-width: 250px !important;
        padding: 4px;
    }
    .v2-infowindow-content h3 {
        font-size: 14px !important;
    }
    .v2-infowindow-content p {
        font-size: 12px !important;
    }
    .v2-infowindow-content img {
        max-height: 100px !important;
    }
    .v2-directions-btn {
        font-size: 12px !important;
        padding: 6px 12px !important;
    }
}
