﻿/* site.css — production-ready стили для приложения (обновлено) */
/* Исправлено: скролл, скрытие панелей браузера, адаптивный AppBar, видеоплеер, медиа-галерея */
/* Исправлена проблема с gaps и белой полосой в home-carousel-wrapper */

/* ===== ГЛОБАЛЬНЫЕ СТИЛИ ===== */
html {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    font-family: 'Roboto', sans-serif;
    -webkit-overflow-scrolling: touch;
}

/* ===== LAYOUT ===== */
.mud-layout {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.mud-appbar {
    flex-shrink: 0;
    z-index: 1100;
}

.mud-badge {
    margin-top: -26px !important;
}

.mud-appbar .mud-icon-button {
    padding: 8px;
}

.mud-drawer {
    flex-shrink: 0;
}

.mud-main-content {
    flex: 1 1 auto;
    overflow-y: visible;
    overflow-x: hidden;
    padding-top: 16px;
}

.mud-paper {
    margin: 0 !important;
    border-radius: 0 !important;
}

/* ===== АДАПТИВНЫЙ ШРИФТ APPBAR ===== */
.appbar-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 600px) {
    .appbar-title {
        font-size: 1.05rem !important;
        line-height: 1.2;
        max-width: 140px;
    }
}

@media (min-width: 601px) and (max-width: 960px) {
    .appbar-title {
        font-size: 1.25rem !important;
    }
}

/* ===== ОБЁРТКА КАРУСЕЛИ НА ГЛАВНОЙ (исправленная версия — без gaps и белой полосы) ===== */
.home-carousel-wrapper {
    height: calc(100dvh - var(--mud-appbar-height, 64px));
    width: 100% !important;
    margin: -16px -16px 0 -16px !important; /* компенсируем pa-4 из MainLayout */
    padding: 0 !important;
    border-radius: 0 !important;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

@supports not (height: 1dvh) {
    .home-carousel-wrapper {
        height: calc(100vh - var(--mud-appbar-height, 64px));
    }
}

/* Мобильный режим */
@media (max-width: 600px) {
    .home-carousel-wrapper {
        height: calc(100dvh - var(--mud-appbar-height, 56px));
        margin: -16px -16px 0 -16px !important;
        width: calc(100% + 32px) !important;
    }
}

/* Десктоп и планшет (когда drawer открыт) */
@media (min-width: 601px) {
    .home-carousel-wrapper {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }
}


/* ===== КАСТОМИЗАЦИЯ СТРЕЛОК В MUDCAROUSEL ===== */
.home-carousel-wrapper .mud-carousel .mud-carousel-elements .mud-carousel-arrow {
    background-color: rgba(0, 0, 0, 0.4) !important; /* фон стрелки */
    color: #ffffff !important; /* цвет иконки стрелки */
    width: 48px !important; /* размер кнопки */
    height: 48px !important;
    border-radius: 50% !important; /* круглые стрелки (по желанию) */
    transition: all 0.2s ease;
}

    .home-carousel-wrapper .mud-carousel .mud-carousel-elements .mud-carousel-arrow:hover {
        background-color: rgba(0, 0, 0, 0.65) !important;
        transform: scale(1.08);
    }

    /* Увеличение самой иконки внутри стрелки */
    .home-carousel-wrapper .mud-carousel .mud-carousel-elements .mud-carousel-arrow .mud-icon {
        font-size: 48px !important; /* размер иконки (по умолчанию ~24px) */
    }


/* ===== СТИЛИ ДЛЯ КАРТЫ ПОСТОВ (Leaflet) ===== */
.post-map-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 300px;
    border-radius: 8px;
    overflow: hidden;
}

.custom-marker {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: all 0.3s ease;
}

    .custom-marker:hover {
        filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
        transform: scale(1.1);
    }

.edit-center-marker,
.leaflet-marker-pane .edit-center-marker {
    z-index: 1000 !important;
}

.edit-marker-inner {
    position: relative;
    width: 44px;
    height: 44px;
}

.edit-marker-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #3388ff;
    opacity: 0.3;
    animation: marker-pulse 2s infinite;
    z-index: 999 !important;
}

@keyframes marker-pulse {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.1;
    }

    100% {
        transform: scale(1);
        opacity: 0.3;
    }
}

.radius-circle,
.leaflet-overlay-pane .radius-circle {
    z-index: 900 !important;
}

.radius-circle {
    stroke-dasharray: 10, 10;
    animation: circle-dash 20s linear infinite;
}

@keyframes circle-dash {
    to {
        stroke-dashoffset: -1000;
    }
}

.post-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
}

.post-popup-content {
    padding: 12px;
    min-width: 200px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    float: left;
    margin-right: 12px;
    object-fit: cover;
}

.post-info {
    overflow: hidden;
}

.post-author {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}

.post-title {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
    line-height: 1.3;
}

.post-price {
    font-size: 12px;
    color: #4caf50;
    font-weight: 500;
}

.post-preview {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-top: 8px;
}

.edit-marker-popup-container .leaflet-popup,
.edit-marker-popup-container .leaflet-popup-content-wrapper,
.radius-popup-container .leaflet-popup,
.radius-popup-container .leaflet-popup-content-wrapper {
    z-index: 1100 !important;
}

/* ===== СТИЛИ ДЛЯ КАРУСЕЛИ (MudCarousel) ===== */
.mud-carousel,
.mud-carousel .mud-carousel-elements,
.mud-carousel .mud-carousel-item {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.mud-carousel {
    height: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
}

.mud-carousel-item {
    height: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.mud-carousel .mud-carousel-elements .mud-carousel-bullet-container {
    bottom: 20px !important;
    z-index: 10;
}

.mud-carousel .mud-carousel-bullet {
    background-color: rgba(255, 255, 255, 0.5) !important;
}

.mud-carousel .mud-carousel-bullet-active {
    background-color: white !important;
}

.mud-carousel .mud-carousel-elements .mud-carousel-arrow {
    background-color: rgba(0, 0, 0, 0.3) !important;
    color: white !important;
    z-index: 10;
}

    .mud-carousel .mud-carousel-elements .mud-carousel-arrow:hover {
        background-color: rgba(0, 0, 0, 0.5) !important;
    }

@media (max-width: 600px) {
    .mud-carousel .mud-carousel-elements .mud-carousel-arrow {
        display: none;
    }

    .mud-carousel .mud-carousel-elements .mud-carousel-bullet-container {
        bottom: 10px !important;
    }

    .post-map-container {
        min-height: 250px;
    }
}

/* ===== СТИЛИ СЛАЙДОВ КАРУСЕЛИ (исправлено) ===== */
.slide-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.slide-picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    border-radius: 0 !important;
    display: block;
}

.slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 5rem 4rem 7rem 4rem;
    box-sizing: border-box;
    pointer-events: none;
    border-radius: 0 !important;
}

.slide-content {
    pointer-events: auto;
    max-width: 520px;
    width: 100%;
    box-sizing: border-box;
    text-align: right;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.slide-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.slide-subtitle {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.slide-button {
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
    text-transform: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@media (max-width: 960px) {
    .slide-overlay {
        padding: 2.5rem 2rem 5rem 2rem;
    }

    .slide-content {
        max-width: 420px;
    }
}

@media (max-width: 600px) {
    .slide-container {
        flex-direction: column;
    }

    .slide-overlay {
        align-items: flex-end;
        justify-content: center;
        padding: 1.25rem 1.25rem 3rem 1.25rem;
        background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.35) 60%, transparent 100%);
    }

    .slide-content {
        text-align: center;
        max-width: 100%;
    }

    .slide-title {
        font-size: 1.6rem;
    }

    .slide-subtitle {
        font-size: 1.2rem;
        margin-bottom: 1rem;
        line-height: 1.3;
    }

    .slide-button {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
        font-size: 0.95rem;
        padding: 0.6rem 1.5rem;
    }

    div.mud-carousel .mud-carousel-elements .mud-carousel-bullet-container {
        display: none !important;
    }
}

/* Кастомные позиции контента в слайдах */
.slide-content.top-left {
    align-items: flex-start;
    justify-content: flex-start;
}

.slide-content.top-right {
    align-items: flex-start;
    justify-content: flex-end;
}

.slide-content.center {
    align-items: center;
    justify-content: center;
}

.slide-content.bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
}

.slide-content.bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
}

/* ===== ПРИНУДИТЕЛЬНАЯ ОЧИСТКА КАРУСЕЛИ (самое важное для устранения gaps) ===== */
.home-carousel-wrapper .mud-carousel,
.home-carousel-wrapper .mud-carousel .mud-carousel-elements,
.home-carousel-wrapper .mud-carousel-item,
.home-carousel-wrapper .slide-container,
.home-carousel-wrapper .slide-picture,
.home-carousel-wrapper .slide-image {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    overflow: hidden;
}

.slide-image {
    object-fit: cover;
    object-position: center center;
    display: block;
}





/* ===== ВИДЕОПЛЕЕР, МЕДИА ГАЛЕРЕЯ и УТИЛИТЫ (оставлены без изменений) ===== */
.video-player-dialog .mud-dialog {
    background: #000 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    margin: 0 !important;
}

.video-player-dialog .mud-dialog-title {
    display: none !important;
}

.video-player-dialog-content {
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    background: #000 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-player-dialog .mud-dialog-actions {
    display: none !important;
}

.video-player-wrapper {
    position: relative;
    width: 100vw;
    height: 100dvh;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

@supports not (height: 1dvh) {
    .video-player-wrapper {
        height: 100vh;
    }
}

.video-player-element {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100dvh;
    object-fit: contain;
    background: #000;
    display: block;
    outline: none;
}

@supports not (height: 1dvh) {
    .video-player-element {
        max-height: 100vh;
    }
}

.video-close-button {
    position: absolute !important;
    top: 12px;
    right: 12px;
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.6) !important;
    color: #fff !important;
    border-radius: 50% !important;
    backdrop-filter: blur(4px);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

    .video-close-button:hover {
        background-color: rgba(0, 0, 0, 0.85) !important;
        transform: scale(1.1);
    }

@media (max-width: 600px) {
    .video-player-wrapper {
        width: 100vw;
        height: 100dvh;
    }

    .video-close-button {
        top: 8px;
        right: 8px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .video-close-button {
        top: 4px;
        right: 4px;
    }
}

.video-player-backdrop {
    background-color: rgba(0, 0, 0, 0.95) !important;
}

/* ===== МЕДИА ГАЛЕРЕЯ ===== */
.media-gallery-dialog .mud-dialog-content {
    padding: 8px !important;
    overflow-y: auto;
}

.media-gallery-dialog-content {
    padding: 8px !important;
}

.media-gallery-table-wrapper {
    max-height: calc(100dvh - 180px);
    overflow-y: auto;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 4px;
}

@supports not (height: 1dvh) {
    .media-gallery-table-wrapper {
        max-height: calc(100vh - 180px);
    }
}

.media-gallery-table-preview {
    width: 160px;
    height: 100px;
    overflow: hidden;
    border-radius: 4px;
}

.media-gallery-loading,
.media-gallery-empty {
    min-height: 40vh;
}

.media-gallery-card {
    height: 100%;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

    .media-gallery-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    }

.media-gallery-card-image {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 75%;
    overflow: hidden;
    background: #f5f5f5;
    cursor: zoom-in;
}

.media-gallery-card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.media-gallery-card-image:hover .media-gallery-card-img {
    transform: scale(1.03);
}

.media-gallery-video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

    .media-gallery-video-wrapper img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.media-gallery-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(89, 74, 226, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

    .media-gallery-play-overlay:hover {
        background: rgba(89, 74, 226, 1);
        transform: translate(-50%, -50%) scale(1.1);
    }

.media-gallery-card-info {
    padding: 8px 12px 8px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.upload-button-mobile {
    min-width: 160px;
    min-height: 48px;
}

@media (max-width: 600px) {
    .media-gallery-card-image {
        padding-bottom: 100%;
    }

    .media-gallery-table-wrapper {
        max-height: calc(100dvh - 160px);
    }

    .media-gallery-card-info {
        padding: 6px 8px 6px;
    }

    .media-gallery-play-overlay {
        width: 44px;
        height: 44px;
    }
}

/* ===== УТИЛИТЫ ===== */
.size-props-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(40px, 1fr);
    gap: 0.1rem;
    align-items: center;
}

.prop-item {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    min-width: 0;
}

.prop-label {
    flex-shrink: 0;
    white-space: nowrap;
}

.prop-value {
    font-weight: 500;
    word-break: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 600px) {
    .size-props-grid {
        grid-auto-flow: row;
        grid-template-columns: 1fr;
    }
}

.dialog-background {
    backdrop-filter: blur(10px);
}
