/* ==========================================================================
   Page-Specific Layouts
   Tegel Funnel
   ========================================================================== */

/* --------------------------------
   Shared Page Layout
   -------------------------------- */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page__header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--space-6);
    max-width: var(--container-max);
    margin: 0 auto;
    width: 100%;
}

.header__logo {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    text-decoration: none;
}

.header__logo span {
    color: var(--accent-primary);
}

.header__nav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.header__step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.header__step--active {
    color: var(--text-primary);
}

.header__step-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.header__step--active .header__step-number {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--text-inverse);
}

.header__step--completed .header__step-number {
    background: var(--success);
    border-color: var(--success);
    color: var(--text-primary);
}

.header__step--clickable {
    text-decoration: none;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.header__step--clickable:hover {
    opacity: 0.7;
}

.page__content {
    flex: 1;
    padding: var(--space-12) 0;
}

.page__footer {
    padding: var(--space-8) 0;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.page__footer p {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* --------------------------------
   Page 1: Configurator Layout
   -------------------------------- */

.configurator {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
    align-items: start;
}

.configurator__preview {
    position: sticky;
    top: 100px;
    /* Fallback */
    top: calc(var(--header-height) + var(--space-8));
    height: fit-content;
    /* Critical for sticky to work if child is taller */
    z-index: 5;
}

.configurator__panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

/* Hide empty preview on mobile to avoid confusion */
@media (max-width: 1024px) {
    .configurator__preview--empty {
        display: none;
    }
}

.preview-frame {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-frame::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 12px solid var(--bg-elevated);
    border-radius: var(--radius-xl);
    pointer-events: none;
}

.preview-frame__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-frame__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    color: var(--text-muted);
}

.preview-frame__placeholder svg {
    width: 80px;
    height: 80px;
    opacity: 0.5;
}

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

.section-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

/* --------------------------------
   Page 2: Upsells Layout
   -------------------------------- */

.upsells {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-12);
    align-items: start;
}

.upsells__main {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.upsells__sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-8));
    min-width: 0;
    overflow: hidden;
}

.order-summary {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.order-summary__header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}

.order-summary__title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
}

.order-summary__items {
    padding: var(--space-4);
}

.order-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    min-width: 0;
}

.order-item:hover {
    background: var(--bg-elevated);
}

.order-item__image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
}

.order-item__details {
    flex: 1;
    min-width: 0;
}

.order-item__name {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

.order-item__meta {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-item__price {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--accent-primary);
}

.order-summary__footer {
    padding: var(--space-6);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.order-total__label {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

.order-total__value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--accent-primary);
}

/* Upsell Cards Grid */
.upsell-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-6);
}

.upsell-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.upsell-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.upsell-card--selected {
    border-color: var(--accent-primary);
    border-width: 2px;
    background: linear-gradient(135deg, rgba(31, 61, 43, 0.06) 0%, rgba(31, 61, 43, 0.02) 100%);
    box-shadow: 0 0 0 4px var(--accent-primary-dim), var(--shadow-lg);
    transform: translateY(-4px);
    position: relative;
}

.upsell-card--selected::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: var(--accent-primary);
    color: var(--text-inverse);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: var(--font-bold);
    z-index: 2;
    box-shadow: var(--shadow-md);
    animation: checkPop 0.3s var(--transition-spring);
}

@keyframes checkPop {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.upsell-card--selected:hover {
    transform: translateY(-4px);
}

.upsell-card__image {
    aspect-ratio: 4/3;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.upsell-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upsell-card__body {
    padding: var(--space-5);
}

.upsell-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-3);
}

.upsell-card__name {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.upsell-card__price {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--accent-primary);
}

.upsell-card__desc {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

/* --------------------------------
   Page 3: Checkout Layout
   -------------------------------- */

.checkout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--space-12);
    align-items: start;
}

.checkout__form {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.checkout__summary {
    position: sticky;
    top: calc(var(--header-height) + var(--space-8));
}

.form-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}

.form-section__title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

/* Cart Line Items */
.cart-items {
    display: flex;
    flex-direction: column;
}

.cart-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item__image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
}

.cart-item__details {
    flex: 1;
    min-width: 0;
}

.cart-item__name {
    font-weight: var(--font-medium);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.cart-item__variant {
    font-size: var(--text-sm);
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-item__accessories {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-2);
}

.cart-item__price {
    font-weight: var(--font-semibold);
    color: var(--accent-primary);
    white-space: nowrap;
}

.cart-item__remove {
    color: var(--text-muted);
    padding: var(--space-2);
    transition: color var(--transition-fast);
}

.cart-item__remove:hover {
    color: var(--error);
}

/* Price Breakdown */
.price-breakdown {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    margin-top: var(--space-4);
}

.price-row {
    display: flex;
    justify-content: space-between;
}

.price-row__label {
    color: var(--text-secondary);
}

.price-row__value {
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

.price-row--total {
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}

.price-row--total .price-row__label {
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.price-row--total .price-row__value {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--accent-primary);
}

/* --------------------------------
   Responsive Layouts
   -------------------------------- */

@media (max-width: 1024px) {
    .configurator,
    .upsells,
    .checkout {
        grid-template-columns: 1fr;
    }

    /* Configurator: Preview at top — NOT sticky on mobile */
    .configurator__preview {
        position: static;
        margin-bottom: var(--space-6);
        scroll-margin-top: calc(var(--header-height) + var(--space-4));
    }

    /* Summary Card in Configurator - static on mobile */
    .configurator .card--elevated {
        position: static;
        margin-top: var(--space-8);
        border-radius: var(--radius-xl);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
        background: var(--bg-primary);
        border: 1px solid var(--border-subtle);
    }

    /* Checkout & Upsells: Summary at bottom (default order) */
    .checkout__summary, .upsells__sidebar {
        position: static;
        display: block;
    }

    /* Mobile Sticky CTA Bar - Matches sidebar disappearance at 1024px */
    .mobile-cta-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-subtle);
        padding: var(--space-4) 0;
        z-index: var(--z-sticky);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
        animation: slideUp 0.3s ease-out;
    }

    .mobile-cta-bar__content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-4);
    }

    .mobile-cta-bar__info {
        display: flex;
        flex-direction: column;
    }

    .mobile-cta-bar__label {
        font-size: var(--text-xs);
        color: var(--text-muted);
    }

    .mobile-cta-bar__total {
        font-size: var(--text-lg);
        font-weight: var(--font-bold);
        color: var(--accent-primary);
    }

    .btn--mobile-cta {
        flex: 1;
        justify-content: center;
    }

    .upsells {
        padding-bottom: 80px;
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 var(--space-4);
    }

    .header__nav {
        display: flex;
        gap: var(--space-3);
    }

    .header__step span:not(.header__step-number) {
        display: none;
    }

    .page__content {
        padding: var(--space-8) 0;
    }

    .container {
        padding: 0 var(--space-4);
    }

    .size-selector {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .upsell-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Modern Footer (2026 Style) 
   ========================================================================== */

.footer-modern {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-16) 0 var(--space-8);
    font-family: var(--font-body);
    margin-top: var(--space-12);
}

.footer-modern__grid {
    display: grid;
    grid-template-columns: 1.5fr 2fr;
    gap: var(--space-12);
    margin-bottom: var(--space-12);
}

.footer-modern__brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 360px;
}

.footer-modern__logo {
    height: 48px;
    /* Larger logo */
    width: auto;
    display: block;
    margin-bottom: var(--space-4);
}

.footer-modern__slogan {
    font-size: var(--text-base);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-6);
    font-weight: 400;
}

.footer-modern__trust {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.footer-modern__trust-text {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.footer-modern__nav-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
}

.footer-modern__heading {
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-bottom: var(--space-6);
}

.footer-modern__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-modern__list li {
    margin-bottom: var(--space-3);
}

.footer-modern__list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    transition: color 0.2s ease;
}

.footer-modern__list a:hover {
    color: var(--accent-primary);
}

.footer-modern__divider {
    height: 1px;
    background-color: var(--border-subtle);
    width: 100%;
    margin-bottom: var(--space-8);
}

.footer-modern__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.footer-modern__copyright {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.footer-modern__payment {
    display: flex;
    gap: var(--space-2);
}

.payment-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

@media (max-width: 900px) {
    .footer-modern__grid {
        grid-template-columns: 1fr;
        gap: var(--space-10);
    }

    .footer-modern__nav-group {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-8) var(--space-4);
    }
}

@media (max-width: 600px) {
    .footer-modern__nav-group {
        grid-template-columns: 1fr;
    }

    .footer-modern__bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-modern__nav-group {
        margin-top: var(--space-4);
    }
}

/* ==========================================================================
   Modern Footer (Dark Theme Override)
   ========================================================================== */

.footer-modern {
    background-color: #1f3d2b;
    background-image:
        radial-gradient(circle at center, rgba(31, 61, 43, 0) 0%, rgba(20, 42, 29, 0.5) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 28' width='56' height='28'%3E%3Cpath fill='%23d4b98a' fill-opacity='0.18' d='M56 26v2h-7.75c2.3-1.27 4.94-2 7.75-2zm-26 2a2 2 0 1 0-4 0h-4.09A25.98 25.98 0 0 0 0 16v-2c.67 0 1.34.02 2 .07V14a2 2 0 0 0-2-2v-2a4 4 0 0 1 3.98 3.6 28.09 28.09 0 0 1 2.8-3.86A8 8 0 0 0 0 6V4a9.99 9.99 0 0 1 8.17 4.23c.94-.95 1.96-1.83 3.03-2.63A13.98 13.98 0 0 0 0 0h7.75c2 1.1 3.73 2.63 5.1 4.45 1.12-.72 2.3-1.37 3.53-1.93A20.1 20.1 0 0 0 14.28 0h2.7c.45.56.88 1.14 1.29 1.74 1.3-.48 2.63-.87 4-1.15-.11-.2-.23-.4-.36-.59H26v.07a28.4 28.4 0 0 1 4 0V0h4.09l-.37.59c1.38.28 2.72.67 4.01 1.15.4-.6.84-1.18 1.3-1.74h2.69a20.1 20.1 0 0 0-2.1 2.52c1.23.56 2.41 1.2 3.54 1.93A16.08 16.08 0 0 1 48.25 0H56c-4.58 0-8.65 2.2-11.2 5.6 1.07.8 2.09 1.68 3.03 2.63A9.99 9.99 0 0 1 56 4v2a8 8 0 0 0-6.77 3.74c1.03 1.2 1.97 2.5 2.79 3.86A4 4 0 0 1 56 10v2a2 2 0 0 0-2 2.07 28.4 28.4 0 0 1 2-.07v2c-9.2 0-17.3 4.78-21.91 12H30zM7.75 28H0v-2c2.81 0 5.46.73 7.75 2zM56 20v2c-5.6 0-10.65 2.3-14.28 6h-2.7c4.04-4.89 10.15-8 16.98-8zm-39.03 8h-2.69C10.65 24.3 5.6 22 0 22v-2c6.83 0 12.94 3.11 16.97 8zm15.01-.4a28.09 28.09 0 0 1 2.8-3.86 8 8 0 0 0-13.55 0c1.03 1.2 1.97 2.5 2.79 3.86a4 4 0 0 1 7.96 0zm14.29-11.86c1.3-.48 2.63-.87 4-1.15a25.99 25.99 0 0 0-44.55 0c1.38.28 2.72.67 4.01 1.15a21.98 21.98 0 0 1 36.54 0zm-5.43 2.71c1.13-.72 2.3-1.37 3.54-1.93a19.98 19.98 0 0 0-32.76 0c1.23.56 2.41 1.2 3.54 1.93a15.98 15.98 0 0 1 25.68 0zm-4.67 3.78c.94-.95 1.96-1.83 3.03-2.63a13.98 13.98 0 0 0-22.4 0c1.07.8 2.09 1.68 3.03 2.63a9.99 9.99 0 0 1 16.34 0z'%3E%3C/path%3E%3C/svg%3E");
    border-top: none;
    color: #fff;
    margin-top: 0;
}

.footer-modern__heading {
    color: #fff;
}

.footer-modern__list a {
    color: rgba(255, 255, 255, 0.7);
}

.footer-modern__list a:hover {
    color: #fff;
}

.footer-modern__slogan {
    color: rgba(255, 255, 255, 0.8);
}

.footer-modern__copyright {
    color: rgba(255, 255, 255, 0.5);
}

.footer-modern__divider {
    background-color: rgba(255, 255, 255, 0.1);
}

.payment-badge {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-modern__trust {
    display: none !important;
}

/* Filter for standard logo to make it white */
.footer-modern__logo {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}
