/* =========================================
   1. GLOBAL
   ========================================= */
:root {
    --bg-dark: #343645;
    --bg-card: #111827;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --accent-cyan: #00f2ff;
    --accent-red: #ff3131;
    --accent-red-glow: rgba(255, 49, 49, 0.4);
    --border: #1e293b;
    --font-main: 'Inter', sans-serif;
}

body {
    margin: 0; padding: 0;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    /* DESKTOP DEFAULT: GRID LAYOUT */
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
* { box-sizing: border-box; }

/* =========================================
   2. SIDEBAR (DESKTOP)
   ========================================= */
aside {
    background: #0d121f;
    border-right: 1px solid var(--border);
    padding: 20px;
    height: 100vh;
    position: sticky; top: 0;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header img {
    max-width: 100%; height: auto; border-radius: 8px; margin-bottom: 30px; cursor: pointer; display: block;
}

/* Skjul mobil-elementer på desktop */
.mobile-nav, .mobile-close-container, .overlay { display: none; }

.menu-section h3 { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 15px; letter-spacing: 1px; }
.menu-section ul { list-style: none; padding: 0; }
.menu-section li { padding: 10px 0; color: #cbd5e1; cursor: pointer; font-size: 0.95rem; transition: 0.2s; display: flex; align-items: center; gap: 10px; }
.menu-section li:hover { color: var(--accent-cyan); transform: translateX(5px); }

/* =========================================
   3. MAIN CONTENT
   ========================================= */
main {
    padding: 20px 40px; max-width: 1400px; margin: 0 auto; width: 100%;
}

.market-ticker {
    background: #0f172a; border-bottom: 1px solid var(--border);
    height: 40px; overflow: hidden; white-space: nowrap; position: relative;
    display: flex; align-items: center; margin: -20px -40px 30px -40px; padding-left: 20px;
}
.ticker-scroll { display: inline-block; animation: scroll-left 40s linear infinite; }
.ticker-item { display: inline-block; margin-right: 30px; font-size: 0.85rem; font-family: monospace; }
.ticker-item .up { color: #4ade80; }
.ticker-item .down { color: #f87171; }
@keyframes scroll-left { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

/* =========================================
   4. KORT & GRID
   ========================================= */
.grid {
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 20px; align-items: start; 
}

.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden; transition: transform 0.2s;
    cursor: pointer; display: flex; flex-direction: column; height: 100%;
}
.card:hover { transform: translateY(-5px); border-color: #334155; }
.card-24h { border-left: 3px solid var(--accent-cyan) !important; }

.card-img { width: 100%; height: 180px; object-fit: cover; border-bottom: 1px solid var(--border); }
.card-body { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }

.card-category { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-cyan); font-weight: bold; margin-bottom: 5px; }
.card h2 { font-size: 1.1rem; line-height: 1.3; margin: 0 0 10px 0; color: #fff; }
.card p { font-size: 0.9rem; color: #94a3b8; line-height: 1.5; flex-grow: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-footer { margin-top: 15px; padding-top: 15px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; font-size: 0.75rem; color: #64748b; }

.day-divider { grid-column: 1 / -1; display: flex; align-items: center; margin: 30px 0 15px 0; width: 100%; }
.day-divider span { color: #fff; background: var(--bg-dark); padding-right: 15px; font-weight: 900; font-size: 0.9rem; text-transform: uppercase; }
.day-divider::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, 0.3); }

/* Breaking News Desktop */
.card-breaking {
    border-color: var(--accent-red) !important;
    background: linear-gradient(145deg, #1a0a0a 0%, #12192a 100%);
    grid-column: 1 / -1 !important; display: flex; flex-direction: row; height: auto; 
}
.breaking-badge-card { display: inline-block; background: var(--accent-red); color: white; font-weight: 900; font-size: 0.7rem; padding: 4px 10px; border-radius: 4px; margin-bottom: 12px; text-transform: uppercase; animation: pulse-red 2s infinite; }
@keyframes pulse-red { 0%, 100% { box-shadow: 0 0 5px var(--accent-red-glow); } 50% { box-shadow: 0 0 20px var(--accent-red-glow); } }
.card-breaking .card-img { width: 40%; height: auto; min-height: 100%; border-bottom: none; border-right: 1px solid var(--accent-red); }
.card-breaking .card-body { width: 60%; padding: 2rem; justify-content: center; }
.card-breaking h2 { font-size: 2.0rem !important; margin-bottom: 15px; }

/* =========================================
   5. ARTIKEL VISNING
   ========================================= */
#article-view { max-width: 800px; margin: 0 auto; }
.back-btn { background:none; border:none; color:#ccc; cursor:pointer; font-size:1rem; margin-bottom:20px; }
.article-header h1 { font-size: 2.5rem; margin-bottom: 10px; line-height: 1.2; color: #fff; }
.article-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.article-tags a { background: rgba(0, 242, 255, 0.1); color: var(--accent-cyan); padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; border: 1px solid rgba(0, 242, 255, 0.2); }
.article-hero-img { width: 100%; height: auto; border-radius: 12px; margin-bottom: 30px; border: 1px solid #333; }
.article-body { font-size: 1.1rem; line-height: 1.8; color: #e2e8f0; }

/* MODAL */
.btn-report { background: transparent; border: 1px solid #333; color: #666; padding: 8px 15px; font-size: 0.8rem; border-radius: 4px; cursor: pointer; margin-top: 30px; }
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 2000; justify-content: center; align-items: center; }
.modal-box { background: #111827; border: 1px solid var(--border); padding: 30px; border-radius: 12px; width: 90%; max-width: 500px; position: relative; }
.modal-close { position: absolute; top: 15px; right: 15px; background: none; border: none; color: #666; font-size: 1.5rem; cursor: pointer; }
.report-textarea, .report-input { width: 100%; background: #000; border: 1px solid #333; color: #fff; padding: 10px; border-radius: 6px; margin-bottom: 15px; }
.btn-send-report { background: var(--accent-red); color: #fff; border: none; padding: 10px 20px; font-weight: bold; border-radius: 6px; cursor: pointer; width: 100%; }

/* =========================================
   6. RESPONSIVITET (FIXER SORT SKÆRM & GRÅ STRIBE)
   ========================================= */
@media (max-width: 1024px) {
    /* SKIFT FRA GRID TIL BLOCK -> DETTE FIXER LAYOUTET */
    body { display: block; } 

    /* MOBIL HEADER */
    .mobile-nav { 
        display: flex; justify-content: space-between; align-items: center;
        padding: 15px 20px; background: #0d121f; border-bottom: 1px solid var(--border);
        position: sticky; top: 0; z-index: 1001;
    }
    .mob-logo { color: var(--accent-cyan); font-weight: 900; font-size: 1.3rem; }
    .burger { font-size: 1.5rem; cursor: pointer; color: #fff; }

    /* SIDEBAR SOM OFF-CANVAS DRAWER */
    aside { 
        position: fixed; left: -300px; width: 280px; z-index: 2000; 
        transition: 0.3s ease; box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    aside.active { left: 0; }
    .mobile-close-container { display: block; border-bottom: 1px solid #222; padding-bottom: 10px; margin-bottom: 20px; }
    .close-x { color: var(--accent-red); font-weight: bold; cursor: pointer; }
    .overlay.active { display: block; }

    /* MAIN CONTENT FIX */
    main { padding: 15px; width: 100%; }
    .market-ticker { margin: -15px -15px 20px -15px; }
    
    /* GRID FIX */
    .grid { grid-template-columns: 1fr; } 
    
    /* BREAKING NEWS MOBIL FIX */
    .card-breaking { flex-direction: column; }
    .card-breaking .card-img { width: 100%; height: 200px; border-right: none; border-bottom: 1px solid var(--accent-red); }
    .card-breaking .card-body { width: 100%; padding: 20px; }
    .card-breaking h2 { font-size: 1.5rem !important; }

    .article-header h1 { font-size: 1.8rem; }
}