/* ============================================================
 * FILE: static/css/layout.css
 * Clarifyr Design System — Layout (GOLD LEVEL)
 * ============================================================
 * Defines:
 * - Page structure
 * - Containers
 * - Grids
 * - Flex utilities
 * - Spacing utilities
 * - Responsive rules
 * - Admin & Premium layout overrides
 * ============================================================
 */

/* ------------------------------------------------------------
 * PAGE STRUCTURE
 * ------------------------------------------------------------ */

.page {
    width: 100%;
    min-height: 100vh;
    padding: var(--space-6) var(--space-4);
    background-color: var(--clr-bg);
}

.page-section {
    margin-bottom: var(--space-7);
}

.section-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-4);
    color: var(--clr-fg);
}

/* ------------------------------------------------------------
 * CONTAINERS
 * ------------------------------------------------------------ */

.container {
    max-width: 1100px;   /* kleiner dan jouw huidige */
    margin: 0 auto;
    overflow-x: hidden;  /* geen horizontale scrollbar */
}

.container-narrow {
    max-width: 960px;
}

/* ------------------------------------------------------------
 * GLOBAL STATUS MESSAGES
 * ------------------------------------------------------------ */

.flash-container {
    display: grid;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.flash {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--clr-border);
    border-left-width: 4px;
    border-radius: var(--radius-lg);
    background-color: var(--clr-bg-alt);
    color: var(--clr-fg);
    font-weight: var(--font-weight-medium);
    box-shadow: var(--shadow-sm);
}

.flash-success {
    border-left-color: var(--clr-success);
    background-color: var(--clr-success-soft);
    color: var(--clr-fg);
}

.flash-error {
    border-left-color: var(--clr-danger);
    background-color: var(--clr-danger-soft);
    color: var(--clr-fg);
}

.flash-info {
    border-left-color: var(--clr-info);
    background-color: var(--clr-info-soft);
    color: var(--clr-fg);
}

.flash-warning {
    border-left-color: var(--clr-warning);
    background-color: var(--clr-warning-soft);
    color: var(--clr-fg);
}

/* ------------------------------------------------------------
 * GRID SYSTEM
 * ------------------------------------------------------------ */

.grid {
    display: grid;
    gap: var(--space-4);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: var(--bp-md)) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------
 * FLEX UTILITIES
 * ------------------------------------------------------------ */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-row {
    flex-direction: row;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* ------------------------------------------------------------
 * SPACING UTILITIES
 * ------------------------------------------------------------ */

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mb-2 {
    margin-bottom: var(--space-2);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

/* ------------------------------------------------------------
 * CARD LAYOUTS
 * ------------------------------------------------------------ */

.card-grid {
    display: grid;
    gap: var(--space-4);
}

@media (min-width: var(--bp-md)) {
    .card-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ------------------------------------------------------------
 * ORGANIZATION DASHBOARD LAYOUT
 * ------------------------------------------------------------ */

.organization-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-7);
}

.sidebar {
    display: grid;
    gap: var(--space-4);
    align-content: start;
}

.sidebar-header {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    background: var(--clr-bg-alt);
    box-shadow: var(--shadow-sm);
}

.sidebar-org {
    display: block;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--clr-fg);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.metrics-grid {
    display: grid;
    gap: var(--space-4);
}

@media (min-width: var(--bp-md)) {
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.analytics-grid {
    display: grid;
    gap: var(--space-4);
}

@media (min-width: var(--bp-md)) {
    .analytics-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.premium-status-grid {
    display: grid;
    gap: var(--space-4);
}

@media (min-width: var(--bp-md)) {
    .premium-status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ------------------------------------------------------------
 * LIST LAYOUTS
 * ------------------------------------------------------------ */

.list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.list-item {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--clr-border);
    background-color: var(--clr-bg-alt);
}

/* ------------------------------------------------------------
 * ADMIN LAYOUT OVERRIDES
 * ------------------------------------------------------------ */

.admin-page {
    background-color: var(--clr-admin-bg);
    color: var(--clr-admin-fg);
}

.admin-card-grid {
    display: grid;
    gap: var(--space-4);
}

@media (min-width: var(--bp-md)) {
    .admin-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ------------------------------------------------------------
 * PREMIUM LAYOUT OVERRIDES
 * ------------------------------------------------------------ */

.premium-page {
    background-color: var(--clr-premium-bg);
    color: var(--clr-premium-fg);
}

.premium-card-grid {
    display: grid;
    gap: var(--space-4);
}

@media (min-width: var(--bp-md)) {
    .premium-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
/* ---------------------------------------------------------
   TOPBAR (Unified)
--------------------------------------------------------- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    background: var(--clr-bg-alt);
    border-bottom: 1px solid var(--clr-border);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-xl);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.topbar-logo {
    display: block;
    height: 48px;
    width: auto;
}

.topbar-product {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-xl);
    background-color: #003A8C;
    color: #ffffff;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
}

/* Logo */
.logo-img {
    height: 40px;
    width: auto;
}

/* Language switcher */
.lang-switcher a {
    color: var(--clr-fg);
    text-decoration: none;
    padding: var(--space-2) var(--space-3);
}

.lang-switcher a.active {
    font-weight: 900;
    text-decoration: underline;
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: -1000px;
    z-index: var(--z-fixed);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--clr-accent);
    color: #ffffff;
    text-decoration: none;
    font-weight: var(--font-weight-semibold);
    box-shadow: var(--shadow-md);
    transition: top var(--transition-normal);
}

.skip-link:focus,
.skip-link:focus-visible {
    top: var(--space-4);
    left: var(--space-4);
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}
/* ============================================================
 * TOPBAR — Clarifyr Premium
 * ============================================================ */

html, body {
    overflow-x: hidden;
}

.topbar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background-color: var(--clr-bg-alt);
    border-bottom: 1px solid var(--clr-border);
    position: relative;
}

/* Center logo */
.topbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Logo wrapper */
.topbar-logo-wrapper {
    background-color: #ffffff;
    border-radius: var(--radius-xl);
    padding: var(--space-2);
}

/* Logo image — groter */
.topbar-logo-img {
    height: 72px;
    width: auto;
    display: block;
}

/* Right side */
.topbar-right {
    position: absolute;
    right: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ============================================================
 * WCAG 2.2 AA LANGUAGE SWITCHER
 * ============================================================ */

.lang-switcher {
    display: flex;
    gap: var(--space-2);
}

.lang-option {
    font-size: var(--font-size-sm);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    color: #1A1A1A; /* donker, AA op licht */
    font-weight: var(--font-weight-medium);
    text-decoration: underline; /* herkenbaar als link */
}

/* Hover state */
.lang-option:hover {
    background-color: var(--clr-primary-soft);
    color: var(--clr-primary);
    text-decoration: underline;
}

/* Focus state (WCAG 2.2 AA) */
.lang-option:focus-visible {
    outline: 3px solid var(--clr-primary);
    outline-offset: 2px;
}

/* Active language (current page) */
.lang-option.active {
    background-color: var(--clr-primary);
    color: #FFFFFF;
    font-weight: var(--font-weight-bold);
    text-decoration: underline; /* extra duidelijk */
}



/* Product pills */
.topbar-products {
    position: absolute;
    left: var(--space-4);
    display: flex;
    gap: var(--space-2);
}

.product-pill {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-lg);
    font-weight: var(--font-weight-semibold);
    color: #ffffff;
}

/* WCAG 2.2 AA colors */
.product-pdf { background-color: #003A8C; }
.product-mob { background-color: #006D75; }
.product-doc { background-color: #0F6B3E; }
.product-web { background-color: #C4471E; }

/* Only PDF visible */
.product-mob,
.product-doc,
.product-web {
    display: none;
}

/* ============================================================
 * PDF PRODUCT PILL — Larger & Balanced
 * ============================================================ */

.product-pdf {
    background-color: #003A8C; /* WCAG AA */
    padding: var(--space-2) var(--space-5); /* breder */
    font-size: var(--font-size-xl); /* groter */
    border-radius: var(--radius-xl); /* premium */
    font-weight: var(--font-weight-bold);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px; /* hoger */
}


/* Portal CTA */
.topbar-right .btn-primary {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
}

/* ============================================================
 * PUBLIC TOPBAR — MOBILE READY
 * ============================================================ */

.topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
}

.topbar-products,
.topbar-center,
.topbar-right,
.topbar-mobile-menu {
    position: static;
}

.topbar-center {
    justify-self: center;
}

.topbar-org-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-xl);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.topbar-org-logo {
    display: block;
    max-height: 56px;
    width: auto;
    max-width: min(220px, 30vw);
    object-fit: contain;
}

.topbar-logo-wrapper {
    padding: var(--space-1) var(--space-2);
}

.topbar-logo-img {
    height: 56px;
}

.topbar-desktop-controls {
    justify-self: end;
}

.topbar-mobile-menu {
    display: none;
    justify-self: end;
}

.topbar-mobile-menu > summary {
    list-style: none;
    min-height: 44px;
}

.topbar-mobile-menu > summary::-webkit-details-marker {
    display: none;
}

.topbar-mobile-panel {
    margin-top: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    background-color: var(--clr-bg-alt);
    box-shadow: var(--shadow-md);
    display: grid;
    gap: var(--space-3);
    min-width: 260px;
}

.topbar-mobile-panel .lang-switcher {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
}

.topbar-mobile-panel .lang-option {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 40px;
    text-decoration: none;
}

.topbar-mobile-panel .btn {
    width: 100%;
}

@media (max-width: 980px) {
    .topbar {
        grid-template-columns: auto 1fr auto;
    }

    .topbar-products .product-pdf {
        min-height: 44px;
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-lg);
    }

    .topbar-logo-img {
        height: 46px;
    }

    .topbar-logo {
        height: 40px;
    }

    .topbar-product {
        min-height: 44px;
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-lg);
    }

    .topbar-org-brand {
        min-height: 56px;
        padding: var(--space-2) var(--space-3);
    }

    .topbar-org-logo {
        max-height: 44px;
        max-width: 160px;
    }

    .topbar-desktop-controls {
        display: none;
    }

    .topbar-mobile-menu {
        display: block;
    }
}

@media (max-width: 640px) {
    .topbar {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo actions"
            "product product";
        row-gap: var(--space-2);
    }

    .topbar-center {
        grid-area: logo;
        justify-self: start;
    }

    .topbar-products {
        grid-area: product;
    }

    .topbar-mobile-menu {
        grid-area: actions;
    }

    .topbar-products .product-pdf {
        width: 100%;
    }

    .topbar-org-brand {
        display: none;
    }
}

/* ============================================================
 * PORTAL TOPBAR — MOBILE LANGUAGE UX
 * ============================================================ */

.topbar-portal {
    justify-content: space-between;
}

.topbar-portal-right {
    gap: var(--space-2);
}

.topbar-portal-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    border: 1px solid #1f1f1f;
    border-radius: var(--radius-lg);
    background: #1f1f1f;
    color: #ffffff;
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.topbar-portal-action:hover {
    background: #111111;
    border-color: #111111;
    color: #ffffff;
}

.topbar-portal-action:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

.portal-language-select {
    min-height: 40px;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 0 var(--space-2);
}

.portal-mobile-menu {
    display: none;
}

.portal-mobile-menu > summary {
    list-style: none;
    min-height: 44px;
}

.portal-mobile-menu > summary::-webkit-details-marker {
    display: none;
}

.portal-mobile-panel {
    margin-top: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    background-color: var(--clr-bg-alt);
    box-shadow: var(--shadow-md);
    display: grid;
    gap: var(--space-3);
    min-width: 240px;
}

.portal-mobile-panel .btn,
.portal-mobile-panel .portal-language-select {
    width: 100%;
}

@media (max-width: 980px) {
    .topbar-portal .desktop-language-selector,
    .topbar-portal .contrast-toggle,
    .topbar-portal .logout-btn {
        display: none;
    }

    .topbar-portal .portal-mobile-menu {
        display: block;
    }
}
