/* wisdom/public/assets/css/main.css */
/* COMPLETE VERSION - UPDATED WITH MOBILE FIXES */

/* --- RESET & LAYOUT --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* VIKTIGT: Förhindra scroll på html-nivå för att App Shell ska fungera */
html { 
    height: 100%; 
    overflow: hidden; 
}

body.app-shell {
    font-family: 'Lora', serif;
    background-color: #eaf4f8; 
    color: #333;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    
    /* APP SHELL LOGIK */
    height: 100dvh; /* 100% av viewport, tar hänsyn till mobila webbläsar-bars */
    width: 100%;
    display: flex;
    flex-direction: column; /* Stapla Header, Main, Footer */
    overflow: hidden; /* Ingen scroll på body */
    padding-bottom: 0;
}

a { text-decoration: none; color: inherit; transition: opacity 0.2s; }
img { max-width: 100%; display: block; }

/* --- HEADER (FAST TOPP) --- */
.site-header {
    background-color: #000;
    border-bottom: 1px solid #222;
    padding: 0.8rem 0.25rem; 
    z-index: 100;
    flex: 0 0 auto; /* Väx inte, krymp inte */
    width: 100%;
}

.header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    max-width: 100%;
}

.header-left { justify-self: start; padding-left: 0; }
.header-center { justify-self: center; text-align: center; }
.header-right { justify-self: end; padding-right: 0; }

.brand-logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.0rem;
    font-weight: 700;
    text-decoration: none;
    color: #d4a017;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    color: #d4a017;
    transition: transform 0.2s, opacity 0.2s;
}
.nav-btn:hover { opacity: 0.8; transform: scale(1.1); }
.nav-btn svg { width: 24px; height: 24px; stroke: #d4a017; }

/* --- MAIN CONTENT (SCROLLABLE MIDDLE) --- */
#app-scroll-container {
    flex: 1; /* Fyll allt utrymme som blir över */
    overflow-y: auto; /* Scrolla internt här */
    -webkit-overflow-scrolling: touch; /* Smooth scroll iOS */
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    
    /* NYTT: Förhindrar att hela sidan "gungar" (bounce) när man drar i chatten */
    overscroll-behavior-y: contain;
}

/* --- FOOTER / CATEGORIES (BLACK & GOLD - LARGE TEXT) --- */
.category-section {
    flex: 0 0 auto;
    background-color: #000; 
    border-top: 1px solid #222;
    padding: 0.8rem 0.5rem; 
    z-index: 90;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    
    /* NYTT: Lägg till env() för att respektera iPhones safe area längst ner */
    padding-bottom: calc(0.8rem + env(safe-area-inset-bottom)); 
}

.category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 450px; 
    margin: 0 auto;
}

.cat-card {
    background: #111;
    border: 1px solid #333;
    border-radius: 6px; 
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    height: 90px; 
    padding: 0.5rem;
    
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
}

/* --- IKONER --- */
.cat-icon svg {
    width: 30px;
    height: 30px;
    stroke: #d4a017; 
    stroke-width: 1.5;
    transition: all 0.2s;
    filter: drop-shadow(0 0 2px rgba(212, 160, 23, 0.3));
}

/* --- TEXT --- */
.cat-label {
    margin-top: 8px;
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem; 
    font-weight: 600; 
    color: #d4a017;
    letter-spacing: 0.3px;
    line-height: 1.1;
}

/* --- HOVER --- */
.cat-card:hover {
    background-color: #1a1a1a; 
    border-color: #d4a017;
    transform: translateY(-2px);
}

.cat-card:hover .cat-icon svg {
    stroke: #ffcc33; 
    filter: drop-shadow(0 0 6px rgba(212, 160, 23, 0.7));
}

.cat-card:hover .cat-label {
    color: #ffcc33;
}

.cat-card:active {
    transform: scale(0.98);
    background-color: #000;
}

/* --- LANGUAGE MODAL OVERLAY --- */
.hidden-modal {
    display: none !important;
}

.lang-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); 
    
    z-index: 9999; 
    
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    backdrop-filter: blur(4px); 
}

.lang-modal-content {
    background-color: #fff;
    width: 100%;
    max-width: 400px; 
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    overflow: hidden;
    animation: scaleIn 0.2s ease-out;
}

.lang-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eaeaea;
    background-color: #f9f9f9;
}

.lang-modal-header h3 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: #2c2c2c;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0 0.5rem;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Rutnätet */
.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Kortet */
.lang-card {
    display: flex;
    align-items: center;
    justify-content: center; 
    padding: 0.8rem;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    aspect-ratio: 1 / 1; 
}

.lang-card:hover {
    border-color: #d4a017;
    background-color: #fffdf5;
    transform: scale(1.1); 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.flag-emoji {
    font-size: 2.5rem; 
    line-height: 1;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.1));
}

/* --- CONTACT MODAL STYLING --- */
.contact-modal-size {
    max-width: 500px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: 'Lora', serif;
    font-size: 1rem;
    transition: border-color 0.2s;
    background-color: #fafafa;
}

.form-input:focus {
    outline: none;
    border-color: #d4a017;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.1);
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c2c2c;
    color: #d4a017;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 10000;
    font-weight: bold;
    animation: slideDown 0.5s ease-out;
    border: 1px solid #d4a017;
    text-align: center;
}

@keyframes slideDown {
    from { transform: translate(-50%, -100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* --- KNAPPAR --- */
.btn-primary {
    background-color: #2c2c2c;
    color: #fff;
    border: 1px solid #d4a017;
    padding: 0.8rem 1.5rem;
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 8px; 
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-primary:hover {
    background-color: #000;
    color: #d4a017;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-primary:active {
    transform: translateY(0);
}

/* --- READER FRIENDLY UI OVERRIDES --- */
button, 
input, 
textarea, 
select, 
.nav-btn, 
.cat-label, 
.btn-primary, 
.lang-modal-header h3 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    letter-spacing: 0.3px;
}

body.app-shell {
    font-family: 'Lora', serif;
}