/* 
 * PrintPlay Omniva Terminal Mapping Styles
 * Customizes the default plugin map to match the theme's premium design.
 */

/* The trigger button and selected container */
.omnivalt_terminal_container_map .tmjs-container {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    margin-bottom: 20px !important;
}

.omnivalt_terminal_container_map .tmjs-selected-terminal {
    font-weight: 500 !important;
    color: #334155 !important;
    font-size: 0.9rem !important;
    padding: 10px 14px !important;
    background: #f8fafc !important;
    border-radius: 8px !important;
    flex: 1 !important;
    border: 1px solid #e2e8f0 !important;
    line-height: 1.4 !important;
}

.omnivalt_terminal_container_map .tmjs-open-modal-btn {
    background: #133A7D !important;
    color: #ffffff !important;
    padding: 10px 18px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    border: none !important;
    display: inline-block !important;
    text-align: center !important;
    white-space: nowrap !important;
}

.omnivalt_terminal_container_map .tmjs-open-modal-btn:hover {
    background: #0f2e64 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px rgba(19, 58, 125, 0.15) !important;
    color: #ffffff !important;
}

/* The Modal Overlay */
.tmjs-modal {
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 999999 !important;
}

/* The Modal Content Window */
.tmjs-modal-content {
    background: #ffffff !important;
    border-radius: 20px !important;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.2) !important;
    overflow: hidden !important;
    border: none !important;
    max-width: 800px !important;
    width: 90% !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Modal Body Layout */
.tmjs-modal-body {
    display: flex !important;
    height: 520px !important;
    max-height: calc(90vh - 40px) !important;
    flex-direction: row !important;
}

/* Close Button Override */
.tmjs-close-modal-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    background: #f1f5f9 !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    top: 16px !important;
    right: 16px !important;
    opacity: 1 !important;
}

.tmjs-close-modal-btn:hover {
    background: #e2e8f0 !important;
}

.tmjs-close-modal-btn::before,
.tmjs-close-modal-btn::after {
    background: #64748b !important;
    height: 2px !important;
    width: 16px !important;
    left: 8px !important;
    top: 15px !important;
}

/* Sidebar Styling */
.tmjs-terminal-sidebar {
    width: 350px !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.05) !important;
    z-index: 10 !important;
    border-left: 1px solid #f1f5f9 !important;
}

/* Search Header Area */
.tmjs-terminal-finder {
    padding: 24px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    background: #f8fafc !important;
}

h2[data-tmjs-string="modal_header"] {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: #1a1a2e !important;
    margin-bottom: 16px !important;
    margin-top: 0 !important;
    padding-right: 24px !important;
}

h3[data-tmjs-string="seach_header"] {
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    margin-bottom: 8px !important;
    margin-top: 0 !important;
}

.tmjs-search-input {
    width: calc(100% - 48px) !important;
    height: 48px !important;
    border-radius: 12px 0 0 12px !important;
    border: 1px solid #cbd5e1 !important;
    padding: 0 16px !important;
    font-size: 1rem !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

.tmjs-search-input:focus {
    border-color: #133A7D !important;
    outline: none !important;
}

.tmjs-search-btn {
    width: 48px !important;
    height: 48px !important;
    background: #133A7D !important;
    border-radius: 0 12px 12px 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    float: right !important;
}

.tmjs-geolocation-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: #3b82f6 !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    margin-top: 12px !important;
    font-size: 0.95rem !important;
}

.tmjs-geolocation-btn:hover {
    color: #2563eb !important;
    text-decoration: underline !important;
}

/* Terminal List Block */
.tmjs-terminal-block {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

h3[data-tmjs-string="terminal_list_header"] {
    padding: 16px 24px !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    background: #ffffff !important;
    border-bottom: 1px solid #f1f5f9 !important;
    color: #1a1a2e !important;
}

.tmjs-terminal-list {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
}

/* Custom Scrollbar for list */
.tmjs-terminal-list::-webkit-scrollbar {
    width: 6px !important;
}

.tmjs-terminal-list::-webkit-scrollbar-track {
    background: #f8fafc !important;
}

.tmjs-terminal-list::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
    border-radius: 10px !important;
}

.tmjs-city {
    background: #f8fafc !important;
    padding: 10px 24px !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-top: 1px solid #e2e8f0 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
}

.tmjs-terminal-list .tmjs-city:first-child {
    border-top: none !important;
}

.tmjs-terminal {
    padding: 16px 24px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.tmjs-terminal:hover {
    background: #f8fafc !important;
}

.tmjs-terminal.active {
    background: #f0fdf4 !important;
    border-left: 4px solid #10B981 !important;
    padding-left: 20px !important;
    /* adjust for border */
}

.tmjs-terminal-name {
    font-weight: 600 !important;
    color: #334155 !important;
    font-size: 0.95rem !important;
    line-height: 1.4 !important;
}

/* The select button inside a terminal item */
.tmjs-select-btn {
    background: #10B981 !important;
    color: #ffffff !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    text-align: center !important;
    text-decoration: none !important;
    display: inline-block !important;
    margin-top: 4px !important;
    width: fit-content !important;
    transition: all 0.2s ease !important;
}

.tmjs-select-btn:hover {
    background: #059669 !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

/* Map specific tweaks */
.tmjs-map-container {
    flex: 1 !important;
    border-radius: 20px 0 0 20px !important;
    overflow: hidden !important;
}

.tmjs-map .leaflet-popup-content-wrapper {
    border-radius: 16px !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15) !important;
}

.tmjs-map .leaflet-popup-content {
    margin: 0 !important;
    padding: 16px !important;
}

.tmjs-map .leaflet-popup-content .tmjs-select-btn {
    display: block !important;
    margin-top: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .tmjs-modal {
        display: flex !important;
        align-items: flex-end !important;
        /* Align to bottom on mobile */
        justify-content: center !important;
        padding: 0 !important;
    }

    .tmjs-modal-content {
        max-width: 100% !important;
        width: 100% !important;
        height: 85vh !important;
        max-height: 85vh !important;
        border-radius: 20px 20px 0 0 !important;
        margin: 0 !important;
    }

    .tmjs-modal-body {
        flex-direction: column !important;
        height: 100% !important;
        max-height: 100% !important;
    }

    .tmjs-map-container {
        height: 40% !important;
        min-height: 40% !important;
        border-radius: 20px 20px 0 0 !important;
        flex: none !important;
    }

    .tmjs-terminal-sidebar {
        width: 100% !important;
        height: 60% !important;
        flex: 1 !important;
        border-left: none !important;
    }

    .tmjs-close-modal-btn {
        background: #ffffff !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
        top: 12px !important;
        right: 12px !important;
        z-index: 9999 !important;
    }

    .omnivalt_terminal_container_map .tmjs-container {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}