/* ============================================================
   Van Werven Portal — Auth Page Styles
   Brand colors: see .planning/style/colorcodes.md
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Titillium+Web:ital,wght@0,300;0,400;0,600;0,700;1,400&display=swap');

/* ------------------------------------------------------------
   CSS Custom Properties
   ------------------------------------------------------------ */
:root {
    --vw-green:        #82bf5a;
    --vw-green-hover:  #68a640;
    --vw-yellow:       #f6df00;
    --vw-text:         #786e65;
    --vw-heading:      #303030;
    --vw-white:        #ffffff;
    --vw-bg-light:     #f5f5f5;
    --vw-border:       #d5d5d5;
    --vw-error:        #922b21;
    --vw-error-bg:     #fdedec;
    --vw-error-border: #f5b7b1;
    --font-primary:    "Titillium Web", "Helvetica Neue", Helvetica, Arial, sans-serif;

    --bs-primary: var(--vw-green);
    --bs-primary-rgb: 130, 191, 90;
    --bs-secondary: #786e65;
    --bs-secondary-rgb: 120, 110, 101;
    --bs-link-color: var(--vw-green);
    --bs-link-hover-color: var(--vw-green-hover);
    --bs-body-color: var(--vw-text);
    --bs-body-bg: var(--vw-bg-light);
    --bs-body-font-family: var(--font-primary);
}

/* ------------------------------------------------------------
   Reset & Base
   ------------------------------------------------------------ */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: var(--font-primary);
    color: var(--vw-text);
    -webkit-font-smoothing: antialiased;
}

.portal-body,
.login-body {
    background: var(--vw-bg-light);
}

.btn-primary {
    --bs-btn-bg: var(--vw-green);
    --bs-btn-border-color: var(--vw-green);
    --bs-btn-hover-bg: var(--vw-green-hover);
    --bs-btn-hover-border-color: var(--vw-green-hover);
    --bs-btn-active-bg: var(--vw-green-hover);
    --bs-btn-active-border-color: var(--vw-green-hover);
    --bs-btn-focus-shadow-rgb: 130, 191, 90;
}

.btn-outline-primary {
    --bs-btn-color: var(--vw-green);
    --bs-btn-border-color: var(--vw-green);
    --bs-btn-hover-bg: var(--vw-green);
    --bs-btn-hover-border-color: var(--vw-green);
    --bs-btn-active-bg: var(--vw-green-hover);
    --bs-btn-active-border-color: var(--vw-green-hover);
    --bs-btn-focus-shadow-rgb: 130, 191, 90;
}

.btn-outline-vw-yellow {
    --bs-btn-color: var(--vw-heading);
    --bs-btn-border-color: var(--vw-yellow);
    --bs-btn-hover-bg: var(--vw-yellow);
    --bs-btn-hover-border-color: var(--vw-yellow);
    --bs-btn-hover-color: var(--vw-heading);
    --bs-btn-active-bg: var(--vw-yellow);
    --bs-btn-active-border-color: var(--vw-yellow);
    --bs-btn-active-color: var(--vw-heading);
    --bs-btn-focus-shadow-rgb: 246, 223, 0;
}

.form-control,
.form-select {
    background-color: var(--vw-white);
}

.form-control:focus,
.form-check-input:focus {
    border-color: var(--vw-green);
    box-shadow: 0 0 0 0.25rem rgba(130, 191, 90, 0.2);
}

/* ------------------------------------------------------------
   Full-screen background
   ------------------------------------------------------------ */
.login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Fallback gradient when no background image is set */
    background: linear-gradient(135deg, #303030 0%, #4a6b2a 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

/* Slideshow slides — absolutely stacked, crossfade via JS */
.login-slides {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.login-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}

.login-slide.active {
    opacity: 1;
}

/* Dark overlay — always present, ensures readability over any image */
.login-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1;
}

/* ------------------------------------------------------------
   Wrapper — centers logo + card vertically
   ------------------------------------------------------------ */
.login-wrapper {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 460px;
    padding: 2.5rem 1.5rem;
}

/* ------------------------------------------------------------
   Logo
   ------------------------------------------------------------ */
.login-logo-wrap {
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-logo {
    max-width: 180px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* ------------------------------------------------------------
   Tagline
   ------------------------------------------------------------ */
.login-tagline {
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.975rem;
    font-weight: 300;
    text-align: center;
    margin: 0 0 1.25rem 0;
    letter-spacing: 0.03em;
}

/* ------------------------------------------------------------
   Card
   ------------------------------------------------------------ */
.login-card {
    background: var(--vw-white);
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
    width: 100%;
}

.login-card h1,
.login-card h2 {
    color: var(--vw-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
    line-height: 1.2;
}

/* ------------------------------------------------------------
   Form elements
   ------------------------------------------------------------ */
.login-card .form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--vw-heading);
}

/* 48px controls — WCAG/Apple/Material touch-target minimum is 44-48px;
   font stays ≥16px so iOS Safari does not zoom on focus */
.login-card .form-control,
.login-card .form-select {
    min-height: 3rem;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
}

.login-card .btn {
    min-height: 3rem;
    padding: 0.625rem 1rem;
    font-size: 1.0625rem;
    font-weight: 600;
}

/* Show/hide password toggle — styled as part of the input, not a standalone button */
.login-card .password-toggle {
    --bs-btn-color: var(--vw-text);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-color: var(--vw-heading);
    --bs-btn-hover-bg: var(--vw-bg-light);
    --bs-btn-hover-border-color: var(--bs-border-color);
    --bs-btn-active-color: var(--vw-heading);
    --bs-btn-active-bg: var(--vw-bg-light);
    --bs-btn-active-border-color: var(--bs-border-color);
    min-width: 3rem;
    font-size: 1.125rem;
}

.login-card .form-check-input {
    width: 1.25em;
    height: 1.25em;
    margin-top: 0.125em;
}

.login-card .form-check-label {
    padding-left: 0.25rem;
}

/* ------------------------------------------------------------
   Links
   ------------------------------------------------------------ */
.login-link {
    display: block;
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.75rem; /* enlarges tap target to ~44px without visual change */
    font-size: 0.9375rem;
    color: var(--vw-green);
    text-decoration: none;
    transition: color 0.15s ease;
}

.portal-logo {
    max-height: 40px;
    width: auto;
}

.portal-sidebar .nav-link {
    color: var(--vw-heading);
    font-weight: 600;
}

.portal-sidebar .nav-link:hover,
.portal-sidebar .nav-link:focus {
    color: var(--vw-green-hover);
    background: #edf6e6;
}

.portal-sidebar .nav-link.active {
    color: var(--vw-white);
    background: var(--vw-green);
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--vw-green);
}

.login-link:hover {
    color: var(--vw-green-hover);
    text-decoration: underline;
}

/* ------------------------------------------------------------
   Alert messages
   ------------------------------------------------------------ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.alert-info {
    background: #e8f4fd;
    border: 1px solid #b8d9f5;
    color: #1a5276;
}

.alert-success {
    background: #eafaf1;
    border: 1px solid #a9dfbf;
    color: #1e8449;
}

.alert-warning {
    background: #fef9e7;
    border: 1px solid #f9e79f;
    color: #7d6608;
}

.validation-summary-valid {
    display: none;
}

.field-validation-error {
    display: block;
    font-size: 0.8rem;
    color: var(--vw-error);
    margin-top: 0.25rem;
}

.field-validation-valid {
    display: none;
}

input.input-validation-error {
    border-color: var(--vw-error-border);
}

/* ------------------------------------------------------------
   Language switcher — fixed top-right
   ------------------------------------------------------------ */
.login-lang {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

/* ------------------------------------------------------------
   T&C page — wider card variant
   ------------------------------------------------------------ */
.login-wrapper.login-wrapper--wide {
    max-width: 680px;
}

@media (min-width: 576px) and (max-width: 991px) {
    .login-wrapper.login-wrapper--wide {
        max-width: 780px;
    }
}

@media (min-width: 992px) {
    .login-wrapper.login-wrapper--wide {
        max-width: 900px;
    }
}

@media (max-width: 575px) {
    .login-wrapper.login-wrapper--wide {
        max-width: 100%;
    }
}

/* ------------------------------------------------------------
   T&C specific styles
   ------------------------------------------------------------ */
.terms-version {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--vw-text);
    margin-bottom: 0.75rem;
}

.terms-body {
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid var(--vw-border);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--vw-text);
    background: var(--vw-bg-light);
}

@media (min-height: 700px) {
    .terms-body {
        max-height: 420px;
    }
}

/* Accept button — yellow until scrolled to bottom, green once unlocked */
.terms-accept-btn {
    background-color: var(--vw-green);
    border-color: var(--vw-green);
    color: #ffffff;
}

.terms-accept-btn:hover:not(:disabled),
.terms-accept-btn:focus:not(:disabled) {
    background-color: var(--vw-green-hover);
    border-color: var(--vw-green-hover);
    color: #ffffff;
}

.terms-accept-btn:disabled {
    background-color: var(--vw-yellow);
    border-color: var(--vw-yellow);
    color: var(--vw-heading);
    opacity: 1;
    cursor: not-allowed;
    pointer-events: none;
}

.terms-scroll-hint {
    font-size: 0.8rem;
    color: var(--vw-text);
    opacity: 0.7;
    text-align: center;
    margin-bottom: 0.5rem;
    transition: opacity 0.3s;
}

.terms-scroll-hint.d-none {
    display: none !important;
}

.terms-body::-webkit-scrollbar {
    width: 6px;
}

.terms-body::-webkit-scrollbar-track {
    background: var(--vw-bg-light);
}

.terms-body::-webkit-scrollbar-thumb {
    background: var(--vw-border);
    border-radius: 3px;
}

.terms-download {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    color: var(--vw-green);
    text-decoration: none;
    transition: color 0.15s ease;
}

.terms-download:hover {
    color: var(--vw-green-hover);
    text-decoration: underline;
}

/* ------------------------------------------------------------
   Admin page — Terms table
   ------------------------------------------------------------ */
.terms-admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.terms-admin-table th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    border-bottom: 2px solid var(--vw-border);
    font-weight: 600;
    color: var(--vw-heading);
    white-space: nowrap;
}

.terms-admin-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--vw-bg-light);
    vertical-align: middle;
}

.terms-admin-table tr:last-child td {
    border-bottom: none;
}

.badge-active {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--vw-green);
    color: var(--vw-white);
}

.badge-draft {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--vw-border);
    color: var(--vw-heading);
}

/* ------------------------------------------------------------
   Responsive breakpoints
   ------------------------------------------------------------ */

/* Tablet: 576px–991px */
@media (min-width: 576px) and (max-width: 991px) {
    .login-wrapper {
        max-width: 510px;
    }
}

/* Desktop: ≥992px */
@media (min-width: 992px) {
    .login-wrapper {
        max-width: 460px;
    }

    .login-card {
        border-radius: 12px;
    }
}

/* Mobile: <576px */
@media (max-width: 575px) {
    .login-bg {
        align-items: flex-start;
    }

    .login-wrapper {
        max-width: 100%;
        padding: 2rem 0 0 0;
        min-height: 100vh;
    }

    .login-logo {
        max-width: 140px;
    }

    .login-card {
        border-radius: 0;
        min-height: calc(100vh - 160px);
    }
}

/* ------------------------------------------------------------
   Webshop Wizard (PRD-09)
   ------------------------------------------------------------ */
.vw-webshop-progress {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vw-webshop-progress-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    color: var(--vw-text);
}

.vw-webshop-progress-badge {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    border: 1px solid var(--vw-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    font-weight: 600;
    flex: 0 0 auto;
}

.vw-webshop-progress-label {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vw-webshop-progress-item.is-active .vw-webshop-progress-badge {
    background: var(--vw-green);
    border-color: var(--vw-green);
    color: #fff;
}

.vw-webshop-progress-item.is-active .vw-webshop-progress-label {
    color: var(--vw-heading);
    font-weight: 600;
}

.vw-webshop-progress-form {
    margin: 0;
}

.vw-webshop-progress-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 0;
    padding: 0;
    color: inherit;
    cursor: pointer;
    text-align: left;
    width: 100%;
    min-width: 0;
}

.vw-webshop-progress-button:hover:not(:disabled) .vw-webshop-progress-badge,
.vw-webshop-progress-button:focus-visible:not(:disabled) .vw-webshop-progress-badge {
    border-color: var(--vw-green);
    color: var(--vw-green);
}

.vw-webshop-progress-button:disabled {
    cursor: default;
}

.vw-webshop-progress-item.is-unreachable .vw-webshop-progress-button {
    cursor: not-allowed;
    opacity: 0.55;
}

.vw-webshop-progress-button--done .vw-webshop-progress-badge {
    background: #eafaf1;
    border-color: var(--vw-green);
    color: var(--vw-green);
}

.vw-webshop-card {
    border: 1px solid var(--vw-border);
    border-radius: 0.75rem;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.vw-webshop-card:hover,
.vw-webshop-card:focus-visible {
    border-color: var(--vw-green);
    box-shadow: 0 0 0 0.2rem rgba(130, 191, 90, 0.2);
    transform: translateY(-2px);
}

/* Selected state for radio-card grids (skip return/exchange step 1). The label IS the
   .vw-webshop-card and the radio is a child, so :has(:checked) gives instant feedback on
   click; the server-rendered .vw-webshop-card--selected class covers the no-JS / reload path. */
.vw-webshop-card--selected,
.vw-webshop-card:has(input[type="radio"]:checked) {
    border-color: var(--vw-green);
    box-shadow: 0 0 0 0.2rem rgba(130, 191, 90, 0.35);
}

.vw-webshop-card-image-wrap {
    aspect-ratio: 16 / 9;
    background: #f3f6ef;
    border-bottom: 1px solid var(--vw-border);
}

.vw-webshop-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vw-webshop-card-info {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--vw-green, #82bf5a);
    color: #fff;
    font-size: 0.95rem;
    line-height: 1;
    cursor: help;
}

.vw-webshop-card-info:hover,
.vw-webshop-card-info:focus-visible {
    outline: none;
    background: var(--vw-green-hover, #68a640);
}

.vw-webshop-card-disabled {
    opacity: 0.55;
    filter: grayscale(70%);
    cursor: not-allowed;
    pointer-events: none;
}

.vw-webshop-card-disabled:hover,
.vw-webshop-card-disabled:focus-visible {
    border-color: var(--vw-border);
    box-shadow: none;
    transform: none;
}

.vw-webshop-variant-col > [data-bs-toggle="tooltip"] {
    pointer-events: auto;
    cursor: not-allowed;
}

/* Compact tile modifier — opt-in via the modifier class; never re-themes the base
   .vw-webshop-card globally. Used by the variant grid (step 2) so all five tiles fit on
   one row at lg+. */
.vw-webshop-card.vw-webshop-card-compact .vw-webshop-card-image-wrap {
    aspect-ratio: 1 / 1;
}

.vw-webshop-card.vw-webshop-card-compact .card-body {
    padding: 0.5rem;
}

.vw-webshop-card.vw-webshop-card-compact .vw-webshop-card-description {
    display: none;
}

/* Step 4 photo control — thumbnail strip with overlay × delete button. */
.vw-webshop-photo-thumb {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--vw-border);
    background: #f3f6ef;
}

.vw-webshop-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vw-webshop-photo-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    padding: 0 0.4rem;
    line-height: 1.2;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--vw-border);
}

@media (min-width: 768px) {
    .vw-webshop-progress {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 360px) {
    .vw-webshop-progress-label {
        font-size: 0.82rem;
    }

    .vw-webshop-card .card-body {
        padding: 0.85rem;
    }
}

/* Skip overview module — project list and skip detail (PRD-10 #65) */
.vw-skip-project-card {
    border: 1px solid var(--vw-border);
    border-radius: 0.75rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.vw-skip-project-card:hover,
.vw-skip-project-card:focus-visible {
    border-color: var(--vw-green);
    box-shadow: 0 0 0 0.2rem rgba(130, 191, 90, 0.2);
    transform: translateY(-2px);
    outline: none;
}

.vw-skip-card {
    border: 1px solid var(--vw-border);
    border-radius: 0.75rem;
}

.vw-skip-card--highlighted {
    border-color: var(--vw-green);
    box-shadow: 0 0 0 0.2rem rgba(130, 191, 90, 0.25);
}

.vw-skip-card__image {
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #f3f6ef;
    border-bottom: 1px solid var(--vw-border);
}

/* ------------------------------------------------------------
   Navigation icons (sidebar + mobile slide-up menu)
   ------------------------------------------------------------ */
.portal-nav-icon {
    flex: 0 0 1.25rem;
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
    line-height: 1;
}

/* ------------------------------------------------------------
   Mobile bottom navigation bar + slide-up menu (PRD: mobile UX)
   Visible below the Bootstrap lg breakpoint; the desktop sidebar
   takes over at >=992px.
   ------------------------------------------------------------ */
.portal-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    align-items: stretch;
    background: var(--vw-white);
    border-top: 1px solid var(--vw-border);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    /* Respect iOS home-indicator safe area */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.portal-bottom-nav__item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 56px;
    padding: 0.4rem 0.5rem;
    background: transparent;
    border: 0;
    color: var(--vw-heading);
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.portal-bottom-nav__item .bi {
    font-size: 1.35rem;
    line-height: 1;
}

.portal-bottom-nav__item:hover,
.portal-bottom-nav__item:focus-visible {
    color: var(--vw-green-hover);
    background: #edf6e6;
    outline: none;
}

.portal-bottom-nav__item:active {
    color: var(--vw-green);
}

/* Slide-up menu panel — taller than the Bootstrap default so the
   full nav tree fits, capped so the page stays peeking behind it. */
.portal-mobile-menu.offcanvas-bottom {
    height: auto;
    max-height: 85vh;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
}

.portal-mobile-menu .offcanvas-body {
    overflow-y: auto;
}

/* Keep page content clear of the fixed bottom bar on mobile so
   submit buttons / last cards are never hidden behind it.
   !important is required: the layout also puts Bootstrap's `p-3`
   on the same element, and its `padding: 1rem !important` would
   otherwise override this padding-bottom. */
@media (max-width: 991.98px) {
    .portal-main--has-bottom-nav {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0) + 1rem) !important;
    }
}

/* ------------------------------------------------------------
   Current user button — initials avatar in the header
   ------------------------------------------------------------ */
.portal-user-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--vw-green);
    color: var(--vw-white);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
}

