:root {
    /* iOS System Colors (Dark Mode) */
    --bg-color: #000000;
    --panel-bg: rgba(28, 28, 30, 0.75);
    --accent-color: #0A84FF;
    --secondary-color: #BF5AF2;
    --danger-color: #FF453A;
    --text-main: #FFFFFF;
    --text-dim: #8E8E93;
    --border-color: rgba(255, 255, 255, 0.12);
    --glass-blur: 20px;
}

body { 
    margin: 0; 
    overflow: hidden; 
    background: var(--bg-color); 
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Canvas zajmuje całe tło */
#mapCanvas { 
    width: 100vw; 
    height: 100vh; 
    display: block; 
}

/* --- SIDEBAR (Desktop: Lewa strona) --- */
.sidebar {
    position: fixed; 
    left: 20px; 
    top: 20px; 
    bottom: 20px;
    width: 340px; 
    background: var(--panel-bg); 
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--border-color); 
    border-radius: 30px; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
    z-index: 1000;
    padding: 24px; 
    box-sizing: border-box; 
    display: flex; 
    flex-direction: column;
    
    /* Ukrycie: wysunięcie w lewo */
    transform: translateX(calc(-100% - 40px));
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sidebar.active { 
    transform: translateX(0); 
}

/* --- ELEMENTY WEWNĄTRZ --- */
.close-btn {
    position: absolute; 
    top: 18px; 
    right: 18px; 
    background: rgba(255,255,255,0.1);
    border: none; 
    color: var(--text-main); 
    width: 32px; 
    height: 32px; 
    border-radius: 50%; 
    cursor: pointer;
    font-size: 14px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}
.close-btn:active { transform: scale(0.9); }

.status-pill { 
    display: inline-block;
    padding: 5px 12px; 
    border-radius: 10px; 
    font-size: 11px; 
    font-weight: 700; 
    margin-bottom: 16px; 
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}
.status-pill.online { background: rgba(50, 215, 75, 0.15); color: #32D74B; }
.status-pill.offline { background: rgba(142, 142, 147, 0.15); color: #8E8E93; }

#display-name { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -0.5px; }
#username-tag { color: var(--text-dim); margin-top: 4px; font-size: 15px; margin-bottom: 20px; }

.info-card { 
    background: rgba(255,255,255,0.05); 
    padding: 16px; 
    border-radius: 20px; 
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,0.03);
}
.info-label { color: var(--text-dim); font-size: 11px; font-weight: 600; text-transform: uppercase; margin-bottom: 4px; }
.info-value { font-size: 15px; font-weight: 400; }

/* Lista znajomych */
.friends-list { 
    list-style: none; 
    padding: 0; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    margin-top: 10px;
}
.friends-list li { 
    padding: 8px 14px; 
    background: rgba(255,255,255,0.1); 
    border-radius: 14px; 
    font-size: 13px; 
    cursor: pointer;
    transition: 0.2s;
}
.friends-list li:hover { background: var(--accent-color); }

/* Scrollbar */
#sidebar-content { overflow-y: auto; flex: 1; margin-top: 10px; }
#sidebar-content::-webkit-scrollbar { width: 4px; }
#sidebar-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

/* --- RESPONSYWNOŚĆ (Mobile: Dół ekranu) --- */
@media (max-width: 500px) {
    .sidebar {
        left: 10px;
        right: 10px;
        top: auto;
        bottom: 10px;
        width: auto;
        height: auto;
        max-height: 75vh;
        border-radius: 35px;
        /* Schowanie w dół zamiast w lewo */
        transform: translateY(calc(100% + 20px));
    }

    .sidebar.active {
        transform: translateY(0) !important;
    }

    /* Pasek do przeciągania (iOS Handle) */
    .sidebar::before {
        content: "";
        width: 40px;
        height: 5px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 10px;
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
    }

    .close-btn { top: 12px; } /* Delikatna korekta pod pasek */
}

:root {
    --bg-color: #000000;
    --panel-bg: rgba(28, 28, 30, 0.75);
    --accent-color: #0A84FF;
    --secondary-color: #BF5AF2;
    --danger-color: #FF453A;
    --text-main: #FFFFFF;
    --text-dim: #8E8E93;
    --border-color: rgba(255, 255, 255, 0.12);
    --glass-blur: 20px;
}

body { 
    margin: 0; 
    overflow: hidden; 
    background: var(--bg-color); 
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    color: var(--text-main);
}

#mapCanvas { width: 100vw; height: 100vh; display: block; }

/* --- SEARCH / FILTERS --- */
.search-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    justify-content: flex-end;
}

.search-bar {
    background: var(--panel-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    cursor: pointer;
    width: 40px; /* Początkowo małe */
    height: 40px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    overflow: hidden;
}

.search-bar.expanded {
    width: 280px; /* Rozwinięte */
    cursor: default;
}

.search-icon {
    font-size: 18px;
    min-width: 24px;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 16px;
    margin-left: 10px;
    width: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-bar.expanded input {
    opacity: 1;
}

/* --- SIDEBAR --- */
.sidebar {
    position: fixed; 
    left: 20px; top: 20px; bottom: 20px;
    width: 340px; 
    background: var(--panel-bg); 
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--border-color); 
    border-radius: 30px; 
    z-index: 1000;
    padding: 24px; 
    box-sizing: border-box; 
    display: flex; 
    flex-direction: column;
    transform: translateX(calc(-100% - 40px));
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sidebar.active { transform: translateX(0); }

.close-btn {
    position: absolute; top: 18px; right: 18px; 
    background: rgba(255,255,255,0.1); border: none; 
    color: white; width: 32px; height: 32px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.status-pill { 
    padding: 5px 12px; border-radius: 10px; font-size: 11px; font-weight: 700; 
    margin-bottom: 16px; text-transform: uppercase; width: fit-content;
}
.status-pill.online { background: rgba(50, 215, 75, 0.15); color: #32D74B; }

#display-name { font-size: 24px; font-weight: 700; margin: 0; }
#username-tag { color: var(--text-dim); margin-top: 4px; font-size: 15px; margin-bottom: 20px; }

#sidebar-content { overflow-y: auto; flex: 1; margin-top: 10px; }

/* Mobile */
@media (max-width: 500px) {
    .search-container { top: 15px; right: 15px; left: 15px; }
    .search-bar.expanded { width: 100%; }
    
    .sidebar {
        left: 10px; right: 10px; top: auto; bottom: 10px;
        width: auto; max-height: 70vh; border-radius: 35px;
        transform: translateY(calc(100% + 20px));
    }
    .sidebar.active { transform: translateY(0) !important; }
    .sidebar::before {
        content: ""; width: 40px; height: 5px; background: rgba(255, 255, 255, 0.25);
        border-radius: 10px; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    }
}