/* ============================================
   DAXBERGER TINY HOUSE KONFIGURATOR
   Integrated version for daxberger-website
   Variables come from variables.css, reset from reset.css
   ============================================ */

/* --- Konfigurator-specific variables --- */
.konfigurator {
    /* Navbar height (fixed navbar from navbar-improved.css) */
    --header-height: 87px;
    --preview-width: 55%;
    --options-width: 45%;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --transition: 0.25s ease;

    /* Accent shortcuts (from variables.css --accent-primary) */
    --accent: #f39c12;
    --accent-hover: #e67e22;
    --accent-light: #f9ca24;
    --accent-bg: #fef9ed;
    --accent-bg-strong: #fdf2d5;

    /* Gray shortcuts */
    --gray-900: #2c3e50;
    --gray-800: #34495e;
    --gray-700: #4a5568;
    --gray-600: #555555;
    --gray-500: #7f8c8d;
    --gray-400: #95a5a6;
    --gray-300: #bdc3c7;
    --gray-200: #dfe6e9;
    --gray-100: #ecf0f1;
    --gray-50: #f7f9fa;
    --white: #ffffff;

    /* Metall-Theme shortcuts */
    --metal-black: #2c3e50;
    --metal-orange: #f39c12;
    --metal-orange-dark: #e67e22;

    /* Holz shortcuts */
    --wood-medium: #B8956A;
    --wood-white: #FAF8F5;

    /* Typography */
    --font-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */

.konfigurator {
    font-family: var(--font-body);
    color: var(--gray-900);
}

.konfigurator-main {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
    padding-top: var(--header-height);
}

/* ============================================
   LEFT: PREVIEW
   ============================================ */

.konfigurator-preview {
    width: var(--preview-width);
    background: var(--gray-100);
    border-right: 1px solid var(--gray-200);
}

.preview-sticky {
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

/* View Toggle Tabs */
.preview-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 4px;
    box-shadow: var(--shadow-sm);
}

.preview-tab {
    flex: 1;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-600);
    border-radius: calc(var(--border-radius) - 2px);
    transition: all var(--transition);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.preview-tab.active {
    background: var(--metal-black);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.preview-tab:hover:not(.active) {
    color: var(--gray-900);
    background: var(--gray-100);
}

/* Image Container */
.preview-image-wrap {
    flex: 1;
    position: relative;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    background: var(--white);
    box-shadow: var(--shadow-lg);
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.preview-image.loading {
    opacity: 0.4;
    transform: scale(1.02);
}

.preview-image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.preview-image-overlay.visible {
    opacity: 1;
}

.preview-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--metal-orange);
    border-radius: 50%;
    animation: konfig-spin 0.8s linear infinite;
}

@keyframes konfig-spin {
    to { transform: rotate(360deg); }
}

/* Info Bar */
.preview-info {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.preview-info__item {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.preview-info__label {
    font-size: 0.85rem;
    color: var(--gray-600);
    font-weight: 600;
}

.preview-info__value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* Mobile Price */
.preview-price-mobile {
    display: none;
}

/* ============================================
   RIGHT: OPTIONS PANEL
   ============================================ */

.konfigurator-options {
    width: var(--options-width);
    overflow-y: auto;
    height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
    padding: 0;
}

/* Option Group (Accordion) */
.option-group {
    border-bottom: 1px solid var(--gray-200);
}

.option-group__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
}

.option-group__header:hover {
    background: var(--gray-50);
}

.option-group__number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--metal-black);
    color: var(--accent);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-group__title {
    flex: 1;
}

.option-group__title h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--metal-black);
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.option-group__selected {
    font-size: 0.85rem;
    color: var(--gray-700);
    margin-top: 2px;
    font-weight: 600;
}

.option-group__chevron {
    width: 20px;
    height: 20px;
    color: var(--gray-600);
    transition: transform var(--transition);
    flex-shrink: 0;
}

.option-group__content.open ~ .option-group__header .option-group__chevron,
.option-group__header.active .option-group__chevron {
    transform: rotate(180deg);
}

/* Content Area */
.option-group__content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    padding: 0 1.5rem;
}

.option-group__content.open {
    max-height: 800px;
    padding: 0 1.5rem 1.5rem;
}

/* ============================================
   MODEL CARDS
   ============================================ */

.konfigurator .model-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.konfigurator .model-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--white);
    /* Reset any styles from tiny-house.html inline styles */
    box-shadow: none;
    overflow: visible;
}

.konfigurator .model-card:hover {
    border-color: var(--wood-medium);
    background: var(--wood-white);
    transform: none;
}

.konfigurator .model-card.selected {
    border-color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 0 0 1px var(--accent);
}

.model-card__image {
    width: 80px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.model-card__info {
    flex: 1;
}

.model-card__name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-900);
}

.model-card__size {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 2px;
}

.model-card__price {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-900);
    white-space: nowrap;
}

.model-card__check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
}

.konfigurator .model-card.selected .model-card__check {
    background: var(--accent);
    border-color: var(--accent);
}

.konfigurator .model-card.selected .model-card__check::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--white);
    border-radius: 50%;
}

/* ============================================
   SWATCH GRID (for Facade, Walls, Kitchen, Door, Windows)
   ============================================ */

.swatch-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.swatch-card {
    position: relative;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--white);
}

.swatch-card:hover {
    border-color: var(--wood-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.swatch-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}

.swatch-card__image {
    width: 100%;
    height: 90px;
    object-fit: cover;
}

.swatch-card__info {
    padding: 0.6rem 0.75rem;
}

.swatch-card__name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.3;
}

.swatch-card__price {
    font-size: 0.8rem;
    color: var(--gray-700);
    font-weight: 700;
    margin-top: 2px;
}

.swatch-card__desc {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 1px;
    line-height: 1.3;
}

.swatch-card.selected .swatch-card__name {
    color: var(--gray-900);
}

/* Selected indicator */
.swatch-card__check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0;
    transform: scale(0.5);
    transition: all var(--transition);
}

.swatch-card.selected .swatch-card__check {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   OPTION LIST (fallback text-only style)
   ============================================ */

.option-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--white);
}

.option-item:hover {
    border-color: var(--wood-medium);
    background: var(--wood-white);
}

.option-item.selected {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.option-item__radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-500);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
}

.option-item.selected .option-item__radio {
    border-color: var(--accent);
    background: var(--accent);
}

.option-item.selected .option-item__radio::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--white);
    border-radius: 50%;
}

.option-item__name {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-900);
}

.option-item__desc {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-top: 2px;
}

.option-item__price {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-800);
    white-space: nowrap;
}

/* ============================================
   SUMMARY & CTA
   ============================================ */

.konfigurator-summary {
    padding: 1.5rem;
    border-top: 2px solid var(--gray-200);
    background: var(--white);
}

.summary-price {
    text-align: center;
    margin-bottom: 1.25rem;
    padding: 1.25rem;
    background: var(--metal-black);
    border-radius: var(--border-radius-lg);
    border: none;
}

.summary-price__label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-400);
    font-weight: 700;
}

.summary-price__amount {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.3;
}

.summary-price__note {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: 2px;
}

.summary-details {
    margin-bottom: 1.25rem;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

.summary-line:last-child {
    border-bottom: none;
}

.summary-line__label {
    color: var(--gray-600);
}

.summary-line__value {
    font-weight: 700;
    color: var(--gray-900);
}

.summary-line__price {
    font-weight: 700;
    color: var(--gray-800);
    min-width: 70px;
    text-align: right;
}

/* CTA Buttons */
.konfigurator .cta-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: var(--border-radius);
    transition: all var(--transition);
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--white);
    border: none;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
    cursor: pointer;
}

.konfigurator .cta-button:hover {
    background: linear-gradient(135deg, var(--accent-hover), #d35400);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

.konfigurator .cta-button--secondary {
    background: var(--white);
    color: var(--metal-black);
    border: 2px solid var(--metal-black);
    box-shadow: none;
}

.konfigurator .cta-button--secondary:hover {
    background: var(--metal-black);
    color: var(--white);
    border-color: var(--metal-black);
    box-shadow: none;
}

/* ============================================
   KONFIGURATOR HEADER (Price Badge in Navbar area)
   ============================================ */

.konfigurator-header-price {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1031;
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding-right: 280px; /* Space for navbar actions */
}

.konfigurator-header__price-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 0.5rem 1rem;
    background: var(--accent-bg-strong);
    border-radius: var(--border-radius);
    border: 1px solid var(--accent);
}

.price-badge__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-700);
    font-weight: 700;
}

.price-badge__amount {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--metal-black);
    line-height: 1.2;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.konfigurator .modal {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s;
    position: relative;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-800);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
}

.modal__close:hover {
    background: var(--gray-300);
    color: var(--gray-900);
}

.modal__title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.modal__subtitle {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

.modal__config-summary {
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.modal__config-line {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
}

.modal__config-total {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0 0;
    margin-top: 0.6rem;
    border-top: 2px solid var(--gray-300);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-900);
}

/* Form */
.modal__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.konfigurator .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.konfigurator .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.4rem;
}

.konfigurator .form-group input[type="text"],
.konfigurator .form-group input[type="email"],
.konfigurator .form-group input[type="tel"],
.konfigurator .form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color var(--transition);
    background: var(--white);
}

.konfigurator .form-group input:focus,
.konfigurator .form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.15);
}

.konfigurator .form-group textarea {
    resize: vertical;
}

.form-group--checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
}

.form-group--checkbox input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent);
}

.form-group--checkbox a {
    color: var(--metal-orange);
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 1200px) {
    .konfigurator {
        --preview-width: 50%;
        --options-width: 50%;
    }

    .konfigurator-header-price {
        display: none;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .konfigurator-header-price {
        display: none;
    }

    .konfigurator-main {
        flex-direction: column;
        padding-top: var(--header-height);
    }

    .konfigurator-preview {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }

    .preview-sticky {
        position: relative;
        top: 0;
        height: auto;
        padding: 1rem;
    }

    .preview-image-wrap {
        height: 280px;
        flex: none;
    }

    .preview-price-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 0.75rem;
        padding: 0.75rem 1rem;
        background: var(--metal-black);
        border-radius: var(--border-radius);
        border: none;
    }

    .preview-price-mobile__label {
        font-size: 0.8rem;
        font-weight: 700;
        color: var(--gray-400);
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .preview-price-mobile__amount {
        font-family: var(--font-heading);
        font-size: 1.3rem;
        font-weight: 800;
        color: var(--accent);
    }

    .konfigurator-options {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        overflow-y: visible;
    }

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

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

@media (max-width: 480px) {
    .preview-image-wrap {
        height: 220px;
    }

    .preview-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .swatch-card__image {
        height: 70px;
    }

    .option-group__header {
        padding: 1rem;
    }

    .option-group__content.open {
        padding: 0 1rem 1rem;
    }
}
