/* --- 1. VARIABLER & GRUNDINSTÄLLNINGAR --- */
:root {
    --primary: #2e7d32;       /* Huvudgrön */
    --primary-dark: #1b5e20;  /* Mörkare grön (hover) */
    --accent: #e67e22;        /* Orange accent */
    --text-dark: #333;        /* Vanlig text */
    --text-light: #f4f4f4;    /* Ljus text */
}

body {
    font-family: 'Open Sans', 'Outfit', sans-serif;
    margin: 0; 
    padding: 0;
    color: #333;
    line-height: 1.6;
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), 
                url('https://images.unsplash.com/photo-1478131143081-80f7f84ca84d?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Outfit', sans-serif; color: var(--text-dark); }
a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }
.container { width: 92%; max-width: 1100px; margin: 0 auto; }

/* --- 2. HEADER & MENY --- */
header {
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky; top: 0; z-index: 1000;
    padding: 10px 0;
}
.header-content { display: flex; justify-content: space-between; align-items: center; }
.logo a { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.logo span { color: var(--accent); }

nav ul { display: flex; gap: 20px; align-items: center; }
nav a { color: #555; font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 5px; }
nav a:hover { color: var(--primary); }

.nav-text { display: none; }
@media (min-width: 768px) { 
    .nav-text { display: inline; } 
}

/* --- 3. KOMPONENTER --- */
.btn { padding: 10px 20px; border-radius: 25px; border: none; font-weight: 700; cursor: pointer; font-size: 0.95rem; transition: transform 0.2s; }
.btn:hover { transform: translateY(-2px); }
.primary-btn { background: var(--primary); color: white; }
.secondary-btn { background: white; color: var(--text-dark); }

.card, .dash-card, .guide-card {
    background: #ffffff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

input, select, textarea {
    width: 100%; padding: 12px; margin: 8px 0;
    border: 1px solid #ddd; border-radius: 8px;
    box-sizing: border-box; font-family: inherit;
}
input:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* --- 4. HERO --- */
#hero {
    background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)); 
    padding: 100px 0; text-align: center; color: white;
}
#hero h1 { font-size: 3rem; margin-bottom: 20px; color: white; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
#hero p { font-size: 1.2rem; margin-bottom: 30px; opacity: 0.9; }

.guide-hero {
    background: linear-gradient(rgba(46, 125, 50, 0.85), rgba(20, 50, 20, 0.9)), url('https://images.unsplash.com/photo-1542273917363-3b1817f69a2d?q=80&w=2074&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 80px 0 140px 0;
    text-align: center;
    border-bottom: 5px solid #1b5e20;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}
.guide-hero h1 { font-size: 2.5rem; margin-bottom: 10px; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }

/* --- 5. DASHBOARD --- */
.dashboard-wrapper { padding: 40px 0; }
.dash-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 30px; }

.profile-head { text-align: center; }
.avatar { 
    width: 90px; height: 90px; 
    background: linear-gradient(135deg, var(--primary), #66bb6a); 
    color: white; border-radius: 50%; 
    font-size: 2.5rem; 
    display: flex; align-items: center; justify-content: center; 
    margin: 0 auto 15px auto; 
    box-shadow: 0 5px 15px rgba(46, 125, 50, 0.4); 
}
.nick-input { background: transparent; border: 1px solid transparent; text-align: center; font-weight: bold; font-size: 1.4rem; color: var(--text-dark); }
.nick-input:hover { background: white; border-color: #ddd; cursor: pointer; }

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; background: #f9f9f9; padding: 15px; border-radius: 12px; margin-bottom: 20px; }
.stat-box h2 { font-size: 1.5rem; margin: 0; color: var(--primary); }
.stat-box p { font-size: 0.75rem; font-weight: bold; text-transform: uppercase; color: #888; margin: 0; }

.inv-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee; }
.inv-icon { width: 35px; height: 35px; background: #e8f5e9; color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-right: 10px; }

@media (max-width: 768px) {
    .dash-grid { grid-template-columns: 1fr; }
    .add-inv-form { flex-direction: column; }
}

/* --- 6. GUIDER --- */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: -50px; }
.guide-card { cursor: pointer; transition: transform 0.2s, background 0.2s; text-align: center; border-bottom: 4px solid transparent; }
.guide-card:hover { transform: translateY(-5px); background: white; }
.guide-icon { font-size: 2.5rem; margin-bottom: 15px; display: inline-block; }
.guide-summary { font-size: 0.85rem; color: #666; margin: 0; }
.click-hint { font-size: 0.75rem; color: var(--primary); margin-top: 15px; font-weight: bold; text-transform: uppercase; }

.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.85); backdrop-filter: blur(5px); align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }
.modal-content { background-color: #fff; border-radius: 15px; width: 100%; max-width: 600px; max-height: 85vh; overflow-y: auto; padding-bottom: 20px; animation: slideUp 0.3s ease-out; }
.modal-header { padding: 20px; color: white; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; }
.close-btn { background: none; border: none; color: white; font-size: 2rem; cursor: pointer; }
.modal-body { padding: 25px; }
.modal-body h3 { color: var(--primary); border-bottom: 1px solid #eee; padding-bottom: 5px; margin-top: 25px; }
@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* VMA */
.vma-section { 
    background: #222; color: white; padding: 30px; border-radius: 15px; margin-top: 40px; 
    display: flex; align-items: center; gap: 30px; box-shadow: 0 10px 40px rgba(0,0,0,0.4); border: 1px solid #444;
}
.vma-icon { font-size: 3.5rem; color: #ff9800; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }

.big-list-container { margin-top: 40px; background: white; padding: 30px; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.check-item { display: flex; align-items: center; margin-bottom: 8px; cursor: pointer; }
.check-item input { width: 18px; height: 18px; margin-right: 10px; accent-color: var(--primary); }
.check-item.checked span { text-decoration: line-through; color: #999; }

@media (max-width: 768px) { .vma-section { flex-direction: column; text-align: center; } .guide-hero h1 { font-size: 1.8rem; } }

/* --- 7. FORUM & CHATT --- */
.forum-card { display: flex; flex-direction: column; gap: 10px; margin-bottom: 15px; }
.chat-container { height: 60vh; overflow-y: auto; background: white; padding: 20px; border-radius: 10px; margin-bottom: 20px; border: 1px solid #ddd; }
.message { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #f0f0f0; }
.meta { font-size: 0.75rem; color: #999; margin-bottom: 2px; }

/* --- 8. LOGIN & REGISTRERING --- */
.login-page { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100vh;
    /* Bakgrunden är redan satt på body */
}

.login-card { 
    background: #ffffff; 
    width: 100%; 
    max-width: 400px; 
    text-align: center; 
    padding: 40px; 
    border-radius: 15px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); 
}

.input-group { position: relative; margin-bottom: 15px; }
.input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #aaa; z-index: 10; }
.input-group input { padding-left: 40px; }

/* --- 9. FOOTER --- */
footer { background: #1a1a1a; color: #bbb; padding: 40px 0; text-align: center; margin-top: auto; }

/* --- 10. MAP LOCK & BLUR --- */
.map-container-relative {
    position: relative;
    height: 400px;
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid #ddd;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-top: 20px;
}

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

.map-locked #map {
    filter: blur(6px) grayscale(50%);
    pointer-events: none;
    transform: scale(1.1);
}

.lock-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
}

.lock-box {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 80%;
}

.funktioner-grid { display: grid; grid-template-columns: 1fr; gap: 15px; margin-top: 30px; }
.card i { font-size: 2rem; color: var(--primary); margin-bottom: 10px; }

@media (min-width: 768px) {
    .funktioner-grid { grid-template-columns: repeat(3, 1fr); }
    .map-container-relative { height: 500px; }
}

.hero-buttons { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 20px; }
@media (min-width: 768px) {
    .hero-buttons { flex-direction: row; justify-content: center; }
}

/* --- 11. MOBIL APP-DESIGN (NYTT!) --- */

/* BOTTENMENY (Dold på dator) */
.bottom-nav {
    display: none; /* Dold som standard */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 9999;
    justify-content: space-around;
    padding: 10px 0;
    height: 60px;
    box-sizing: border-box;
}

.nav-item {
    text-decoration: none;
    color: #666;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    width: 20%;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.nav-item.active {
    color: var(--primary);
    font-weight: bold;
}

/* DATOR-LÄGE (DEFAULT) */
/* Se till att kartan ser bra ut på stora skärmar */
.map-wrapper {
    height: 500px; /* Standardhöjd på dator */
    width: 100%;
    position: relative;
    border-radius: 15px; /* Snygga hörn på dator */
}

/* MOBIL-LÄGE (App-Känsla) */
@media (max-width: 768px) {
    /* 1. Visa bottenmenyn */
    .bottom-nav { display: flex; }

    /* 2. Dölj den vanliga menyn i toppen */
    header nav ul { display: none; }
    
    /* 3. Gör header mindre */
    header { padding: 10px 0; }

    /* 4. Fullskärmskarta */
    /* Vi tar bort marginaler och padding från containern på startsidan */
    body.home-page .container {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    body.home-page .map-wrapper {
        height: calc(100vh - 120px); /* Skärmhöjd minus header & bottenmeny */
        border-radius: 0; /* Inga runda hörn */
        border: none;
        margin-top: 0;
    }
    
    body.home-page #map {
        border-radius: 0;
    }
    
    /* 5. Dölj intro-text på mobil för renare look */
    .intro-text, .hero-buttons {
        display: none; 
    }
}

/* --- FIXAR FÖR MOBIL-APPVYN --- */

/* 1. Gör knappraden flytande OVANPÅ kartan (snyggare & syns alltid) */
.map-overlay-menu {
    position: absolute;
    top: 15px;      /* Lite marginal från toppen */
    left: 0;
    right: 0;
    z-index: 800;   /* Måste vara högre än kartan (Leaflet är 400) */
    
    display: flex;
    gap: 10px;
    overflow-x: auto;       /* Horisontell scroll */
    white-space: nowrap;    /* Inga radbrytningar */
    padding: 0 15px;        /* Luft på sidorna */
    
    /* Dölj scrollbar för snyggare look */
    scrollbar-width: none;  /* Firefox */
    -ms-overflow-style: none;  /* IE/Edge */
    -webkit-overflow-scrolling: touch; /* Mjuk scroll på iPhone */
}
.map-overlay-menu::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* Styla knapparna som "Chips" */
.map-overlay-menu .btn {
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); /* Tydlig skugga mot kartan */
    font-size: 0.85rem;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95); /* Nästan helt vit */
    border-radius: 20px;
    backdrop-filter: blur(4px); /* Snygg "frostat glas"-effekt */
}

/* 2. Flytta upp OneSignal-klockan så den inte täcks av menyn */
/* Vi tvingar den att sitta 80px från botten istället för standard */
#onesignal-bell-container {
    bottom: 85px !important; 
    left: 20px !important; /* Flytta in den lite också */
    z-index: 2000 !important; /* Se till att den ligger överst */
}

/* Justera OneSignal chatt-bubblor om de dyker upp */
#onesignal-slidedown-container {
    bottom: 80px !important;
}

/* =========================================
   SUPER DARK MODE (Överskriver hårdkodade färger)
========================================= */
html.dark-mode, html.dark-mode body, html.dark-mode main {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}

/* 1. Tvingar alla paneler och rutor att bli mörka */
html.dark-mode .card,
html.dark-mode .dash-card,
html.dark-mode .post-card,
html.dark-mode .content-wrapper,
html.dark-mode .content-container,
html.dark-mode .form-wrapper,
html.dark-mode .login-prompt,
html.dark-mode .guide-card,
html.dark-mode .alert-card,
html.dark-mode .map-wrapper,
html.dark-mode .scroll-menu,
html.dark-mode .mobile-map-search {
    background-color: #1e1e1e !important;
    border-color: #333 !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5) !important;
}

/* 2. MAGIN: Letar upp "style=background:white" etc och tvingar dem mörka! */
html.dark-mode div[style*="background: white"],
html.dark-mode div[style*="background:white"],
html.dark-mode div[style*="background: #fdfdfd"],
html.dark-mode div[style*="background: #f4f8f4"],
html.dark-mode div[style*="background: #e8f5e9"],
html.dark-mode div[style*="background:#e8f5e9"],
html.dark-mode div[style*="background: #fff3e0"],
html.dark-mode div[style*="background:#fff3e0"],
html.dark-mode div[style*="background: #f0f8ff"],
html.dark-mode div[style*="background:#f9f9f9"],
html.dark-mode div[style*="background: #f9f9f9"] {
    background-color: #252525 !important;
    border-color: #444 !important;
}

/* 3. Tvingar all text i de mörka rutorna att bli ljusgrå */
html.dark-mode h1, html.dark-mode h2, html.dark-mode h3, 
html.dark-mode h4, html.dark-mode p, html.dark-mode span, 
html.dark-mode div, html.dark-mode strong, html.dark-mode label,
html.dark-mode .nav-text {
    color: #e0e0e0 !important;
}

/* 4. Fixar sökfält och textrutor så man kan skriva i mörkret */
html.dark-mode input,
html.dark-mode select,
html.dark-mode textarea {
    background-color: #2a2a2a !important;
    border-color: #444 !important;
    color: #fff !important;
}

/* 5. Header och Bottenmeny */
html.dark-mode header,
html.dark-mode .bottom-nav {
    background-color: #1a1a1a !important;
    border-color: #333 !important;
}

/* 6. Kartan (inverterar OSM) */
html.dark-mode .leaflet-layer,
html.dark-mode .leaflet-control-zoom-in,
html.dark-mode .leaflet-control-zoom-out,
html.dark-mode .leaflet-control-attribution {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

/* -----------------------------------------
   BOTTENMENY FÖR MOBIL (Säkerställer att den finns)
----------------------------------------- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; width: 100%;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 9999;
    justify-content: space-around;
    padding: 10px 0;
    height: 60px;
    box-sizing: border-box;
}
.nav-item {
    text-decoration: none; color: #666;
    display: flex; flex-direction: column; align-items: center;
    font-size: 0.75rem; width: 20%;
}
.nav-item i { font-size: 1.2rem; margin-bottom: 4px; }
.nav-item.active { color: var(--primary); font-weight: bold; }

@media (max-width: 768px) {
    .bottom-nav { display: flex !important; }
    header nav ul { display: none !important; } 
    main { padding-bottom: 80px !important; }
}