/* Оверлей карты на странице мастера */
.viewmaster-map-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-page, #0f0f12);
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.viewmaster-map-overlay.is-open {
    display: flex;
    opacity: 1;
}

.viewmaster-map-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-surface, #1a1a1f);
    border-bottom: 1px solid var(--border-color, #2a2a32);
}

.viewmaster-map-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary, #fff);
}

.viewmaster-map-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.viewmaster-map-close:hover {
    background: rgba(255, 255, 255, 0.14);
}

.viewmaster-map-container {
    flex: 1;
    min-height: 0;
    width: 100%;
}

.viewmaster-map-container .leaflet-container {
    height: 100%;
    width: 100%;
    background: #1a2332;
}

.viewmaster-map-card {
    flex-shrink: 0;
    padding: 12px 16px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.viewmaster-map-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.viewmaster-map-card-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.viewmaster-map-card-logo-placeholder {
    background: var(--accent-gradient, linear-gradient(135deg, #4a6fff 0%, #7c3aed 100%));
    color: #fff;
    font-weight: 700;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewmaster-map-card-info {
    min-width: 0;
    flex: 1;
}

.viewmaster-map-card-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewmaster-map-card-address {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewmaster-map-card-district {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.viewmaster-map-card-schedule {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.viewmaster-map-card-schedule i {
    margin-right: 4px;
    opacity: 0.8;
}

.viewmaster-map-card-book,
.btn-book-inline {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 12px;
    background: var(--accent-gradient, linear-gradient(135deg, #4a6fff 0%, #7c3aed 100%));
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s, opacity 0.15s;
}

.viewmaster-map-card-book:hover,
.btn-book-inline:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.viewmaster-map-card-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
}

.viewmaster-map-card-route {
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.viewmaster-map-card-distance {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.viewmaster-map-user-hint {
    position: absolute;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.viewmaster-map-user-hint.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.show-on-map-btn {
    margin-top: 8px;
    padding: 8px 14px;
    border: 1px solid var(--border-color, #2a2a32);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent-primary, #4a6fff);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, border-color 0.2s;
}

.show-on-map-btn:hover {
    background: rgba(74, 111, 255, 0.12);
    border-color: rgba(74, 111, 255, 0.4);
}

.show-on-map-btn i {
    font-size: 14px;
}

/* Яндекс.Карты контейнер */
.viewmaster-map-container [class*="ymaps"] {
    border-radius: 0 0 16px 16px;
}
@media (max-width: 767px) {
    .viewmaster-map-container [class*="ymaps"] {
        border-radius: 0;
    }
    .viewmaster-map-card-actions {
        grid-template-columns: 1fr;
    }
    .viewmaster-map-card-route,
    .viewmaster-map-card-book {
        width: 100%;
    }
    .viewmaster-map-card-distance {
        text-align: center;
    }
}

@media (min-width: 768px) {
    .viewmaster-map-overlay {
        padding: 20px;
        align-items: center;
        justify-content: center;
    }
    .viewmaster-map-overlay::before {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
    }
    .viewmaster-map-header,
    .viewmaster-map-container,
    .viewmaster-map-card {
        position: relative;
        z-index: 1;
    }
    .viewmaster-map-container {
        width: 90vw;
        max-width: 700px;
        height: 400px;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    }
    .viewmaster-map-card {
        width: 90vw;
        max-width: 700px;
        border-radius: 0 0 16px 16px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }
    .viewmaster-map-card-book {
        width: auto;
        min-width: 160px;
    }
    .viewmaster-map-user-hint {
        bottom: auto;
        top: 80px;
    }
}

/* Компактный контент балуна Яндекс.Карт */
.ym-balloon-master {
    min-width: 220px;
    max-width: 280px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ym-balloon-master-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.ym-balloon-master-avatar-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(135deg, #4a6fff 0%, #7c3aed 100%);
}

.ym-balloon-master-info {
    min-width: 0;
    font-size: 12px;
    color: #333;
}

.ym-balloon-master-name {
    font-weight: 700;
    font-size: 13px;
    color: #111;
    margin-bottom: 3px;
}

.ym-balloon-master-address,
.ym-balloon-master-district {
    color: #4b5563;
    line-height: 1.3;
}
