/* Locations Page Modern Redesign Styles */

:root {
    --primary-color: #1b355a;
    --primary-hover: #11223b;
    --accent-color: #e0a92e;
    --accent-hover: #c9921e;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --success-color: #10b981;
    --purple-brand: #220e3d;
    --blue-brand: #0066cc;
    --blue-hover: #0052a3;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 20px 25px -5px rgba(27, 53, 90, 0.08), 0 10px 10px -6px rgba(27, 53, 90, 0.08);
}

.locations-page {
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    color: var(--text-main);
    background-color: #f8fafc;
    padding-bottom: 80px;
}

/* Modern Filter Panel */
.modern-filter-panel {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.filter-inputs-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 20px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.filter-control {
    width: 100%;
    height: 46px;
    padding: 0 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 550;
    background: #ffffff;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.filter-control:focus {
    outline: none;
    border-color: var(--blue-brand);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.input-with-icon, .select-with-icon {
    position: relative;
    width: 100%;
}

.input-with-icon input {
    padding-right: 40px; /* Space for icon in RTL */
}

[dir="ltr"] .input-with-icon input {
    padding-left: 40px;
    padding-right: 16px;
}

.input-with-icon i, .select-with-icon i {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 16px;
}

[dir="ltr"] .input-with-icon i, [dir="ltr"] .select-with-icon i {
    right: auto;
    left: 14px;
}

.select-control {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 40px;
}

[dir="ltr"] .select-control {
    padding-left: 40px;
    padding-right: 32px;
}

.select-arrow {
    left: 14px;
    right: auto !important;
    font-size: 10px !important;
    color: #64748b !important;
}

[dir="ltr"] .select-arrow {
    right: 14px !important;
    left: auto !important;
}

/* Filter Actions Row */
.filter-actions-group {
    display: flex;
    gap: 10px;
    height: 46px;
}

.btn-action-apply {
    background: var(--blue-brand);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0 24px;
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    transition: background 0.2s ease;
    height: 100%;
    min-width: 100px;
}

.btn-action-apply:hover {
    background: var(--blue-hover);
}

.btn-action-reset {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 20px;
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
}

.btn-action-reset:hover {
    background: #e2e8f0;
}

/* Dark Purple Province Pills Banner */
.province-pills-banner {
    background: var(--purple-brand);
    border-radius: 50px;
    padding: 14px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-top: 30px;
    margin-bottom: 30px;
}

.province-pills-scroll-wrapper {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    padding: 2px 0;
}

.province-pills-scroll-wrapper::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.province-pill-btn {
    flex-shrink: 0;
    background: #ffffff;
    border: none;
    border-radius: 30px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.province-pill-btn:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}

.pill-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--purple-brand);
}

.pill-count {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
}

/* Active Pill State */
.province-pill-btn.active {
    background: var(--blue-brand);
}

.province-pill-btn.active .pill-name {
    color: #ffffff;
}

.province-pill-btn.active .pill-count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Results Meta Bar */
.results-meta-bar {
    padding: 5px 0;
}

.active-filter-badge {
    background: #e6f2ff;
    color: var(--blue-brand);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13.5px;
}

.badge-prefix {
    color: #64748b;
    margin-left: 4px;
}

[dir="ltr"] .badge-prefix {
    margin-left: 0;
    margin-right: 4px;
}

.results-count-text {
    font-size: 14px;
    color: #64748b;
    font-weight: 600;
}

.results-count-text span {
    color: var(--text-main);
    font-weight: 700;
}

.btn-meta-action {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-meta-action i {
    color: var(--accent-color);
    font-size: 15px;
}

.btn-meta-action:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* GPS Loading States */
.btn-meta-action.loading {
    background: #f1f5f9;
    color: var(--text-muted);
    pointer-events: none;
    box-shadow: none;
}

.btn-meta-action.loading i {
    animation: gpsPulse 1.2s infinite ease-in-out;
}

.btn-meta-action.success {
    background: #ecfdf5;
    border-color: var(--success-color);
    color: var(--success-color);
}
.btn-meta-action.success i {
    color: var(--success-color);
}

/* Multi-column Grid Layout */
.merchant-cards-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
    margin-top: 10px;
}

/* Responsive Grid Columns */
@media (min-width: 576px) {
    .merchant-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .merchant-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .merchant-cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Merchant Card Design */
.merchant-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-top: 5px solid var(--purple-brand); /* Thick Purple top border */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.merchant-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -5px rgba(0,0,0,0.08), 0 8px 8px -6px rgba(0,0,0,0.08);
}

.merchant-card-inner {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.merchant-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.4;
    margin: 0 0 8px 0;
    min-height: 44px; /* Ensure 2 lines height alignment */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.merchant-type-badge {
    align-self: flex-start;
    background: #f1f5f9;
    color: #475569;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 18px;
}

.merchant-details-table {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    flex-grow: 1;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 13.5px;
    line-height: 1.4;
}

.detail-label {
    color: #94a3b8;
    font-weight: 600;
    flex-shrink: 0;
    width: 60px;
}

.detail-value {
    color: var(--text-main);
    font-weight: 700;
    text-align: left;
    flex-grow: 1;
    word-break: break-word;
}

[dir="ltr"] .detail-value {
    text-align: right;
}

.detail-value a {
    color: var(--text-main);
    text-decoration: none;
}

.detail-value a:hover {
    color: var(--blue-brand);
    text-decoration: underline;
}

.text-success {
    color: var(--success-color) !important;
}

/* Full Width Show on Map Button */
.btn-show-card-map {
    width: 100%;
    background: var(--blue-brand);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease, transform 0.1s ease;
    margin-top: auto;
}

.btn-show-card-map:hover {
    background: var(--blue-hover);
}

.btn-show-card-map:active {
    transform: scale(0.98);
}

.btn-show-card-map i {
    font-size: 15px;
}

/* Placeholder for No Results */
.no-results-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: #94a3b8;
}

.no-results-placeholder i {
    font-size: 40px;
    color: #cbd5e1;
    margin-bottom: 12px;
    display: block;
}

.no-results-placeholder p {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

/* Floating Map View Button */
.btn-floating-map {
    position: fixed;
    bottom: 30px;
    left: 30px; /* Position floating button on left in RTL */
    z-index: 999;
    background: var(--accent-color);
    color: var(--primary-color);
    border: none;
    border-radius: 50px;
    padding: 14px 24px;
    font-weight: 800;
    font-size: 14.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(224, 169, 46, 0.4);
    transition: all 0.3s ease;
}

[dir="ltr"] .btn-floating-map {
    left: auto;
    right: 30px;
}

.btn-floating-map:hover {
    background: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 20px 25px -5px rgba(224, 169, 46, 0.5);
}

.btn-floating-map i {
    font-size: 16px;
}

/* Leaflet Map Modal */
.map-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.map-modal-content {
    background: #ffffff;
    width: 90%;
    max-width: 760px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    overflow: hidden;
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.map-modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    background: #ffffff;
}

.map-modal-header h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--primary-color);
}

.btn-close-modal {
    background: #f1f5f9;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-close-modal:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

.map-modal-body {
    padding: 20px;
}

.map-container-wrapper {
    height: 380px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

#modal-leaflet-map {
    height: 100%;
    width: 100%;
    background-color: #f1f5f9;
}

/* Map Modal Details Panel */
.map-modal-details-panel {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-top: 15px;
}

.detail-agent-name {
    font-size: 15.5px;
    font-weight: 850;
    color: var(--text-main);
    margin: 0 0 4px 0;
}

.detail-agent-category {
    display: inline-block;
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.detail-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.detail-row-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13.5px;
    color: #475569;
}

.detail-row-item i {
    color: var(--accent-color);
    font-size: 15px;
    margin-top: 2px;
    flex-shrink: 0;
}

.btn-detail-directions {
    background: var(--blue-brand);
    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
}

.btn-detail-directions:hover {
    background: var(--blue-hover);
    color: #ffffff;
    text-decoration: none;
}

.btn-detail-directions i {
    font-size: 14px;
}

/* QR Code Modal design overrides */
.qr-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.qr-modal-content {
    background: #ffffff;
    width: 90%;
    max-width: 360px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    padding: 24px;
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.qr-modal-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.qr-modal-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--primary-color);
}

.qr-modal-body p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.qr-canvas-wrapper {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    padding: 15px;
    border-radius: 12px;
    display: inline-flex;
}

.btn-download-qr {
    width: 100%;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-download-qr:hover {
    background: var(--accent-color);
    color: var(--primary-color);
}

/* Modal Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes gpsPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.4; }
    100% { transform: scale(1); opacity: 1; }
}

/* Mobile Responsiveness styling */
@media (max-width: 991.98px) {
    .filter-inputs-grid {
        grid-template-columns: 1fr 1fr;
    }
    .filter-actions-group {
        grid-column: 1 / -1;
        width: 100%;
        display: flex;
    }
    .btn-action-apply {
        flex-grow: 2;
    }
    .btn-action-reset {
        flex-grow: 1;
    }
}

@media (max-width: 575.98px) {
    .filter-inputs-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .modern-filter-panel {
        padding: 16px;
    }
    .province-pills-banner {
        padding: 10px 14px;
        border-radius: 12px; /* Less rounded on mobile scrollbar */
    }
    .province-pill-btn {
        padding: 6px 14px;
    }
    .btn-floating-map {
        bottom: 20px;
        left: 20px;
        padding: 12px 20px;
        font-size: 13.5px;
    }
    [dir="ltr"] .btn-floating-map {
        right: 20px;
        left: auto;
    }
    .map-modal-content {
        width: 95%;
    }
    .map-modal-body {
        padding: 12px;
    }
    .map-container-wrapper {
        height: 280px;
    }
}
