/**
 * MetaShip Widget Styles
 * 
 * BEM naming convention with .msw- prefix
 * 
 * @package MetaShip_Delivery
 */

/* CSS Variables */
:root {
    --msw-primary: #5a9aa8;
    --msw-primary-dark: #4a8a98;
    --msw-secondary: #f5f5f5;
    --msw-text: #333333;
    --msw-text-muted: #666666;
    --msw-border: #e0e0e0;
    --msw-success: #4caf50;
    --msw-error: #f44336;
    --msw-radius: 8px;
    --msw-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --msw-transition: 0.2s ease;
}

/* Widget Container */
.msw-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--msw-text);
}

/* Trigger Button */
.msw-trigger-container {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.msw-select-point-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--msw-primary);
    color: #fff;
    border: none;
    border-radius: var(--msw-radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--msw-transition);
    box-shadow: 0 2px 6px rgba(0, 102, 204, 0.2);
}

.msw-select-point-btn:hover {
    background: var(--msw-primary-dark);
    box-shadow: 0 4px 10px rgba(0, 102, 204, 0.3);
    transform: translateY(-1px);
}

.msw-select-point-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.msw-selected-point {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--msw-success);
}

.msw-selected-point .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Modal */
.msw-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

body.msw-modal-open {
    overflow: hidden;
}

.msw-modal {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    background: #fff;
    border-radius: var(--msw-radius);
    box-shadow: var(--msw-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.msw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--msw-border);
}

.msw-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.msw-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--msw-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color var(--msw-transition);
}

.msw-modal-close:hover {
    color: var(--msw-text);
}

.msw-modal-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    /* For absolute positioning of map/list on mobile */
    display: flex;
    flex-direction: column;
}

/* Filters - INSIDE Sidebar (Desktop) */
.metaship-filters-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--msw-border);
    background: #f8f9fa;
}

.metaship-filter-label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Carrier Checkboxes Container */
.metaship-carrier-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

/* Individual Carrier Box - Compact for Desktop */
.metaship-carrier-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.metaship-carrier-box:hover {
    border-color: var(--msw-primary);
    color: var(--msw-primary);
}

.metaship-carrier-box.active {
    border-color: var(--msw-primary);
    background: #e8f0fe;
    color: var(--msw-primary);
}

.metaship-carrier-box input[type="checkbox"] {
    display: none;
}

.msw-filter-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0f0f0;
    border: 1px solid transparent;
    border-radius: 16px;
    font-size: 12px;
    color: var(--msw-text);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.msw-filter-item:hover {
    background: #e0e0e0;
}

.msw-filter-item.active {
    background: var(--msw-primary);
    color: #fff;
    border-color: var(--msw-primary);
}

.msw-filter-item.active:hover {
    background: var(--msw-primary-dark);
}

/* Tabs */
.msw-tabs {
    display: flex;
    padding: 12px 20px;
    gap: 8px;
    border-bottom: 1px solid var(--msw-border);
}

.msw-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--msw-secondary);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--msw-text-muted);
    transition: all var(--msw-transition);
}

.msw-tab.active {
    background: var(--msw-primary);
    color: #fff;
}

.msw-tab:hover:not(.active) {
    background: #e8e8e8;
}

.msw-tab .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Search */
.msw-search {
    position: relative;
    padding: 12px 20px;
}

.msw-search-input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid var(--msw-border);
    border-radius: var(--msw-radius);
    font-size: 14px;
    outline: none;
    transition: border-color var(--msw-transition);
}

.msw-search-input:focus {
    border-color: var(--msw-primary);
}

.msw-search-icon {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--msw-text-muted);
}

/* Content Areas */
.msw-content {
    display: none;
    flex: 1;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.msw-content.active {
    display: flex;
    flex-direction: column;
}

/* Mobile List Toggle Button */
.msw-mobile-list-toggle {
    display: none;
}

/* List View */
.msw-content-list {
    padding: 0 20px 20px;
}

.msw-points-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

/* Point Card */
.msw-point-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--msw-border);
    border-radius: var(--msw-radius);
    margin-bottom: 8px;
    transition: border-color var(--msw-transition), box-shadow var(--msw-transition);
    cursor: pointer;
}

.msw-point-card:hover {
    border-color: var(--msw-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.msw-point-carrier {
    flex-shrink: 0;
}

.msw-point-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
}

.msw-point-details {
    flex: 1;
    min-width: 0;
}

.msw-point-address {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msw-point-hours {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--msw-text-muted);
}

.msw-point-hours .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.msw-point-action {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.msw-point-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--msw-primary);
}

.msw-point-select {
    padding: 6px 14px;
    background: var(--msw-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background var(--msw-transition);
}

.msw-point-select:hover {
    background: var(--msw-primary-dark);
}

/* Map View */
.msw-content-map {
    position: relative;
}

.msw-map {
    height: 400px;
    width: 100%;
    background: var(--msw-secondary);
}

/* Custom Marker */
.msw-marker {
    background: none;
    border: none;
}

.msw-marker-icon {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.msw-marker-icon img {
    width: 18px;
    height: 18px;
    transform: rotate(45deg);
    border-radius: 2px;
}

/* Point Info Panel (on map) */
.msw-point-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: #fff;
    padding: 16px;
    border-radius: var(--msw-radius);
    box-shadow: var(--msw-shadow);
    z-index: 1000;
}

.msw-point-info-carrier {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.msw-point-info-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.msw-point-info-name {
    font-weight: 600;
}

.msw-point-info-address {
    margin-bottom: 4px;
}

.msw-point-info-hours {
    font-size: 12px;
    color: var(--msw-text-muted);
    margin-bottom: 8px;
}

.msw-point-info-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--msw-primary);
    margin-bottom: 12px;
}

.msw-select-this-point {
    width: 100%;
    padding: 12px;
    background: var(--msw-primary);
    color: #fff;
    border: none;
    border-radius: var(--msw-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background var(--msw-transition);
}

.msw-select-this-point:hover {
    background: var(--msw-primary-dark);
}

/* Loading & Error States */
.msw-loading,
.msw-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    color: var(--msw-text-muted);
    width: 100%;
}

.msw-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--msw-border);
    border-top-color: var(--msw-primary);
    border-radius: 50%;
    animation: msw-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes msw-spin {
    to {
        transform: rotate(360deg);
    }
}

.msw-error .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    color: var(--msw-error);
}

/* Responsive */
@media (max-width: 768px) {
    .msw-modal {
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }

    .msw-modal-overlay {
        padding: 0;
    }

    /* Compact Header */
    .msw-modal-header {
        padding: 8px 12px;
        min-height: 48px;
    }

    .msw-modal-title {
        font-size: 15px;
    }

    .msw-modal-close {
        font-size: 24px;
        padding: 4px;
    }

    /* Compact Search & Filters */
    .msw-search {
        padding: 6px 12px;
    }

    .msw-search-input {
        padding: 6px 32px 6px 12px;
        font-size: 13px;
        height: 34px;
    }

    .msw-search-icon {
        right: 24px;
        font-size: 16px;
    }

    .msw-content-list {
        padding: 0 12px 12px;
    }

    .msw-point-card {
        flex-wrap: wrap;
    }

    .msw-point-details {
        width: 100%;
        order: 3;
    }

    .msw-point-action {
        flex-direction: row;
        align-items: center;
        width: auto;
    }

    .msw-points-list {
        max-height: none;
    }

    .msw-map {
        height: 300px;
    }

    .msw-modal-body {
        position: relative;
    }

    /* Mobile Filters (Select) */
    .msw-mobile-filters {
        display: block;
        padding: 8px 12px 0;
    }

    .msw-carrier-select {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid #ddd;
        border-radius: 8px;
        font-size: 14px;
        background-color: #f9f9f9;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
        background-repeat: no-repeat;
        background-position: right .7em top 50%;
        background-size: .65em auto;
    }

    /* Hide Desktop Filters on Mobile */
    .msw-filters {
        display: none;
    }

    /* Tabs are hidden on mobile, we use Map by default + Toggle */
    .msw-tabs {
        display: none !important;
    }


    /* Map takes full space */
    .msw-content-map {
        display: block !important;
        position: absolute !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100% !important;
        z-index: 1;
        padding-top: 110px;
        /* Space for Header + Search + Select */
    }

    .msw-map {
        height: 100% !important;
    }

    /* List acts as a bottom sheet */
    .msw-content-list {
        display: block !important;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 70%;
        /* Takes 70% of screen when opened */
        background: #fff;
        z-index: 20;
        transform: translateY(110%);
        /* Hidden by default */
        transition: transform 0.3s ease-in-out;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
        padding-top: 10px;
    }

    /* Class added by JS to show list */
    .msw-show-list .msw-content-list {
        transform: translateY(0);
    }

    /* Mobile Toggle Button */
    .msw-mobile-list-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 10;
        padding: 8px 16px;
        background: #fff;
        color: var(--msw-text);
        border: 1px solid #eee;
        border-radius: 20px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
        font-weight: 500;
        font-size: 13px;
        cursor: pointer;
        transition: bottom 0.3s ease;
    }

    /* Hide toggle when point info is open */
    .msw-point-selected .msw-mobile-list-toggle {
        display: none;
    }

    .msw-point-info {
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
        z-index: 30;
        /* Above list */
        padding: 16px;
        max-height: 40vh;
        overflow-y: auto;
    }

    .msw-select-this-point {
        padding: 10px;
        width: 100%;
        margin-top: 8px;
    }
}

/* Utilities */
.msw-hidden {
    display: none !important;
}

/* ========================================
   MetaShip Pickup Modal (New Design)
   ======================================== */

/* Inline PVZ button in checkout */
.metaship-pvz-row {
    margin: 6px 0 0 28px;
    font-size: 13px;
    line-height: 1.4;
}

.metaship-pvz-link {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.metaship-pvz-selected {
    color: #2e7d32;
    font-size: 12px;
}

.metaship-pvz-btn {
    color: #0066cc;
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
}

.metaship-pvz-btn:hover {
    color: #004499;
}

/* Modal Overlay */
.metaship-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.metaship-modal.active {
    display: flex;
}

body.metaship-modal-open {
    overflow: hidden;
}

/* Modal Dialog - Fullscreen for better map experience */
.metaship-modal-dialog {
    width: 100%;
    max-width: 95vw;
    height: 90vh;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.metaship-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e8f5f7;
    background: #fff;
}

.metaship-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.metaship-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #9ecbd5;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.metaship-modal-close:hover {
    background: #e8f5f7;
    color: #5a9aa8;
}

/* Modal Body - Split Layout */
.metaship-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 400px;
}

.metaship-modal-sidebar {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e5e5;
}

.metaship-search-box {
    padding: 12px;
    border-bottom: 1px solid #e5e5e5;
}

.metaship-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.metaship-search-input:focus {
    border-color: #0066cc;
}

.metaship-points-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* Point Items */
.metaship-point-item {
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.metaship-point-item:hover {
    border-color: #0066cc;
    background: #f8f9ff;
    transform: translateX(2px);
}

.metaship-point-item.selected {
    border-color: var(--msw-primary);
    border-width: 2px;
    background: linear-gradient(135deg, #e8f0fe 0%, #f0f7ff 100%);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15), 0 4px 12px rgba(0, 102, 204, 0.2);
    transform: scale(1.02);
}

/* Pulse highlight animation for newly selected item */
.metaship-point-item.pulse-highlight {
    animation: pulseHighlight 1s ease-out;
}

@keyframes pulseHighlight {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15), 0 4px 12px rgba(0, 102, 204, 0.2);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(0, 102, 204, 0.3), 0 6px 20px rgba(0, 102, 204, 0.4);
        transform: scale(1.03);
    }
}

.metaship-point-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.metaship-carrier-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    white-space: nowrap;
    min-height: 24px;
    background: #fff;
    border: 1px solid #e0e0e0;
}

/* Logo inside badge */
.metaship-carrier-badge .metaship-carrier-logo {
    height: 20px;
    width: auto;
    max-width: 60px;
    object-fit: contain;
    /* No filter - show original logo colors */
}

/* Remove brand color backgrounds - logos show on white */
.metaship-carrier-badge[style*="00A344"],
.metaship-carrier-badge[style*="005BA9"],
.metaship-carrier-badge[style*="D40511"],
.metaship-carrier-badge[style*="FF6B00"] {
    background-color: #fff !important;
    border-color: #e0e0e0 !important;
}

.metaship-point-name {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    flex: 1;
    min-width: 0;
}

.metaship-point-price {
    font-weight: 700;
    font-size: 14px;
    color: #0066cc;
    white-space: nowrap;
}

.metaship-point-address {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.metaship-point-time {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

.metaship-point-days {
    font-size: 11px;
    color: #0066cc;
    margin-top: 2px;
    font-weight: 500;
}

.metaship-postal {
    color: #0066cc;
    font-weight: 500;
    font-size: 12px;
}

/* Map Container */
.metaship-modal-map {
    flex: 1;
    min-width: 0;
    background: #f0f0f0;
}

#metaship-map-container {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

.metaship-map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 14px;
}

.metaship-map-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #f8f9fa;
    gap: 16px;
}

.metaship-map-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e8f5f7;
    border-top-color: #9ecbd5;
    border-radius: 50%;
    animation: metaship-spin 1s linear infinite;
}

.metaship-map-loading-text {
    color: #5a9aa8;
    font-size: 14px;
    font-weight: 500;
}

/* Modal Footer */
.metaship-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e8f5f7;
    background: #fff;
}

/* Yandex balloon content (our inner markup) */
.metaship-balloon {
    box-sizing: border-box;
    max-width: 280px;
    padding: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: #333;
}

.metaship-balloon-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.metaship-balloon-carrier {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.metaship-balloon-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--msw-primary);
    margin: 6px 0;
}

.metaship-balloon-address {
    font-size: 13px;
    color: #555;
    line-height: 1.35;
    margin: 6px 0 8px;
}

.metaship-balloon-hours {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
}

.metaship-balloon-select-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #9ecbd5;
    color: #fff !important;
    border: 1px solid #9ecbd5;
    border-radius: 22px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.metaship-balloon-select-btn:hover {
    background: #5a9aa8;
    border-color: #5a9aa8;
    color: #fff !important;
}

.metaship-balloon-select-btn:active {
    background: #4a8a98;
    border-color: #4a8a98;
    color: #fff !important;
}

.metaship-btn {
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.metaship-btn-cancel {
    background: #fff;
    border-color: #9ecbd5;
    color: #5a9aa8;
}

.metaship-btn-cancel:hover {
    background: #e8f5f7;
}

.metaship-btn-primary {
    background: var(--msw-primary);
    color: #fff !important;
    border-color: var(--msw-primary);
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25);
}

.metaship-btn-primary:focus {
    outline: none !important;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25) !important;
}

.metaship-btn-primary:active {
    outline: none !important;
    box-shadow: 0 1px 4px rgba(0, 102, 204, 0.3) !important;
    transform: translateY(1px);
}

.metaship-btn-primary:hover:not(:disabled) {
    background: var(--msw-primary-dark);
    border-color: var(--msw-primary-dark);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.35);
}

.metaship-btn-primary:disabled {
    background: #b8d8df;
    border-color: #b8d8df;
    color: #fff !important;
    cursor: not-allowed;
    box-shadow: none;
}

/* Loading & Empty States */
.metaship-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
    gap: 10px;
}

.metaship-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e8f5f7;
    border-top-color: #9ecbd5;
    border-radius: 50%;
    animation: metaship-spin 0.8s linear infinite;
}

@keyframes metaship-spin {
    to {
        transform: rotate(360deg);
    }
}

.metaship-empty,
.metaship-error {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

.metaship-error {
    color: #c00;
}

/* ========================================
   Theme Isolation — High-specificity overrides
   Prevents WooCommerce themes from breaking modal UI.
   Scoped to #metaship-pvz-modal for max specificity.
   ======================================== */

/* Modal dialog fundamentals */
#metaship-pvz-modal .metaship-modal-dialog {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: #333 !important;
    box-sizing: border-box !important;
}

#metaship-pvz-modal .metaship-modal-dialog *,
#metaship-pvz-modal .metaship-modal-dialog *::before,
#metaship-pvz-modal .metaship-modal-dialog *::after {
    box-sizing: border-box !important;
}

/* Header */
#metaship-pvz-modal .metaship-modal-header {
    background: #fff !important;
    border-bottom: 1px solid #e8f5f7 !important;
}

#metaship-pvz-modal .metaship-modal-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

#metaship-pvz-modal .metaship-modal-close {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

/* Buttons — themes love to restyle these */
#metaship-pvz-modal .metaship-btn {
    border-radius: 24px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
}

#metaship-pvz-modal .metaship-btn-primary {
    background: var(--msw-primary) !important;
    color: #fff !important;
    border-color: var(--msw-primary) !important;
    border-radius: 24px !important;
}

#metaship-pvz-modal .metaship-btn-primary:hover:not(:disabled) {
    background: var(--msw-primary-dark) !important;
    border-color: var(--msw-primary-dark) !important;
    color: #fff !important;
}

#metaship-pvz-modal .metaship-btn-primary:disabled {
    background: #b8d8df !important;
    border-color: #b8d8df !important;
    color: #fff !important;
}

#metaship-pvz-modal .metaship-btn-cancel {
    background: #fff !important;
    border-color: #9ecbd5 !important;
    color: #5a9aa8 !important;
    border-radius: 24px !important;
}

#metaship-pvz-modal .metaship-btn-cancel:hover {
    background: #e8f5f7 !important;
    color: #5a9aa8 !important;
}

/* Search input */
#metaship-pvz-modal .metaship-search-input {
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    background: #fff !important;
    color: #333 !important;
    font-size: 14px !important;
    box-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none !important;
}

#metaship-pvz-modal .metaship-search-input:focus {
    border-color: #0066cc !important;
    box-shadow: none !important;
}

/* Point items in sidebar */
#metaship-pvz-modal .metaship-point-item {
    border: 1px solid #e5e5e5 !important;
    border-radius: 8px !important;
    background: #fff !important;
    text-decoration: none !important;
}

#metaship-pvz-modal .metaship-point-item:hover {
    border-color: #0066cc !important;
    background: #f8f9ff !important;
}

#metaship-pvz-modal .metaship-point-item.selected {
    border-color: var(--msw-primary) !important;
    border-width: 2px !important;
    background: linear-gradient(135deg, #e8f0fe 0%, #f0f7ff 100%) !important;
}

/* Carrier badge */
#metaship-pvz-modal .metaship-carrier-badge {
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
}

/* Point text elements */
#metaship-pvz-modal .metaship-point-name {
    font-weight: 600 !important;
    font-size: 13px !important;
    color: #333 !important;
}

#metaship-pvz-modal .metaship-point-price {
    font-weight: 700 !important;
    color: #0066cc !important;
}

#metaship-pvz-modal .metaship-point-address {
    font-size: 12px !important;
    color: #666 !important;
}

#metaship-pvz-modal .metaship-point-days {
    font-size: 11px !important;
    color: #0066cc !important;
}

/* Footer */
#metaship-pvz-modal .metaship-modal-footer {
    background: #fff !important;
    border-top: 1px solid #e8f5f7 !important;
}

/* Balloon (inside Yandex Maps DOM, outside our modal — need global isolation) */
.metaship-balloon {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif !important;
    color: #333 !important;
    box-sizing: border-box !important;
}

.metaship-balloon-select-btn {
    border-radius: 22px !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    text-decoration: none !important;
}

/* Hide mobile topbar on desktop to avoid duplication */
.metaship-mobile-topbar {
    display: none;
}

/* Responsive */
/* Responsive (Strict Map-First for Legacy Modal) */
@media (max-width: 768px) {
    .metaship-modal {
        padding: 0;
    }

    /* Mobile topbar overlay (filters + list toggle) - show ONLY on mobile */
    .metaship-mobile-topbar {
        display: block;
        position: absolute;
        top: 0; /* moved closer to top for more map space */
        left: 0;
        right: 0;
        z-index: 15;
        padding: 0 12px; /* no vertical padding to maximize map space */
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(6px);
        border-bottom: 1px solid #e0e0e0;
    }

    .metaship-mobile-topbar-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 6px 0; /* vertical padding moved here from parent */
    }

    .metaship-mobile-filters {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
    }

    .metaship-carrier-checkboxes-mobile {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
        padding-bottom: 2px;
    }

    .metaship-mobile-toggle {
        position: static;
        transform: none;
        left: auto;
        bottom: auto;
        z-index: 16;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 8px 12px;
        background: #fff;
        color: var(--msw-text);
        border: 1px solid #eee;
        border-radius: 20px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.10);
        font-weight: 500;
        font-size: 13px;
        cursor: pointer;
        white-space: nowrap;
    }

    .metaship-modal-dialog {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
    }

    .metaship-modal-body {
        position: relative;
        flex-direction: column;
        display: block;
        /* Use block to allow absolute positioning of children */
    }

    /* MAP takes full space */
    .metaship-modal-map {
        position: absolute !important;
        top: 92px; /* Header (~50px) + Mobile topbar (~42px with padding) = ~92px */
        left: 0;
        right: 0;
        bottom: 0;
        height: auto !important; /* Let it fill remaining space */
        z-index: 1;
    }

    #metaship-map-container {
        height: 100% !important;
        min-height: 100% !important;
    }

    /* LIST acts as bottom sheet */
    .metaship-modal-sidebar {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 70%;
        background: #fff;
        z-index: 20;
        border-right: none;
        border-top: 1px solid #e5e5e5;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
        transform: translateY(110%);
        transition: transform 0.3s ease-in-out;
        display: flex;
        flex-direction: column;
    }

    /* Class added by JS to show list */
    .metaship-show-list .metaship-modal-sidebar {
        transform: translateY(0);
    }

    /* Mobile: Hide inline filters, show mobile toggle */
    .metaship-filters-inline {
        display: none !important;
    }
    
    /* Mobile toggle button is rendered in the topbar now.
       (Old bottom-floating button removed to avoid duplicate/conflicting styles.) */

    /* Adjust Search Box in Sidebar */
    .metaship-search-box {
        padding: 8px 12px;
    }

    .metaship-pvz-row {
        margin-left: 0;
    }

    .metaship-modal-header {
        padding: 10px 12px;
        min-height: 50px;
    }

    .metaship-modal-title {
        font-size: 16px;
    }
}