/* =============================================
   RIGA PET MAP — Main Stylesheet
   =============================================
   Sections:
   1. CSS Variables & Theme
   2. Base & Map
   3. Filter Bar (Glassmorphism)
   4. Floating Action Buttons (FAB)
   5. Bottom Sheet
   6. Sheet Content (typography, image, buttons)
   7. Add Place Form
   8. Location Pick Mode (crosshair, OK button)
   9. Leaflet Overrides
   ============================================= */


/* 1. CSS Variables & Theme */
:root {
    --bg-color: var(--tg-theme-bg-color, #ffffff);
    --text-color: var(--tg-theme-text-color, #000000);
    --hint-color: var(--tg-theme-hint-color, #999999);
    --button-color: var(--tg-theme-button-color, #0088cc);
    --button-text-color: var(--tg-theme-button-text-color, #ffffff);
    --sheet-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root {
        --sheet-bg: #1c1c1d;
        --text-color: #ffffff;
        --hint-color: #aaaaaa;
    }
}


/* 2. Base & Map */
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

#mapdiv {
    height: 100vh;
    width: 100%;
    z-index: 1;
}


/* 3. Filter Bar (Glassmorphism) */
.filter-container {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    z-index: 1000;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    white-space: nowrap;
    scrollbar-width: none;
}
.filter-container::-webkit-scrollbar { display: none; }

.filter-btn {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.filter-btn:active { transform: scale(0.95); }
.filter-btn.active {
    background: var(--button-color);
    color: var(--button-text-color);
    border-color: var(--button-color);
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}


/* 4. Floating Action Buttons (FAB) */
.fab-container {
    position: absolute;
    bottom: 30px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.fab-btn {
    background: var(--button-color);
    color: var(--button-text-color);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 6px 16px rgba(0, 136, 204, 0.3);
    transition: transform 0.2s, background 0.2s;
}
.fab-btn:active { transform: scale(0.92); }
.fab-btn.locate {
    background: #ffffff;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


/* 5. Bottom Sheet */
.sheet-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}
.sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background: var(--sheet-bg);
    z-index: 2001;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 20px 20px 30px;   /* было 24px сверху */
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transition: bottom 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    max-height: 85vh;
    overflow-y: auto;
    color: var(--text-color);
}

.bottom-sheet.active { bottom: 0; }

.sheet-drag-handle {
    display: none;
}


/* 6. Sheet Content */
/* 6. Sheet Content */
.sheet-img-wrap {
    width: 100%;
    height: 160px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
    background-color: #e9e9eb;   /* neutral grey — works for black AND white logos */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 16px;
    box-sizing: border-box;
}

.sheet-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;          /* never crop, always show full image */
    display: block;
}

/* If it's a real wide photo (future use) — override via .photo-mode class */
.sheet-img-wrap.photo-mode {
    padding: 0;
    background-color: #c8c8c8;
}
.sheet-img-wrap.photo-mode .sheet-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.sheet-title {
    margin: 0 0 5px;
    font-size: 22px;
    font-weight: 700;
}
.sheet-category {
    font-size: 14px;
    color: var(--hint-color);
    font-weight: 500;
    margin-bottom: 12px;
    display: inline-block;
}
.sheet-comment {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 20px;
}
.sheet-hours {
    background: rgba(128, 128, 128, 0.1);
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 20px;
}
.sheet-hours span {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.btn-primary {
    display: block;
    width: 100%;
    text-align: center;
    background: var(--button-color);
    color: var(--button-text-color) !important;
    padding: 14px;
    text-decoration: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    box-sizing: border-box;
    cursor: pointer;
    transition: opacity 0.2s ease;
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-report {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: var(--hint-color);
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}

/* 7. Add Place Form */
.form-group { margin-bottom: 15px; }

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
    color: var(--hint-color);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 16px;
    background: rgba(128, 128, 128, 0.05);
    color: var(--text-color);
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}
.form-control:focus {
    outline: none;
    border-color: var(--button-color);
}


/* 8. Location Pick Mode */
.map-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    z-index: 1500;
    pointer-events: none;
    display: none;
    filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.4));
}
.map-crosshair::before,
.map-crosshair::after {
    content: '';
    position: absolute;
    background: #ff3b30;
    border-radius: 2px;
}
.map-crosshair::before { top: 14px; left: 0; width: 30px; height: 3px; }
.map-crosshair::after  { top: 0; left: 14px; width: 3px; height: 30px; }

#btn-confirm-location {
    position: absolute;
    bottom: 110px;
    right: 20px;
    z-index: 1600;
    padding: 14px 24px;
    border: none;
    border-radius: 24px;
    background: var(--button-color);
    color: var(--button-text-color);
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
}


/* 9. Leaflet Overrides */
.leaflet-control-attribution {
    font-size: 9px !important;
    opacity: 0.45 !important;
    background: rgba(255, 255, 255, 0.55) !important;
    box-shadow: none !important;
    padding: 2px 5px !important;
}
.leaflet-control-zoom { display: none; }
