:root { 
    --primary: #ff5252; 
    --secondary: #34ace0; 
    --bg-color: #f4f6f8; 
    --panel-bg: #ffffff; 
    --text-color: #2c3e50; 
    --border-color: #f1f2f6;
    --text-muted: #a4b0be; 
    --danger: #ff5252; 
    --gold: #ffb142;
    --nav-height: 80px; 
    --soft-shadow: 0 10px 25px rgba(149, 157, 165, 0.15);
    --base-font-size: 14px;
    --glass: rgba(255, 255, 255, 0.8);
}

/* =========================================
   🔥 WAGGLE CLEAN UI - ZMIENNE I KARTY
========================================= */
:root {
    --space-xs: clamp(6px, 1vw, 10px);
    --space-sm: clamp(10px, 2vw, 14px);
    --space-md: clamp(14px, 3vw, 18px);
    
    --font-sm: clamp(10px, 2vw, 12px);
    --font-md: clamp(13px, 3vw, 15px);
    --font-lg: clamp(16px, 4vw, 20px);
}

.waggle-card {
    background: white;
    border-radius: 16px;
    padding: var(--space-md);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
    margin-bottom: var(--space-md);
}

.waggle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.waggle-card-title {
    margin: 0;
    font-size: var(--font-sm);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-color);
}

.modal-content, .bottom-nav {
    background: var(--glass) !important;
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

body.dark-mode { 
    --bg-color: #121212; --panel-bg: #1e1e1e; --text-color: #e0e0e0; 
    --border-color: #333333; --text-muted: #888888;
}
body.dark-mode #map { filter: brightness(0.8) contrast(1.1); } 

html, body { 
    margin: 0; padding: 0; height: 100%; width: 100%; 
    background: #e1e5eb; font-family: 'Nunito', sans-serif; 
    font-size: var(--base-font-size); overflow: hidden; color: var(--text-color);
}

.screen-container { 
    width: 100%; max-width: 480px; margin: 0 auto;
    background: var(--bg-color); position: fixed; inset: 0; 
    overflow: hidden; display: none; flex-direction: column; 
    box-shadow: 0 0 50px rgba(0,0,0,0.1); 
    z-index: 100;
}

/* FIX: Zapewnienie, że widoczny ekran jest na wierzchu i reaguje na kliknięcia */
#app-interface[style*="display: flex"], 
#auth-screen[style*="display: flex"] { 
    display: flex !important; 
    pointer-events: auto;
}

.wiki-image-wrapper {
    width: 100%;
    /* Dzięki temu proporcje będą zawsze takie same, 
       niezależnie od tego, jak szeroki jest telefon */
    aspect-ratio: 16 / 9; 
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e0e0e0;
}

.wiki-image-wrapper img {
    width: 100%;
    height: 100%;
    /* Obraz wypełni całe 16/9, nie będzie pasów */
    object-fit: cover; 
    /* Środek zdjęcia będzie zawsze w centrum uwagi */
    object-position: center; 
}

#auth-screen { z-index: 2000; background: linear-gradient(135deg, var(--bg-color) 0%, #e1e5eb 100%); align-items: center; justify-content: center; }
.auth-card { background: var(--panel-bg); border-radius: 30px; padding: 40px 30px; width: 85%; box-sizing: border-box; box-shadow: var(--soft-shadow); text-align: center; display: flex; flex-direction: column; pointer-events: auto; }
.logo-title { font-size: 55px; color: var(--primary); font-weight: 900; margin: 0 0 5px 0; letter-spacing: -2px; }

.view-section { position: absolute; top: 0; left: 0; width: 100%; height: calc(100% - var(--nav-height)); display: none; background: var(--bg-color); overflow-y: auto; z-index: 10; padding-bottom: 20px;}
.view-section.active { display: block; z-index: 20; }
.sticky-header { padding: 20px; background: var(--panel-bg); position: sticky; top: 0; z-index: 100; box-shadow: 0 5px 15px rgba(0,0,0,0.03); }

#view-map { z-index: 5; background: transparent; overflow: hidden; padding-bottom: 0;}
#view-map.active { display: flex !important; z-index: 25; }
#map { position: absolute; inset: 0; z-index: 1; }
#map-ui-layer { position: absolute; inset: 0; z-index: 1000; pointer-events: none; } 
#map-ui-layer > * { pointer-events: auto; } 

.modal { position: fixed; inset: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); z-index: 20000; display: none; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }
.card { background: var(--panel-bg); width: 100%; border-radius: 28px; padding: 30px; text-align: center; position: relative; box-shadow: var(--soft-shadow); border: none; max-height: 85vh; overflow-y: auto; display:flex; flex-direction:column; pointer-events: auto; }
.close-modal-btn { position: absolute; top: 15px; right: 15px; background: var(--bg-color); border: none; width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; color: var(--text-color); z-index: 10; display: flex; align-items: center; justify-content: center; }

.wiki-tabs { display: flex; background: var(--border-color); border-radius: 16px; padding: 5px; margin-top: 15px; }
.wiki-tab-btn { flex: 1; padding: 12px 0; background: transparent; border: none; font-weight: 800; font-family: inherit; color: var(--text-muted); cursor: pointer; border-radius: 12px; font-size: 13px; transition: 0.3s; }
.wiki-tab-btn.active { background: var(--panel-bg); color: var(--text-color); box-shadow: var(--soft-shadow); }

#top-widgets { position: absolute; top: 15px; right: 15px; display: flex; flex-direction: column; gap: 8px; }
#ctrl-panel { position: absolute; top: 15px; left: 15px; display: flex; flex-direction: column; gap: 10px; }
.top-pill { background: var(--panel-bg); padding: 10px 16px; border-radius: 50px; font-weight: 800; box-shadow: var(--soft-shadow); display: flex; align-items: center; justify-content: center; gap: 5px;}
.map-ctrl-btn { background: var(--panel-bg); width: 44px; height: 44px; border-radius: 50%; border: none; box-shadow: var(--soft-shadow); cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.map-ctrl-btn.danger { background: var(--danger); color: white; }
#walk-setup-panel { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); width: 90%; background: var(--panel-bg); border-radius: 28px; padding: 18px; box-shadow: var(--soft-shadow); box-sizing: border-box;}

.bottom-nav { position: absolute; bottom: 0; left: 0; width: 100%; height: var(--nav-height); background: var(--panel-bg); display: flex; justify-content: space-around; align-items: center; z-index: 999999; box-shadow: 0 -5px 20px rgba(0,0,0,0.1); border-radius: 30px 30px 0 0; pointer-events: auto; }
.nav-item { cursor: pointer; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--text-muted); font-size: 11px; font-weight: 800; transition: 0.2s; border: none; background: none;}
.nav-item.active { color: var(--primary); transform: translateY(-3px); }

.post-card { 
    background: var(--panel-bg); 
    margin: 15px -15px; /* 🔥 margines po bokach */
    border-radius: 12px; /* Mniejsze zaokrąglenie (wcześniej było 20px) */
    padding: 16px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* Delikatniejszy cień */
    border-top: 1px solid var(--border-color); /* Liniowe odcięcie postów */
    border-bottom: 1px solid var(--border-color);
}

.btn-main { background: var(--primary); color: white; border: none; font-weight: 800; padding: 16px; border-radius: 50px; width: 100%; cursor: pointer; text-transform: uppercase; font-family: inherit; font-size: 14px; box-shadow: 0 5px 15px rgba(255, 82, 82, 0.2); transition: 0.2s;}
.btn-outline { background: transparent; color: var(--text-color); border: 2px solid var(--border-color); font-weight: 800; padding: 14px; border-radius: 50px; width: 100%; cursor: pointer; font-family: inherit; transition: 0.2s;}

input:not([type="checkbox"]), select, textarea { 
    width: 100%; padding: 16px; border-radius: 16px; border: 2px solid var(--border-color); 
    background: var(--bg-color); color: var(--text-color); margin-bottom: 12px; 
    box-sizing: border-box; font-family: inherit; font-size: 15px; outline: none; 
    transition: 0.3s; appearance: none; -webkit-appearance: none;
}
input[type="checkbox"] { width: 22px; height: 22px; cursor: pointer; accent-color: var(--primary); margin: 0; }

#profileAvatar { cursor: pointer; transition: transform 0.2s; }
#profileAvatar:hover { transform: scale(1.05); }
/* Możesz dodać ikonkę ołówka w HTML obok obrazka */

.stats-bar { display: flex; justify-content: space-around; background: var(--panel-bg); border-radius: 20px; padding: 20px; margin: 20px 20px 0 20px; box-shadow: var(--soft-shadow); }

/* Kontener na tekst potrzebuje paddingu, żeby tekst nie dotykał krawędzi */
.wiki-text-content {
    padding: 25px; 
}

/* --- INBOX PREMIUM & WHATSAPP FEELING --- */

/* Nowoczesne dymki czatu */
.chat-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
    color: var(--text-color);
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px; /* Ogonek dla cudzych wiadomości */
}

/* Nasze wiadomości (po prawej) */
.chat-bubble.mine {
    background: var(--secondary);
    color: white;
    border: none;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 4px; /* Ogonek po prawej */
}

/* Wyróżnienie nieprzeczytanej konwersacji w skrzynce */
.inbox-unread-dot {
    width: 12px; 
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px rgba(255, 82, 82, 0.4);
    flex-shrink: 0;
}

/* Minimalistyczny czas wiadomości w dymku */
.chat-time {
    font-size: 10px;
    opacity: 0.65;
    text-align: right;
    margin-top: 4px;
    font-weight: 700;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}
.chat-bubble.mine .chat-time {
    color: rgba(255, 255, 255, 0.9);
}
/* =========================================================
   🔥 PRIORYTET 2: LIFTING PREMIUM (UX & UI)
   ========================================================= */

/* 1. Globalna, nowoczesna czcionka */
body {
    font-family: 'Inter', sans-serif !important;
}

/* 2. Standaryzacja Okienek (Modali) */
.card {
    border-radius: 24px !important; /* Płynne, duże zaokrąglenie w stylu iOS */
    box-shadow: 0 15px 40px rgba(0,0,0,0.15) !important;
    border: 1px solid rgba(0,0,0,0.05);
}

/* 3. Ujednolicony, pływający przycisk zamykania (Krzyżyk) */
.close-modal-btn {
    position: absolute; /* Usunięto !important */
    top: 15px;          /* Usunięto !important */
    right: 15px;        /* Usunięto !important */
    background: var(--bg-color) !important; 
    border: none !important;
    color: var(--text-color) !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
    transition: background 0.2s !important;
    z-index: 10 !important;
}
.close-modal-btn:active {
    background: #e2e6ea !important;
}

/* 4. Standaryzacja zakładek "Psia Wiedza" (Tab Navigation) */
.wiki-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-color); /* Kontener w formie pigułki */
    padding: 6px;
    border-radius: 100px;
    margin-top: 10px;
}
/* =========================================================
   🔥 LIGHTBOX (POWIĘKSZANIE ZDJĘĆ Z TABLICY)
   ========================================================= */
#lightbox-modal {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.9) !important;
    backdrop-filter: blur(8px) !important;
    z-index: 30000 !important; /* Musi być na absolutnym wierzchu */
    display: none; /* Domyślnie ukryte */
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

#lightbox-img {
    max-width: 95%;
    max-height: 85%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: zoomIn 0.2s ease-out; /* Płynne powiększenie */
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.wiki-tab-btn {
    flex: 1;
    padding: 10px 0 !important;
    border: none !important;
    background: transparent !important;
    border-radius: 100px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    color: var(--text-muted) !important;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Aktywna zakładka płynnie podświetlana na niebiesko */
.wiki-tab-btn.active {
    background: var(--secondary) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(52, 172, 224, 0.3) !important;
}

/* 🔥 Optymalizacja listy w "Nowe Stado" dla łatwiejszego klikania */
#groupUsersList label {
    padding: 15px 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    border-bottom: 1px solid var(--border-color) !important;
    cursor: pointer;
}

/* Zwiększenie samego checkboxa dla lepszej obsługi palcem */
#groupUsersList label input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    cursor: pointer;
}

/* 🔥 Wyróżnienia w artykułach (Wiedza) */
.wiki-tip { 
    padding: 15px; 
    border-radius: 12px; 
    margin: 12px 0; 
    font-weight: 700; 
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.wiki-tip-warning { 
    background: #fff1f0; 
    border-left: 4px solid var(--danger); 
    color: #c62828; 
}
.wiki-tip-success { 
    background: #e8f5e9; 
    border-left: 4px solid var(--primary-btn); 
    color: #2e7d32; 
}/* =========================================
   🔥 USTAWIENIA - STYL iOS / ANDROID
========================================= */
.settings-group {
    background: var(--bg-color);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 800;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row:active {
    background: #e8eaed;
}

/* Ukrywamy domyślny wygląd selecta, by wtapiał się w listę */
.settings-select {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    width: auto;
    font-weight: 800;
    color: var(--text-muted);
    outline: none;
    text-align: right;
    font-family: inherit;
    cursor: pointer;
}

/* =========================================
   🔥 ELEGANCKIE PASKI PRZEWIJANIA (POZIOME)
========================================= */
/* Uniwersalna klasa dla pasków filtrów */
.horizontal-scroll-bar {
    overflow-x: auto;
    padding-bottom: 6px; /* Robi miejsce na pasek, by nie dotykał przycisków */
    scrollbar-width: thin; /* Wsparcie dla Firefoxa */
    scrollbar-color: #dcdde1 transparent;
}

/* Magia dla Chrome / Safari / Edge (iOS i Android) */
.horizontal-scroll-bar::-webkit-scrollbar {
    height: 4px; /* Bardzo cienki, elegancki pasek */
}

.horizontal-scroll-bar::-webkit-scrollbar-track {
    background: transparent;
}

.horizontal-scroll-bar::-webkit-scrollbar-thumb {
    background: #dcdde1; /* Delikatny szary kolor */
    border-radius: 10px;
}
