/* ============================================
   MAIN.CSS - v0.9.1 (FIXED LAYOUT)
   ============================================ */

/* --- 1. POPUPS & MODALS (VIKTIGST - LIGGER FØRST) --- */
.popup-overlay {
    display: none; /* Skjult som standard */
    position: fixed !important; /* TVINGES til å ligge over alt */
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); /* Litt mørkere bakgrunn */
    z-index: 10000 !important; /* Alltid øverst */
    align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
}

/* Denne klassen settes av JS når den skal vises */
.popup-overlay.active { display: flex !important; }

/* Når vi bruker style="display:flex" i HTML, overstyrer det display:none */

.popup-content {
    background: white; padding: 30px;
    border-radius: 20px;
    max-width: 450px; width: 90%;
    text-align: center; position: relative;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp { 
    from { transform: translateY(50px); opacity: 0; } 
    to { transform: translateY(0); opacity: 1; } 
}

/* --- 2. GRUNNLEGGENDE DESIGN --- */
:root {
    --bg-color: #f5f5f7;
    --card-bg: #ffffff;
    --text-color: #1d1d1f;
    --accent-blue: #0071e3;
    --accent-purple: #af52de;
    --danger-red: #ff3b30;
    --success-green: #34c759;
    --shadow: 0 10px 20px rgba(0,0,0,0.05);
    
    /* Rarity */
    --common: #a1a1a1; --rare: #0071e3; 
    --epic: #8e44ad; --legendary: #f1c40f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color); color: var(--text-color);
    margin: 0; padding: 20px;
    display: flex; flex-direction: column; align-items: center;
    min-height: 100vh; padding-bottom: 80px;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.5px; margin-top: 0; }
a { color: var(--accent-blue); text-decoration: none; }

/* BILDER */
.hero-image {
    width: 100%; max-width: 700px; height: auto;
    border-radius: 20px; margin-bottom: 25px;
    box-shadow: var(--shadow); display: block;
    margin-left: auto; margin-right: auto;
}

/* NAVIGASJON */
nav {
    display: none; /* JS styrer dette */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 8px 12px; border-radius: 50px;
    box-shadow: var(--shadow);
    position: fixed; bottom: 20px; left: 50%;
    transform: translateX(-50%); z-index: 2000;
    align-items: center; gap: 10px; width: max-content;
}

nav button {
    background: transparent; border: none; padding: 10px 16px;
    font-size: 15px; cursor: pointer; border-radius: 20px;
    color: #86868b; font-weight: 500;
}
nav button.active { background: var(--card-bg); color: var(--text-color); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

/* SIDER */
.page { display: none; width: 100%; max-width: 700px; animation: fadeIn 0.4s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* CONTAINERS */
.card-container {
    background: var(--card-bg); border-radius: 18px;
    padding: 30px; box-shadow: var(--shadow); margin-bottom: 20px;
}

/* KNAPPER & INPUTS */
input, textarea, select {
    width: 100%; padding: 12px; margin-bottom: 10px;
    border: 1px solid #d2d2d7; border-radius: 12px;
    font-size: 16px; background: #fafafa;
}

.btn-primary {
    background-color: var(--accent-blue); color: white; border: none;
    padding: 14px 25px; font-size: 16px; border-radius: 99px;
    cursor: pointer; width: 100%; font-weight: 500; margin-top: 10px;
}
.btn-secondary {
    background-color: #e5e5ea; color: #1d1d1f; border: none;
    padding: 10px 20px; border-radius: 12px; cursor: pointer;
    font-weight: 500; margin-top: 5px;
}
.btn-danger { background-color: #ffe5e5; color: var(--danger-red); }
.btn-small { padding: 6px 12px; font-size: 13px; width: auto; }

/* SPESIFIKKE ELEMENTER */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 30px; }
.role-card {
    background: white; padding: 25px 15px; border-radius: 18px;
    box-shadow: var(--shadow); cursor: pointer; text-align: center;
}
.trinn-grid { display: grid; gap: 10px; margin-top: 20px; }
.trinn-btn {
    background: white; border: 2px solid #eee; padding: 20px;
    border-radius: 15px; font-weight: bold; font-size: 18px;
    cursor: pointer; width: 100%;
}
.lang-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.lang-btn {
    background: white; border: 2px solid #e5e7eb; border-radius: 12px;
    padding: 15px; cursor: pointer; text-align: center;
}
.lang-btn.active { background-color: #F3E8FF; border-color: var(--accent-purple); color: #5B21B6; }

/* KORT STYLING */
.samling-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px; margin-top: 25px;
}
.poke-card {
    background: white; border-radius: 20px; padding: 8px; text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08); border: 4px solid white;
    cursor: pointer; position: relative; min-height: 200px;
    display: flex; flex-direction: column; justify-content: space-between;
}
.kort-bilde { width: 100%; height: 120px; object-fit: contain; }
.kort-bilde-placeholder { width: 100%; height: 120px; font-size: 50px; display: flex; align-items: center; justify-content: center; background: #f9f9f9; border-radius: 8px; }
.rarity-legendary { border-color: var(--legendary); background: linear-gradient(to bottom, #FFF, #FFFBEB); }
.rarity-badge { font-size: 9px; text-transform: uppercase; font-weight: 800; padding: 4px; border-radius: 4px; }

/* TOAST */
.toast {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: #333; color: white; padding: 12px 24px; border-radius: 50px;
    z-index: 11000; font-size: 14px; animation: fadeIn 0.3s;
}
.toast-success { background: var(--success-green); }
.toast-error { background: var(--danger-red); }