:root {
    --bg-color: #f0f2f5;
    --white: #ffffff;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --primary-red: #ef4444;
    --primary-blue: #3b82f6;
    --top-bar-height: 60px;
    --bottom-bar-height: 70px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    padding-top: var(--top-bar-height);
    padding-bottom: var(--bottom-bar-height);
}

/* --- TOP BAR --- */
.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--top-bar-height);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between; /* Viktigt för fördelning */
    padding: 0 15px;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.icon-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-dark); z-index: 1001; }

.page-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

/* --- NOTIFIERINGAR --- */
.notifications-wrapper {
    position: relative; /* VIKTIGT för att menyn ska hamna rätt */
    cursor: pointer;
    font-size: 1.2rem;
}

.badge-count {
    position: absolute; top: -5px; right: -5px;
    background: var(--primary-red); color: white;
    font-size: 0.6rem; padding: 2px 5px; border-radius: 10px;
}

/* Dropdown meny */
.notif-dropdown {
    display: none; /* Dold som standard */
    position: absolute;
    top: 35px;
    right: -10px;
    width: 280px;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    z-index: 2000;
    overflow: hidden;
    text-align: left;
}

.notif-dropdown.show { display: block; } /* Visas när klassen 'show' läggs på av JS */

.notif-header {
    background: #f9fafb;
    padding: 10px 15px;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--text-light);
    border-bottom: 1px solid #f3f4f6;
}

.notif-group { padding: 8px 0; border-bottom: 1px solid #f3f4f6; }
.notif-group:last-child { border-bottom: none; }

.notif-group label {
    padding: 0 15px;
    font-size: 0.65rem;
    color: #9ca3af;
    text-transform: uppercase;
    font-weight: bold;
    display: block;
    margin-bottom: 4px;
}

.notif-item { padding: 6px 15px; font-size: 0.85rem; color: var(--text-dark); line-height: 1.3; }
.notif-item:hover { background: #f9fafb; }
.notif-item.alert { color: var(--primary-red); }
.notif-item.info { color: var(--primary-blue); }
.notif-item.empty { color: #d1d5db; font-style: italic; font-size: 0.75rem; }


/* --- MAIN CONTENT --- */
.main-content { padding: 15px; max-width: 800px; margin: 0 auto; }

.welcome-card {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.welcome-header { display: flex; align-items: center; gap: 15px; }
.logo-placeholder { 
    width: 50px; height: 50px; background: #f3f4f6; 
    display: flex; align-items: center; justify-content: center; 
    font-weight: bold; border-radius: 8px; color: var(--primary-red);
}
.welcome-header h2 { font-size: 1.1rem; margin-bottom: 4px; }
.subtitle { font-size: 0.85rem; color: var(--text-light); font-weight: 500; }

.section-title {
    font-size: 0.75rem; color: #9ca3af; font-weight: 700; text-transform: uppercase;
    margin-bottom: 10px; display: flex; justify-content: space-between;
}
.view-all { color: var(--primary-blue); cursor: pointer; text-transform: none; }

.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-item {
    background: var(--white);
    padding: 15px; border-radius: 8px;
    display: flex; align-items: flex-start; gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.icon-box {
    min-width: 35px; height: 35px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 1rem;
}
.icon-box.blue { background: #eff6ff; color: var(--primary-blue); }
.icon-box.green { background: #f0fdf4; color: #22c55e; }
.icon-box.red { background: #fef2f2; color: var(--primary-red); }

.text-content { flex: 1; font-size: 0.9rem; line-height: 1.4; }
.date { font-size: 0.7rem; color: var(--text-light); text-align: right; min-width: 50px; }

.badge {
    font-size: 0.6rem; padding: 2px 4px; border-radius: 3px; color: white;
    font-weight: bold; text-transform: uppercase; margin-left: 5px; vertical-align: middle;
}
.badge.blue { background-color: var(--primary-blue); }
.badge.green { background-color: #22c55e; }
.badge.red { background-color: var(--primary-red); }

/* --- SIDEBAR --- */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; background: var(--white);
    z-index: 2000; transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex; flex-direction: column;
}
.sidebar.open { transform: translateX(0); }
.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1500; opacity: 0; visibility: hidden; transition: 0.3s;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.sidebar-header { padding: 20px; border-bottom: 1px solid #eee; }
.user-profile { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; background: #333; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; }
.user-info h3 { font-size: 0.95rem; }
.user-info p { font-size: 0.8rem; color: var(--text-light); }

.sidebar-scroll { overflow-y: auto; flex: 1; padding: 10px 0; }
.menu-section { margin-bottom: 20px; }
.menu-section label { padding: 0 20px; font-size: 0.7rem; color: #9ca3af; font-weight: bold; display: block; margin-bottom: 5px; }
.menu-section a {
    display: flex; align-items: center; gap: 15px; padding: 12px 20px;
    text-decoration: none; color: var(--text-dark); font-size: 0.9rem;
}
.menu-section a:hover { background: #f9fafb; }
.menu-section i { width: 20px; text-align: center; color: #6b7280; }

/* --- BOTTOM BAR --- */
.bottom-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--bottom-bar-height);
    background: var(--white);
    display: flex; justify-content: space-around;
    align-items: center;
    border-top: 1px solid #eee;
    z-index: 1000;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center;
    text-decoration: none; color: #9ca3af; gap: 4px;
    width: 33%;
}
.nav-item i { font-size: 1.2rem; }
.nav-item span { font-size: 0.7rem; }
.nav-item.active { color: var(--primary-red); }

/* Avatar container */
.avatar-container {
    width: 45px; height: 45px;
    border-radius: 50%;
    overflow: hidden;
    background: #333;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: bold;
    flex-shrink: 0;
}

/* Om det är en bild */
.avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
}

/* Om det är text */
.avatar-text {
    font-size: 1rem;
}

/* Roll-badge under namnet */
.role-badge {
    font-size: 0.75rem;
    color: var(--primary-blue);
    background: #eff6ff;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 2px;
}

/* --- INLOGGNINGSSIDA --- */
body.login-page {
    background-color: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
    padding-top: 0; padding-bottom: 0; /* Nollställ app-padding */
}

.login-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card {
    background: white;
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.login-logo {
    width: 60px; height: 60px;
    background: #fef2f2; color: #ef4444;
    font-size: 1.5rem; font-weight: bold;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    margin: 0 auto 20px auto;
}

.login-card h2 { font-size: 1.5rem; margin-bottom: 10px; color: #1f2937; }
.login-card p { color: #6b7280; font-size: 0.9rem; margin-bottom: 30px; }

.form-group { text-align: left; margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: bold; margin-bottom: 5px; color: #374151; }
.form-group input {
    width: 100%; padding: 12px;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 1rem;
}
.form-group input:focus { border-color: #3b82f6; outline: none; }

.login-btn {
    width: 100%; padding: 12px;
    background: #ef4444; color: white;
    border: none; border-radius: 6px;
    font-size: 1rem; font-weight: bold; cursor: pointer;
    transition: background 0.2s;
}
.login-btn:hover { background: #dc2626; }

.error-msg {
    background: #fef2f2; color: #ef4444;
    padding: 10px; border-radius: 6px;
    margin-bottom: 20px; font-size: 0.9rem;
}

.copyright { font-size: 0.75rem; color: #9ca3af; }