/**
 * TOCHKA Sheet Styles (v16.7.5)
 * Glassmorphism 2.0 & Reliability UI Engine
 * Added: AI Status Badges, OLED Optimized Colors, Safe Area Fixes
 * Added: Glass Danger Delete Button for Point Owners
 * Path: assets/css/sheet-v12.css
 * Sync: [2026-02-28] — Full lifecycle integration
 */

/* 1. Эффект "Глубины" (Cinema Depth) - плавно отодвигаем основную карту */
body.sheet-open #page {
    transform: scale(0.92) translateY(calc(env(safe-area-inset-top, 20px) * -1.2));
    filter: brightness(0.4) blur(10px);
    border-radius: 42px;
    transition: all 0.8s cubic-bezier(0.32, 0.72, 0, 1);
    pointer-events: none;
    overflow: hidden;
    position: fixed; 
    width: 100%;
    z-index: 1;
}

/* 2. Контейнер шторки (Ultra Glass & OLED Depth) */
.point-detail-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 94vh; 
    z-index: 9999;
    background: rgba(28, 28, 30, 0.75);
    backdrop-filter: blur(50px) saturate(190%) contrast(100%);
    -webkit-backdrop-filter: blur(50px) saturate(190%);
    border-radius: 38px 38px 0 0;
    border-top: 0.5px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 -15px 50px rgba(0, 0, 0, 0.9);
    transform: translateY(110%);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    overflow-y: auto;
    scrollbar-width: none; /* Hide scrollbar Firefox */
    -webkit-overflow-scrolling: touch; /* Плавный скролл iOS */
}

.point-detail-sheet::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome/Safari */

body.sheet-open .point-detail-sheet {
    transform: translateY(0);
}

/* Handle (Индикатор захвата) */
.sheet-handle {
    width: 36px;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    margin: 12px auto 8px;
    flex-shrink: 0;
}

/* Контентная область шторки */
.sheet-content {
    padding: 0 24px calc(180px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}

/* Шапка контента (Превью-изображение / Заглушка) */
.sheet-hero-image-container, .js-sheet-img-container {
    width: calc(100% + 48px);
    margin-left: -24px;
    height: 300px; /* Увеличено для Cinema Depth */
    position: relative;
    background: #111;
    overflow: hidden;
    margin-bottom: 24px;
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
    display: flex; 
    align-items: center;
    justify-content: center;
}

/* Скрытие дублирующих элементов-заглушек из ленты/карты */
.sheet-hero-image-container .no-photo-placeholder,
.sheet-hero-image-container .point-map-placeholder {
    display: none !important;
}

.sheet-hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    inset: 0;
    z-index: 2;
}

/* Парящая иконка категории над фото (Sync с лентой) */
.category-icon-floater {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    border: 0.5px solid rgba(255, 255, 255, 0.2);
}

.cat-icon-render {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* === GLASSMORPHISM 2.0 ENGINE START === */
.svg-placeholder-inline, .placeholder-central-unit {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at 50% 0%, #2c2c2e 0%, #0a0a0b 100%) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Зернистость дорогого стекла */
.svg-placeholder-inline::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
}

/* Световой блик (Sweep) */
.svg-placeholder-inline::after {
    content: '';
    position: absolute;
    top: -100%; left: -100%; width: 300%; height: 300%;
    background: linear-gradient(45deg, transparent 45%, rgba(255, 255, 255, 0.05) 48%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.05) 52%, transparent 55%);
    transform: rotate(-20deg);
    animation: glassSweep 10s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes glassSweep {
    0% { transform: translate(-20%, -20%) rotate(-20deg); }
    20%, 100% { transform: translate(20%, 20%) rotate(-20deg); }
}

.svg-placeholder-inline svg, .dynamic-placeholder-icon {
    filter: drop-shadow(0 0 30px var(--cat-color, rgba(0, 122, 255, 0.2)));
    z-index: 1;
    width: 64px;
    height: 64px;
    opacity: 0.5;
}

.placeholder-cat-name {
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    z-index: 1;
}

.cover-blur-edge {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 80px;
    background: linear-gradient(to bottom, transparent, #1c1c1e 95%);
    z-index: 3;
    pointer-events: none;
}
/* === GLASSMORPHISM 2.0 ENGINE END === */

/* Название точки */
.js-sheet-title {
    font-size: 28px;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.8px;
    line-height: 1.1;
    margin-bottom: 8px;
}

/* 3. Адрес и Дистанция */
.address-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin: 10px 0 20px;
}

.js-sheet-address {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    flex: 1;
}

.distance-badge {
    background: rgba(10, 132, 255, 0.15);
    color: #0A84FF;
    padding: 6px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(10, 132, 255, 0.25);
    white-space: nowrap;
    animation: badge-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 4. Лимиты и Прогресс (FOMO Logic) */
.limit-section {
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.limit-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #8e8e93;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.js-limit-progress {
    height: 100%;
    width: 0%; 
    background: linear-gradient(90deg, #34C759, #30D158);
    border-radius: 4px;
    transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 10px rgba(52, 199, 89, 0.3);
}

.is-urgent .js-limit-progress {
    background: linear-gradient(90deg, #FF9500, #FF3B30);
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.4);
}

/* 5. Reliability & AI Status Badges */
.status-row {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.author-trust-badge {
    font-size: 10px; font-weight: 800; padding: 5px 12px;
    border-radius: 12px; border: 1px solid currentColor; 
    background: rgba(0, 0, 0, 0.2); text-transform: uppercase;
    display: inline-flex; align-items: center;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    letter-spacing: 0.5px;
}

.is-high-trust { color: #34C759; }
.is-mid-trust { color: #FFD60A; }
.is-low-trust { 
    color: #FF453A;
    animation: trust-pulse 2s infinite;
}

/* 6. Описание */
.js-sheet-content {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    margin: 20px 0;
    white-space: pre-wrap; 
}

/* 7. Footer & Action Button */
.sheet-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 20px 24px calc(24px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, #1c1c1e 85%, transparent);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.js-join-btn {
    width: 100%; height: 60px; border-radius: 20px;
    font-weight: 700; font-size: 17px; letter-spacing: -0.4px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none; color: #fff;
    background: #0A84FF;
    box-shadow: 0 10px 25px rgba(10, 132, 255, 0.4);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.js-join-btn:active { 
    transform: scale(0.96); 
    filter: brightness(0.8); 
    box-shadow: 0 5px 10px rgba(10, 132, 255, 0.2);
}

/* === УПРАВЛЕНИЕ ДЛЯ ВЛАДЕЛЬЦА (Delete Section) === */

.owner-actions-area {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#delete-sheet-btn {
    display: none; /* Включается в sheet-controller.js */
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.2);
    color: #ff3b30;
    border-radius: 16px;
    padding: 14px;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    width: 100%;
    cursor: pointer;
    margin-top: 12px;
    position: relative;
    overflow: hidden;
}

#delete-sheet-btn:active {
    transform: scale(0.97);
    background: rgba(255, 59, 48, 0.2);
}

/* Спиннер загрузки */
#delete-sheet-btn.is-loading {
    color: transparent !important;
    pointer-events: none;
}

#delete-sheet-btn.is-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 50%;
    top: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 59, 48, 0.3);
    border-top-color: #ff3b30;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

.delete-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 8. Анимации */
@keyframes trust-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.02); }
}

@keyframes badge-pop {
    from { opacity: 0; transform: translateY(10px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* 9. OLED / High Contrast Fixes */
@media (prefers-contrast: high) {
    .point-detail-sheet { background: #1c1c1e; border-top: 1px solid #fff; }
}

/* 10. Поправка для ландшафтного режима */
@media (max-height: 500px) {
    .point-detail-sheet { height: 100vh; border-radius: 0; }
    .sheet-hero-image-container { height: 180px; }
    .sheet-footer { position: relative; padding-bottom: 24px; }
}

#mini-map-point {
    width: 100%; height: 180px; border-radius: 18px;
    margin: 15px 0; overflow: hidden;
    border: 0.5px solid rgba(255,255,255,0.1);
    background: #000;
}