/* =========================================
   1. GRUND & FÄRGER
   ========================================= */
:root {
    --brand-primary: #0056b3; 
    --brand-accent: #e68a00; 
    --brand-bg: #ffffff;
    --text-dark: #111111;
    --text-grey: #666666;
    --border: #e0e0e0;
    --font-stack: "Inter", -apple-system, sans-serif;
    --profile-cover-height: 200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-stack);
    background-color: #f4f4f4;
    color: var(--text-dark);
    line-height: 1.5;
    overflow-x: hidden; 
}

.site-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    background-color: var(--brand-bg);
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

a { text-decoration: none; color: inherit; transition: color 0.2s; cursor: pointer; }
a:hover { color: var(--brand-primary); }
img { display: block; max-width: 100%; height: auto; }

/* KNAPPAR & UI */
.btn-create { background: var(--brand-primary); color: white; padding: 10px 20px; border-radius: 4px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; border: none; font-size: 0.9rem; cursor: pointer; }
.btn-create:hover { background: #004494; color:white; }

.btn-action { padding: 10px 20px; border-radius: 25px; font-weight: 600; cursor: pointer; border: none; transition: transform 0.1s; display:inline-block; text-align:center;}
.btn-action:hover { transform: scale(1.05); }
.btn-primary { background: var(--brand-primary); color: white; } 
.btn-secondary { background: #eee; color: #333; }
.btn-secondary:hover { background: #ddd; }
.btn-outline { background: transparent; border: 2px solid var(--brand-primary); color: var(--brand-primary); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; border-radius: 4px; width: 100%; }

.design-separator { margin: 80px 0 40px 0; padding: 40px; background: #222; color: #fff; text-align: center; border-radius: 8px; }
.section-header-area { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }

/* =========================================
   2. HEADER
   ========================================= */
.top-bar { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 15px 0; border-bottom: 4px solid var(--brand-primary); 
    margin-bottom: 20px; gap: 20px; 
    position: sticky; top: 0; background: #fff; z-index: 100; 
}

.brand-area { display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
.logo { font-size: 1.8rem; font-weight: 900; letter-spacing: -1px; color: #000; }
.logo span { color: var(--brand-primary); }

.desktop-nav { display: flex; gap: 20px; }
.nav-link { font-weight: 600; text-transform: uppercase; font-size: 0.9rem; color: var(--text-dark); }

.ad-spot { flex-grow: 1; display: flex; justify-content: center; align-items: center; }
.ad-banner-desktop { display: flex; width: 728px; height: 90px; background:#f0f0f0; align-items:center; justify-content:center; border:1px dashed #ccc; font-size:0.8rem; color:#999; }
.ad-banner-tablet { display: none; width: 468px; height: 60px; background:#f0f0f0; align-items:center; justify-content:center; border:1px dashed #ccc; font-size:0.8rem; color:#999; }

.profile-widget { display: flex; align-items: center; gap: 15px; text-align: right; flex-shrink: 0; }
.profile-info { display: flex; flex-direction: column; }
.p-name { font-weight: 700; font-size: 1rem; }
.p-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }

/* =========================================
   3. MOBILMENY
   ========================================= */
.hamburger-btn { display: none; background: none; border: none; font-size: 1.8rem; cursor: pointer; padding: 5px; line-height: 1; }
.mobile-nav-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 998; display: none; }
.mobile-nav-drawer { position: fixed; top: 0; left: -300px; width: 280px; height: 100%; background: white; z-index: 999; transition: left 0.3s ease; padding: 20px; display: flex; flex-direction: column; box-shadow: 2px 0 10px rgba(0,0,0,0.1); }
.mobile-nav-drawer.open { left: 0; }
.drawer-link { font-size: 1.1rem; font-weight: 600; padding: 15px 0; border-bottom: 1px solid #eee; display: block; }
.close-btn { background:none; border:none; font-size:1.5rem; cursor:pointer; align-self: flex-end; margin-bottom: 10px; }

/* =========================================
   4. LAYOUT & NYHETSFLÖDE
   ========================================= */
.layout-grid { display: grid; grid-template-columns: 2.5fr 1fr; gap: 40px; padding-bottom: 50px; }

.filter-area { display: flex; align-items: center; gap: 15px; margin-bottom: 30px; border-bottom: 1px solid var(--border); padding-bottom: 15px; }
.filter-label { font-weight: 700; font-size: 0.9rem; text-transform: uppercase; }
.custom-select { padding: 8px 12px; font-size: 1rem; border: 2px solid var(--border); border-radius: 4px; background-color: white; cursor: pointer; min-width: 220px; }

.hero-card { margin-bottom: 40px; border-bottom: 1px solid var(--border); padding-bottom: 25px; }
.hero-img { width: 100%; height: 400px; object-fit: cover; margin-bottom: 20px; }
.hero-title { font-size: 2.2rem; font-weight: 800; margin-bottom: 15px; line-height: 1.1; }

.masonry-feed { column-count: 2; column-gap: 30px; }
.news-card { break-inside: avoid; margin-bottom: 30px; border-bottom: 1px solid var(--border); padding-bottom: 15px; display: inline-block; width: 100%; }
.feed-img { width: 100%; border-radius: 4px; margin-bottom: 12px; background-color: #eee; }
.news-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; line-height: 1.3; }
.cat-tag { font-size: 0.75rem; text-transform: uppercase; font-weight: 800; color: var(--brand-primary); display:block; margin-bottom:5px;}

/* Sidebar */
.sidebar { border-left: 1px solid var(--border); padding-left: 25px; }
.sb-section { margin-bottom: 40px; }
.sb-head { font-size: 1.2rem; font-weight: 900; margin-bottom: 15px; border-bottom: 2px solid var(--text-dark); display: inline-block; }
.event-list { list-style: none; }
.event-item { margin-bottom: 15px; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.event-time { font-size: 0.8rem; color: var(--text-grey); display: block; margin-bottom: 2px; }
.event-text { font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.visitor-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.v-avatar { width: 50px; height: 50px; border-radius: 50%; border: 1px solid #ddd; }

/* Profilkort (i flödet) */
.profile-section-divider { margin: 60px 0 30px 0; display: flex; align-items: center; gap: 15px; }
.profile-section-divider::before, .profile-section-divider::after { content: ""; flex: 1; height: 2px; background: var(--border); }
.profile-section-title { font-weight: 900; text-transform: uppercase; color: var(--text-grey); letter-spacing: 1px; }
.profile-card-container { background: white; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.profile-cover-photo { height: var(--profile-cover-height); background: #333; background-size: cover; background-position: center; }
.profile-content { padding: 0 30px 30px 30px; position: relative; text-align: center; }
.profile-big-avatar { width: 140px; height: 140px; border-radius: 50%; border: 5px solid white; object-fit: cover; margin-top: -70px; position: relative; z-index: 2; background: white; }
.profile-stats-bar { display: flex; justify-content: center; gap: 40px; padding: 20px 0; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; margin: 20px 0; }
.stat-count { font-weight: 800; font-size: 1.3rem; color: var(--brand-primary); }
.stat-label { font-size: 0.8rem; text-transform: uppercase; color: var(--text-grey); font-weight: 600; }
.profile-actions { display: flex; justify-content: center; gap: 15px; }

/* =========================================
   5. MEDLEMMAR
   ========================================= */
.member-search-bar { display: flex; gap: 10px; margin-bottom: 30px; background: #fff; padding: 20px; border-radius: 8px; border:1px solid var(--border); }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.member-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; transition: transform 0.2s; }
.member-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.mc-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin-bottom: 15px; border: 3px solid #f4f4f4; }
.mc-name { font-weight: 700; font-size: 1.1rem; color: #333; margin-bottom: 5px; }
.mc-details { font-size: 0.85rem; color: #777; margin-bottom: 15px; }
.mc-actions { margin-top: auto; width: 100%; display: flex; flex-direction: column; gap: 8px; }

/* =========================================
   6. KONTAKTANNONSER (ADS)
   ========================================= */
.ads-container { background: white; padding: 30px; border-radius: 8px; border: 1px solid var(--border); }
.ads-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; border-bottom: 1px solid #eee; padding-bottom: 20px; }
.ads-search-bar { display: flex; gap: 10px; margin-bottom: 30px; background: #f9f9f9; padding: 20px; border-radius: 8px; }
.ads-category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 15px; }
.ad-cat-card { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.ad-cat-card:hover { border-color: var(--brand-primary); box-shadow: 0 4px 10px rgba(0,0,0,0.05); transform: translateY(-2px); }
.ad-cat-title { font-weight: 700; font-size: 1rem; color: #333; margin-bottom: 5px; }
.ad-cat-count { font-size: 0.8rem; color: #888; background: #f0f0f0; padding: 2px 8px; border-radius: 10px; }
.create-ad-view { display: none; }
.ad-tips-box { background: #fffcf0; border: 1px solid #f0e6c0; padding: 15px; border-radius: 4px; font-size: 0.9rem; color: #555; margin-top: 20px; }

/* =========================================
   7. ALBUM
   ========================================= */
.album-header-area { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 25px; margin-bottom: 50px; }
.album-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; transition: transform 0.2s; cursor: pointer; }
.album-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.album-cover-wrap { position: relative; height: 180px; background: #eee; overflow: hidden; }
.album-cover-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.album-card:hover .album-cover-img { transform: scale(1.05); }
.album-badge { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.7); color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.album-info { padding: 15px; }
.album-title { font-weight: 700; font-size: 1rem; margin-bottom: 5px; }
.album-meta { font-size: 0.8rem; color: #777; }

/* =========================================
   8. GRUPPER
   ========================================= */
.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 25px; }
.group-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; transition: transform 0.2s; display: flex; flex-direction: column; }
.group-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.08); }
.group-cover { height: 120px; background: #ddd; object-fit: cover; width: 100%; }
.group-content { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.group-name { font-size: 1.2rem; font-weight: 800; margin-bottom: 5px; color: #333; }
.group-meta { font-size: 0.85rem; color: #777; margin-bottom: 15px; display: flex; gap: 15px; }
.group-desc { font-size: 0.95rem; color: #555; margin-bottom: 20px; line-height: 1.4; flex-grow: 1; }
.group-features { display: flex; gap: 10px; border-top: 1px solid #eee; padding-top: 15px; margin-top: auto; font-size: 0.8rem; color: #666; font-weight: 600; }
.feature-icon { display: flex; align-items: center; gap: 5px; background: #f4f4f4; padding: 4px 8px; border-radius: 4px; }
.create-group-view { display: none; background: #fff; padding: 30px; border-radius: 8px; border: 1px solid var(--border); }

/* Enskild Grupp (Demo) */
.group-hero { background-color: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 30px; }
.gh-cover { height: 250px; width: 100%; object-fit: cover; background: #555; }
.gh-content { padding: 20px 30px; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 20px; position: relative; margin-top: -60px; }
.gh-info { display: flex; gap: 20px; align-items: flex-end; }
.gh-avatar { width: 120px; height: 120px; border-radius: 12px; border: 4px solid #fff; object-fit: cover; background: #eee; }
.gh-name { font-size: 2rem; font-weight: 900; margin-bottom: 5px; line-height: 1; color: #000; background: rgba(255,255,255,0.8); padding: 5px; border-radius: 4px; display: inline-block;}
.gh-meta { font-size: 0.9rem; color: #444; background: rgba(255,255,255,0.8); padding: 2px 5px; border-radius: 4px;}
.gh-nav { display: flex; gap: 30px; padding: 0 30px; border-top: 1px solid #eee; background: #fff; }
.gh-tab { padding: 15px 0; font-weight: 600; color: #666; border-bottom: 3px solid transparent; cursor: pointer; }
.gh-tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

/* Forum */
.forum-list { display: flex; flex-direction: column; gap: 10px; }
.forum-row { background: #fff; border: 1px solid #eee; padding: 15px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; }
.fr-main { display: flex; gap: 15px; align-items: center; }
.fr-icon { font-size: 1.5rem; color: #ccc; }
.fr-title { font-weight: 700; font-size: 1rem; color: #333; display: block; margin-bottom: 3px; }
.fr-meta { font-size: 0.8rem; color: #888; }
.fr-stats { text-align: right; font-size: 0.85rem; color: #666; min-width: 100px; }

/* =========================================
   9. MEDDELANDEN
   ========================================= */
.messages-container { display: grid; grid-template-columns: 320px 1fr; background: #fff; border: 1px solid var(--border); border-radius: 8px; height: 600px; overflow: hidden; position: relative; }
.msg-sidebar { border-right: 1px solid #eee; display: flex; flex-direction: column; background: #fff; }
.msg-search-box { padding: 15px; border-bottom: 1px solid #eee; }
.msg-list { flex-grow: 1; overflow-y: auto; }
.msg-item { display: flex; gap: 10px; padding: 15px; cursor: pointer; border-bottom: 1px solid #f9f9f9; transition: background 0.2s; }
.msg-item:hover { background: #f4f4f4; }
.msg-item.active-chat { background: #eef6fc; border-left: 3px solid var(--brand-primary); }
.msg-user-avatar { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.msg-preview { overflow: hidden; }
.msg-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 2px; color: #333; display: flex; justify-content: space-between; }
.msg-time { font-size: 0.75rem; color: #999; font-weight: 400; }
.msg-snippet { font-size: 0.85rem; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-badge { background: var(--brand-primary); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 10px; margin-left: auto; }

.msg-chat-area { display: flex; flex-direction: column; background: #f9f9f9; }
.chat-header { padding: 15px 20px; background: #fff; border-bottom: 1px solid #eee; display: flex; align-items: center; gap: 10px; }
.chat-header-name { font-weight: 800; font-size: 1.1rem; }
.chat-header-status { font-size: 0.8rem; color: #4caf50; display: flex; align-items: center; gap: 4px; }
.online-dot { width: 8px; height: 8px; background: #4caf50; border-radius: 50%; display: inline-block; }
.mobile-back-btn { display: none; font-size: 1.5rem; background:none; border:none; cursor: pointer; padding-right: 10px; }
.chat-window { flex-grow: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.chat-bubble { max-width: 70%; padding: 10px 15px; border-radius: 15px; font-size: 0.95rem; line-height: 1.4; position: relative; }
.bubble-received { background: #fff; border: 1px solid #ddd; align-self: flex-start; border-bottom-left-radius: 2px; color: #333; }
.bubble-sent { background: var(--brand-primary); color: white; align-self: flex-end; border-bottom-right-radius: 2px; }
.msg-meta-time { font-size: 0.7rem; opacity: 0.7; margin-top: 5px; display: block; text-align: right; }
.chat-input-area { padding: 15px; background: #fff; border-top: 1px solid #eee; display: flex; gap: 10px; align-items: center; }
.chat-input { flex-grow: 1; padding: 12px; border: 1px solid #ddd; border-radius: 20px; outline: none; }
.btn-send { background: var(--brand-primary); color: white; border: none; padding: 10px 20px; border-radius: 20px; cursor: pointer; font-weight: 600; }

/* =========================================
   10. INSTÄLLNINGAR & FORMULÄR
   ========================================= */
.settings-layout { display: grid; grid-template-columns: 260px 1fr; gap: 30px; padding-bottom: 50px; }
.settings-menu-card { background: #fff; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; height: fit-content; }
.settings-header { padding: 15px 20px; font-size: 1.4rem; font-weight: 800; border-bottom: 1px solid #eee; margin: 0; background: #fcfcfc; }
.settings-link { display: flex; align-items: center; padding: 15px 20px; border-bottom: 1px solid #f0f0f0; cursor: pointer; color: #444; font-weight: 500; transition: all 0.2s; }
.settings-link:last-child { border-bottom: none; }
.settings-link:hover { background: #f9f9f9; }
.s-icon { width: 24px; margin-right: 12px; text-align: center; color: #666; font-size: 1.1rem; }
.settings-link.active-tab { background-color: var(--brand-accent); color: white; border-bottom: 1px solid var(--brand-accent); }
.settings-link.active-tab .s-icon { color: white; }
.settings-content-area { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 30px; }
.settings-tab-content { display: none; animation: fadeIn 0.3s; }
.settings-tab-content.active-content { display: block; }

/* Formulär */
.gray-box { padding: 20px; background: #f9f9f9; border-radius: 5px; margin-bottom: 20px; border: 1px solid #eee; }
.section-title { margin-top: 0; margin-bottom: 15px; color: var(--brand-accent); font-size: 1.1rem; text-transform: uppercase; font-weight: 800; }
.form-group { margin-bottom: 15px; }
.form-label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 0.9rem; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit; font-size: 1rem; }
.form-textarea { height: 150px; resize: vertical; }

.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkbox-card-label { display: flex; flex-direction: column; gap: 2px; cursor: pointer; padding: 10px; background: #fff; border: 1px solid #ddd; border-radius: 4px; }
.checkbox-card-label:hover { border-color: var(--brand-primary); }
.cb-title { font-weight: bold; }
.cb-desc { font-size: 0.8rem; color: #777; }
.chk-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }

/* =========================================
   11. RESPONSIVITET
   ========================================= */
@media (max-width: 1150px) {
    .desktop-nav { display: none; }
    .hamburger-btn { display: block; }
    .ad-banner-desktop { display: none; }
    .ad-banner-tablet { display: flex; }
}
@media (max-width: 850px) {
    .ad-spot { display: none; }
    .settings-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .layout-grid { grid-template-columns: 1fr; }
    .masonry-feed { column-count: 1; }
    .sidebar { border-left: none; padding-left: 0; margin-top: 30px; border-top: 4px solid #eee; padding-top: 30px; }
    .grid-3, .grid-2, .checkbox-grid { grid-template-columns: 1fr; }
    .profile-stats-bar { gap: 15px; }
    .section-header-area { flex-direction: column; align-items: flex-start; gap: 10px; }
    .ads-category-grid { grid-template-columns: 1fr; }
    .ads-search-bar { flex-direction: column; }
    .album-header-area { flex-direction: column; align-items: flex-start; gap: 10px; }
    
    /* Mobilfix för Meddelanden */
    .messages-container { display: block; position: relative; height: 80vh; }
    .msg-sidebar { width: 100%; height: 100%; display: flex; } 
    .msg-chat-area { width: 100%; height: 100%; display: none; position: absolute; top:0; left:0; z-index: 10; }
    
    /* Klasser för JS toggle */
    .messages-container.view-chat .msg-sidebar { display: none; }
    .messages-container.view-chat .msg-chat-area { display: flex; }
    
    .mobile-back-btn { display: inline-block; margin-right: 10px; }
    .gh-content { flex-direction: column; align-items: center; margin-top: -80px; text-align: center; }
    .gh-info { flex-direction: column; align-items: center; }
    .gh-nav { justify-content: center; overflow-x: auto; }
    .member-search-bar { flex-direction: column; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }


/* Notis-badge */
.nav-icon-container { position: relative; display: inline-block; margin-right: 15px; color: #555; text-decoration: none; font-size: 1.2rem; }
.nav-icon-container:hover { color: #0056b3; }
.badge-count { 
    position: absolute; 
    top: -5px; 
    right: -8px; 
    background: #d63031; 
    color: white; 
    font-size: 0.7rem; 
    font-weight: bold; 
    padding: 2px 5px; 
    border-radius: 10px; 
    min-width: 15px; 
    text-align: center;
    border: 2px solid white; /* Gör att den "poppar" mot bakgrunden */
}

/* STATUS PRICKAR - FIX */
.status-dot {
    height: 12px;
    width: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle; /* Centrera vertikalt mot texten */
    border: 2px solid white; /* Vit kant gör att den syns bättre */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    position: relative;
    top: -1px; /* Finjustera höjden */
}
.dot-green { background-color: #2ecc71; } /* Grön */
.dot-yellow { background-color: #f1c40f; } /* Gul */
.dot-red { background-color: #e74c3c; }    /* Röd */