/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue-dark:   #1a3a5c;
    --blue-mid:    #2563a8;
    --blue-light:  #4a8fd4;
    --blue-pale:   #e8f1fb;
    --accent:      #5b8f6e;
    --text:        #1e2d3d;
    --text-muted:  #5a6a7a;
    --border:      #d0dce8;
    --bg:          #f5f8fc;
    --white:       #ffffff;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
    --shadow-md:   0 4px 12px rgba(0,0,0,.10);
    --radius:      8px;
    --radius-lg:   12px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--blue-mid); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }

h1 { font-size: 1.75rem; font-weight: 700; color: var(--blue-dark); margin-bottom: .75rem; }
h2 { font-size: 1.35rem; font-weight: 600; color: var(--blue-dark); margin-bottom: .5rem; }
h3 { font-size: 1.1rem; font-weight: 600; color: var(--blue-dark); margin-bottom: .5rem; }

p { margin-bottom: 1rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: .3rem; }

/* === HEADER === */
.site-header {
    background: var(--blue-dark);
    color: var(--white);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 1rem;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    color: var(--white);
    flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; color: var(--white); }
.logo-flower { font-size: 1.6rem; color: #a8c8f0; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text strong { font-size: 1.1rem; font-weight: 700; }
.logo-text span { font-size: .75rem; opacity: .8; font-weight: 400; }

.main-nav ul {
    list-style: none;
    display: flex;
    gap: .25rem;
    padding: 0;
    margin: 0;
}

.main-nav a {
    display: block;
    padding: .45rem .75rem;
    color: rgba(255,255,255,.85);
    font-size: .9rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: background .15s, color .15s;
    text-decoration: none;
}
.main-nav a:hover,
.main-nav a.active { background: rgba(255,255,255,.15); color: var(--white); text-decoration: none; }
.main-nav a.nav-admin { color: #ffd700; }
.main-nav a.nav-underhall { color: #7dd3a8; }

/* Hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: .25s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* === PAGE LAYOUT === */
.page-wrapper {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2rem;
    flex: 1;
}

/* === SIDEBAR === */
.sidebar-nav {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 80px;
    height: fit-content;
}

.sidebar-nav h3 {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: .75rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { margin: 0; }
.sidebar-nav a {
    display: block;
    padding: .45rem .6rem;
    color: var(--text);
    font-size: .9rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--blue-pale);
    color: var(--blue-mid);
    text-decoration: none;
}

/* === MAIN CONTENT === */
.main-content { min-width: 0; }

/* === CARDS & SECTIONS === */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--blue-dark);
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 2px solid var(--blue-pale);
}
.section-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 1.2em;
    background: var(--blue-mid);
    border-radius: 2px;
}

/* Home page grid */
.home-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* News items */
.news-item { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; padding-bottom: 0; }
.news-title { font-weight: 600; color: var(--blue-dark); margin-bottom: .25rem; }
.news-body { color: var(--text); font-size: .95rem; }

/* Aktuellt items */
.aktuellt-item { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.aktuellt-item:last-child { border-bottom: none; padding-bottom: 0; }
.aktuellt-title { font-weight: 600; font-size: .95rem; color: var(--blue-dark); }
.aktuellt-body { font-size: .875rem; color: var(--text-muted); margin-top: .2rem; }

/* === TABLE === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.data-table th {
    background: var(--blue-dark);
    color: var(--white);
    padding: .6rem .9rem;
    text-align: left;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.data-table th:first-child { border-radius: var(--radius) 0 0 0; }
.data-table th:last-child { border-radius: 0 var(--radius) 0 0; }
.data-table td { padding: .6rem .9rem; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--blue-pale); }
.data-table tr:nth-child(even) td { background: #fafcff; }
.data-table tr:nth-child(even):hover td { background: var(--blue-pale); }

/* Husnumber badge */
.hus-badge {
    display: inline-block;
    background: var(--blue-mid);
    color: var(--white);
    font-size: .75rem;
    font-weight: 700;
    padding: .15rem .45rem;
    border-radius: 20px;
    min-width: 2rem;
    text-align: center;
}

/* === STYRELSE GRID === */
.styrelse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.styrelse-card {
    background: var(--blue-pale);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.styrelse-titel { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-mid); font-weight: 600; margin-bottom: .5rem; }
.styrelse-namn { font-size: 1.05rem; font-weight: 700; color: var(--blue-dark); margin-bottom: .75rem; }
.styrelse-info { font-size: .875rem; color: var(--text); }
.styrelse-info dt { color: var(--text-muted); font-size: .8rem; margin-top: .4rem; }
.styrelse-info dd { font-weight: 500; }

/* === FORMS === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .875rem; font-weight: 500; color: var(--text); margin-bottom: .35rem; }
.form-control {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--blue-light);
    box-shadow: 0 0 0 3px rgba(37,99,168,.12);
}
textarea.form-control { resize: vertical; min-height: 120px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, transform .1s;
    text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--blue-mid); color: var(--white); }
.btn-primary:hover { background: var(--blue-dark); color: var(--white); text-decoration: none; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #c0cdd8; color: var(--text); text-decoration: none; }
.btn-sm { padding: .35rem .8rem; font-size: .8rem; }

/* === DOKUMENT === */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.folder-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    transition: box-shadow .15s, border-color .15s;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    display: block;
}
.folder-card:hover { box-shadow: var(--shadow-md); border-color: var(--blue-light); color: var(--text); text-decoration: none; }
.folder-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.folder-name { font-weight: 600; font-size: .9rem; word-break: break-word; }

.doc-list { list-style: none; padding: 0; }
.doc-list li { padding: .6rem 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .6rem; }
.doc-list li:last-child { border-bottom: none; }
.doc-icon { color: #e53e3e; font-size: 1.1rem; flex-shrink: 0; }
.doc-link { color: var(--blue-mid); font-size: .9rem; word-break: break-word; }
.doc-link:hover { color: var(--blue-dark); }

/* === KARTA === */
.karta-content img { max-width: 100%; border-radius: var(--radius); margin-bottom: 1rem; box-shadow: var(--shadow-sm); }

/* === SEARCH === */
.search-box { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.search-box .form-control { flex: 1; }

/* === ALERT === */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }

/* === FOOTER === */
.site-footer {
    background: var(--blue-dark);
    color: rgba(255,255,255,.7);
    padding: 1.25rem 0;
    margin-top: auto;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    text-align: center;
    font-size: .875rem;
}

/* === CONTENT TEXT === */
.prose h3 { margin-top: 1.5rem; margin-bottom: .5rem; }
.prose p { margin-bottom: .9rem; }
.prose ul, .prose ol { margin-bottom: .9rem; padding-left: 1.5rem; }
.prose pre { background: var(--blue-pale); border-radius: 4px; padding: .5rem .75rem; font-size: .85rem; margin-bottom: .9rem; }
.prose b { color: var(--blue-dark); }

/* === PAGINATION === */
.pagination { display: flex; gap: .5rem; margin-top: 1rem; }
.page-btn { padding: .4rem .8rem; border: 1px solid var(--border); border-radius: 6px; background: var(--white); font-size: .85rem; cursor: pointer; transition: background .15s; }
.page-btn:hover, .page-btn.active { background: var(--blue-pale); border-color: var(--blue-light); }

.page-wrapper--full { grid-template-columns: 1fr; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .page-wrapper { grid-template-columns: 1fr; }
    .sidebar { order: 2; }
    .main-content { order: 1; }
    .sidebar-nav { position: static; }
    .home-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .nav-toggle { display: flex; }

    .main-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--blue-dark);
        padding: .75rem 1rem;
        box-shadow: var(--shadow-md);
    }
    .main-nav.open { display: block; }
    .main-nav ul { flex-direction: column; gap: .25rem; }
    .main-nav a { padding: .6rem .75rem; }

    .header-inner { position: relative; }

    .page-wrapper { padding: 0 1rem; margin: 1rem auto; gap: 1rem; }
    h1 { font-size: 1.4rem; }
    .styrelse-grid { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
    .folder-grid { grid-template-columns: repeat(2, 1fr); }
}
