/* =================================================================
   WORKPLAN LAYOUT & SIDEBAR
   =================================================================
   Designsystem for sidebar-navigation med rod header, navy sidebar
   och teal accenter. Responsiv med mobil hamburger-meny.

   Beroenden:
   - Google Material Symbols Outlined (ikoner)
   - DM Sans / Funnel Sans (typsnitt, valfritt)
   ================================================================= */

:root {
    --wp-red: #a81b27;
    --wp-red-hover: #8a1520;
    --wp-sidebar-bg: #192734;
    --wp-sidebar-hover: #243244;
    --wp-sidebar-border: #2d3b4a;
    --wp-accent: #20a29d;
    --wp-accent-soft: rgba(32, 162, 157, 0.12);
    --wp-accent-border: rgba(32, 162, 157, 0.40);
    --wp-text-primary: #0F172A;
    --wp-text-secondary: #64748B;
    --wp-text-muted: #94A3B8;
    --wp-border: #E2E8F0;
    --wp-surface: #FFFFFF;
    --wp-surface-alt: #F8FAFC;
}

/* ----- Root-layout ----- */
.wp-layout {
    display: flex;
    min-height: 100vh;
    background: var(--wp-surface-alt);
    color: var(--wp-text-primary);
}

.wp-main-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.wp-main {
    flex: 1;
    min-width: 0;
    padding: 1rem 2rem;
    overflow-x: auto;
}

/* ----- Mobil-toggle ----- */
.wp-sidebar-checkbox {
    display: none;
}

.wp-sidebar-overlay {
    display: none;
}

/* =================================================================
   SIDEBAR-KOLUMN
   ================================================================= */
.wp-sidebar-column {
    display: flex;
    flex-direction: column;
    width: 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    background: #192734;
    color: rgba(255, 255, 255, 0.92);
    border-right: 1px solid #2d3b4a;
    flex-shrink: 0;
    z-index: 100;
    font-family: 'DM Sans', 'Funnel Sans', sans-serif;
}

/* ----- Rod header (endast over sidebar) ----- */
.wp-header {
    position: static;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    height: 56px;
    padding: 0 1rem;
    background: #a81b27;
    color: #FFFFFF;
    flex-shrink: 0;
}

.wp-header-title {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.wp-hamburger {
    display: none;
    cursor: pointer;
    align-items: center;
    padding: 4px;
    border-radius: 4px;
    color: #FFFFFF;
    transition: background 0.15s;
    line-height: 0;
}

    .wp-hamburger:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .wp-hamburger .material-symbols-outlined {
        font-size: 24px;
    }

/* ----- Nav ----- */
.wp-sidebar {
    position: static;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    width: auto;
    background: #192734;
    z-index: auto;
    transform: none;
    transition: none;
}

    .wp-sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .wp-sidebar::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.15);
        border-radius: 3px;
    }

/* Fallback om wp-sidebar ligger direkt i wp-layout utan wrapper */
.wp-layout > .wp-sidebar {
    width: 260px;
    flex: 0 0 260px;
    height: 100vh;
    position: sticky;
    top: 0;
    border-right: 1px solid #2d3b4a;
}

/* ----- Huvudposter ----- */
.wp-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 2px 8px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    list-style: none;
    user-select: none;
}

    .wp-sidebar-item::-webkit-details-marker,
    .wp-sidebar-item::marker {
        display: none;
        content: "";
    }

    .wp-sidebar-item:hover {
        background: rgba(32, 162, 157, 0.12);
        color: #FFFFFF;
        text-decoration: none;
    }

    .wp-sidebar-item.active {
        background: rgba(32, 162, 157, 0.12);
        color: #FFFFFF;
        border-left: 3px solid #20a29d;
        padding-left: 13px;
    }

    .wp-sidebar-item .material-symbols-outlined {
        font-size: 1.25rem;
        opacity: 0.75;
        flex-shrink: 0;
    }

/* Aktiv grupp */
.wp-sidebar-group.has-active > summary {
    background: rgba(32, 162, 157, 0.12);
    color: #FFFFFF;
    border-left: 3px solid #20a29d;
    padding-left: 13px;
}

/* ----- Chevron ----- */
.wp-sidebar-chevron {
    margin-left: auto;
    font-size: 1.1rem !important;
    opacity: 0.5;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

details.wp-sidebar-group[open] > summary .wp-sidebar-chevron {
    transform: rotate(180deg);
    opacity: 0.8;
    color: rgba(32, 162, 157, 0.9);
}

details.wp-sidebar-group[open] > summary.wp-sidebar-item:not(.active):not(.has-active) {
    background: rgba(255, 255, 255, 0.04);
}

/* ----- Submenu ----- */
.wp-sidebar-submenu {
    border-left: 2px solid rgba(32, 162, 157, 0.40);
    margin-left: 24px;
    padding: 4px 0;
}

.wp-sidebar-submenu .wp-sidebar-submenu {
    margin-left: 16px;
    border-left-color: rgba(32, 162, 157, 0.25);
}

.wp-sidebar-submenu .wp-sidebar-submenu .wp-sidebar-submenu {
    margin-left: 12px;
    border-left-color: rgba(32, 162, 157, 0.15);
}

/* ----- Subposter ----- */
.wp-sidebar-subitem {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 1px 6px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-size: 0.87rem;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    list-style: none;
    user-select: none;
}

    .wp-sidebar-subitem::-webkit-details-marker,
    .wp-sidebar-subitem::marker {
        display: none;
        content: "";
    }

    .wp-sidebar-subitem:hover {
        background: rgba(32, 162, 157, 0.15);
        color: #FFFFFF;
        text-decoration: none;
    }

    .wp-sidebar-subitem.active {
        background: rgba(32, 162, 157, 0.22);
        color: #FFFFFF;
        font-weight: 500;
    }

.wp-sidebar-subgroup-toggle {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.88);
    cursor: pointer;
}

details.wp-sidebar-group[open] > .wp-sidebar-subgroup-toggle {
    color: rgba(255, 255, 255, 0.95);
}

.wp-sidebar-submenu .material-symbols-outlined {
    font-size: 1.05rem;
    opacity: 0.55;
}

.wp-sidebar-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* ----- Divider ----- */
.wp-sidebar-divider {
    height: 1px;
    background: linear-gradient(to right, transparent 0%, rgba(255, 255, 255, 0.12) 20%, rgba(255, 255, 255, 0.12) 80%, transparent 100%);
    margin: 0.5rem 1rem;
}

/* ----- Grunddata dampad ----- */
.wp-sidebar-grunddata > summary {
    opacity: 0.75;
    font-size: 0.875rem;
}

    .wp-sidebar-grunddata > summary:hover {
        opacity: 1;
    }

.wp-sidebar-grunddata[open] > summary {
    opacity: 0.9;
}

.wp-sidebar-subicon {
    font-size: 1rem !important;
    margin-right: 0.25rem;
    opacity: 0.7;
    vertical-align: middle;
}

/* =================================================================
   USER-AREA (botten)
   ================================================================= */
.wp-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border-top: 1px solid #2d3b4a;
    flex-shrink: 0;
    position: relative;
    background: #192734;
}

.wp-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
    padding: 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

    .wp-user-info:hover {
        background: #243244;
    }

    .wp-user-info.active {
        background: rgba(32, 162, 157, 0.12);
    }

.wp-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #243244;
    border: 2px solid #20a29d;
    flex-shrink: 0;
}

.wp-user-text {
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.wp-user-name {
    color: #FFFFFF;
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wp-user-meta {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.75rem;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wp-user-menu {
    position: relative;
    flex-shrink: 0;
}

.wp-user-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    cursor: pointer;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    list-style: none;
    user-select: none;
    transition: background 0.15s, color 0.15s;
}

    .wp-user-menu-toggle::-webkit-details-marker,
    .wp-user-menu-toggle::marker {
        display: none;
        content: "";
    }

    .wp-user-menu-toggle:hover {
        background: #243244;
        color: #FFFFFF;
    }

.wp-user-menu[open] > .wp-user-menu-toggle {
    background: #243244;
    color: #FFFFFF;
}

.wp-user-menu-toggle .material-symbols-outlined {
    font-size: 1.25rem;
}

.wp-user-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.wp-user-dropdown {
    position: absolute;
    bottom: calc(100% + 0.25rem);
    right: 0;
    top: auto;
    min-width: 200px;
    margin-top: 0;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    overflow: hidden;
    z-index: 1001;
}

.wp-user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    font-size: 0.88rem;
    transition: background 0.12s, color 0.12s;
    cursor: pointer;
}

    .wp-user-dropdown-item:hover {
        background: #f0f7f6;
        color: #20a29d;
    }

    .wp-user-dropdown-item .material-symbols-outlined {
        font-size: 1.15rem;
        color: #999;
    }

.wp-user-dropdown-danger {
    color: #B91C1C;
}

    .wp-user-dropdown-danger:hover {
        background: #FEF2F2;
        color: #991B1B;
    }

    .wp-user-dropdown-danger .material-symbols-outlined {
        color: #DC2626;
    }

.wp-user-divider {
    margin: 0.25rem 0;
    border: none;
    border-top: 1px solid #E2E8F0;
}

/* =================================================================
   TOPBAR (vit bar ovanpa huvudinnehall)
   ================================================================= */
.wp-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 56px;
    padding: 0 1.5rem;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.wp-topbar-hamburger {
    display: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    color: #64748B;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}

    .wp-topbar-hamburger:hover {
        background: #F1F5F9;
        color: #0F172A;
    }

    .wp-topbar-hamburger .material-symbols-outlined {
        font-size: 1.375rem;
    }

@media (max-width: 768px) {
    .wp-topbar-hamburger {
        display: inline-flex;
    }
}

.wp-topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748B;
    flex-shrink: 0;
}

    .wp-topbar-breadcrumb a {
        color: #64748B;
        text-decoration: none;
        transition: color 0.1s;
    }

        .wp-topbar-breadcrumb a:hover {
            color: #0F172A;
        }

.wp-breadcrumb-sep {
    color: #CBD5E1;
    display: inline-flex;
    align-items: center;
    user-select: none;
}

    .wp-breadcrumb-sep .material-symbols-outlined {
        font-size: 1rem;
    }

.wp-breadcrumb-current {
    color: #0F172A;
    font-weight: 500;
}

.wp-topbar-search {
    position: relative;
    flex: 1;
    max-width: 420px;
    margin: 0 auto;
}

.wp-topbar-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.125rem !important;
    color: #94A3B8;
    pointer-events: none;
}

.wp-topbar-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    font-size: 0.875rem;
    font-family: inherit;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    color: #0F172A;
    outline: none;
    transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

    .wp-topbar-search input:focus {
        background: #FFFFFF;
        border-color: #a81b27;
        box-shadow: 0 0 0 3px rgba(168, 27, 39, 0.1);
    }

    .wp-topbar-search input::placeholder {
        color: #94A3B8;
    }

.wp-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.wp-topbar-iconbtn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #64748B;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    padding: 0;
}

    .wp-topbar-iconbtn:hover {
        background: #F1F5F9;
        color: #0F172A;
    }

    .wp-topbar-iconbtn .material-symbols-outlined {
        font-size: 1.25rem;
    }

.wp-topbar-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #a81b27;
    border-radius: 50%;
    border: 2px solid #FFFFFF;
}

/* =================================================================
   MOBIL
   ================================================================= */
@media (max-width: 768px) {
    .wp-sidebar-column {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        height: 100dvh;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
        z-index: 1000;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .wp-header {
        flex-shrink: 0;
    }

    .wp-sidebar {
        flex: 1 1 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }

    .wp-sidebar-user {
        flex-shrink: 0;
    }

    .wp-sidebar-checkbox:checked ~ .wp-layout .wp-sidebar-column {
        transform: translateX(0);
    }

    .wp-sidebar-checkbox:checked ~ .wp-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 999;
    }

    .wp-hamburger {
        display: inline-flex;
    }

    .wp-main {
        padding: 1rem;
    }

    .wp-topbar {
        padding: 0 1rem;
    }

    .wp-topbar-search {
        display: none;
    }
}


/* =================================================================
   WORKPLAN -- sidmall-komponenter (valfritt)
   ================================================================= */

/* ----- Page header ----- */
.wp-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.wp-page-header-text {
    flex: 1;
    min-width: 0;
}

.wp-page-subtitle {
    color: #64748B;
    font-size: 0.9rem;
    margin: 0.25rem 0 0 0;
}

.wp-page-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ----- KPI-kort ----- */
.wp-kpi-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 1rem 1.1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    height: 100%;
}

    .wp-kpi-card:hover {
        border-color: #CBD5E1;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    }

.wp-kpi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.wp-kpi-label {
    font-size: 0.85rem;
    color: #64748B;
    font-weight: 500;
}

.wp-kpi-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: #0F172A;
    line-height: 1.1;
}

.wp-kpi-trend {
    font-size: 0.75rem;
    color: #64748B;
    margin-top: 0.25rem;
    min-height: 1rem;
}

/* ----- Kort ----- */
.wp-card {
    border-radius: 10px !important;
    border-color: #E2E8F0 !important;
    padding: 0 !important;
    overflow: hidden;
}

.wp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #E2E8F0;
}

.wp-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0F172A;
    margin: 0;
}

.wp-card-body {
    padding: 1rem 1.25rem;
}

/* ----- Filter-rad ----- */
.wp-filter-bar {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

/* ----- Hjalpklasser for marginaler ----- */
.wp-mt-0 { margin-top: 0; }
.wp-mt-2 { margin-top: 0.5rem; }
.wp-mt-4 { margin-top: 1rem; }
.wp-mb-0 { margin-bottom: 0; }
.wp-mb-2 { margin-bottom: 0.5rem; }
.wp-mb-4 { margin-bottom: 1rem; }
