/**
 * Terrassenplaner v2.1 — Compact Single-Screen Calculator
 *
 * Design: cream/off-white bg, dark green + gold accents, serif headings.
 * Uses theme CSS custom properties from style.css.
 *
 * @package Naturholz
 * @version 2.1.0
 */

/* ==========================================================================
   SECTION WRAPPER
   ========================================================================== */

.tp {
    padding: var(--space-2xl) 0 var(--space-4xl);
    background: var(--color-cream);
}

/* ==========================================================================
   INPUT BAR — dimensions + direction + area badge
   ========================================================================== */

.tp-input-bar {
    display: flex;
    align-items: flex-end;
    gap: var(--space-xl);
    padding: var(--space-xl);
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-2xl);
    flex-wrap: wrap;
}

.tp-input-bar__fields {
    display: flex;
    gap: var(--space-lg);
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* --- Fields --- */

.tp-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 130px;
}

.tp-field label {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-charcoal);
    letter-spacing: 0.02em;
}

.tp-field__input {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid var(--color-sand);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tp-field__input:focus-within {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(45, 90, 61, 0.12);
}

.tp-field__input input {
    flex: 1;
    padding: 10px 14px;
    border: none;
    font-size: var(--text-base);
    font-weight: 600;
    background: transparent;
    outline: none;
    width: 80px;
    color: var(--color-charcoal);
}

.tp-field__input input::-webkit-outer-spin-button,
.tp-field__input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.tp-field__input input[type=number] {
    -moz-appearance: textfield;
}

.tp-field__unit {
    padding: 10px 14px;
    background: var(--color-cream);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-warm-gray);
    border-left: 1.5px solid var(--color-sand);
    user-select: none;
}

/* --- Direction toggle --- */

.tp-field--direction {
    min-width: 240px;
}

.tp-direction-toggle {
    display: flex;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1.5px solid var(--color-sand);
}

.tp-dir-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: none;
    background: #fff;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-charcoal);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.tp-dir-btn + .tp-dir-btn {
    border-left: 1.5px solid var(--color-sand);
}

.tp-dir-btn svg {
    flex-shrink: 0;
    color: var(--color-warm-gray);
    transition: color 0.2s;
}

.tp-dir-btn small {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-warm-gray);
    margin-left: auto;
}

.tp-dir-btn:hover {
    background: var(--color-cream);
}

.tp-dir-btn.active {
    background: var(--color-secondary);
    color: #fff;
}

.tp-dir-btn.active svg {
    color: rgba(255, 255, 255, 0.85);
}

.tp-dir-btn.active small {
    color: rgba(255, 255, 255, 0.7);
}

/* --- Area badge --- */

.tp-area-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background: var(--color-secondary);
    border-radius: var(--radius-md);
    min-width: 140px;
    flex-shrink: 0;
}

.tp-area-badge__label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tp-area-badge__value {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

/* ==========================================================================
   SECTION TITLE
   ========================================================================== */

.tp-section-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--color-charcoal);
    margin-bottom: var(--space-lg);
}

/* ==========================================================================
   PRODUCT CARDS — COMPACT HORIZONTAL ROWS
   ========================================================================== */

.tp-products {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: var(--space-2xl);
}

/* Each card is a single horizontal row */
.tp-card {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: center;
    transition: box-shadow 0.2s;
}

.tp-card:hover {
    box-shadow: var(--shadow-md);
}

/* --- Thumbnail: small square on the left --- */

.tp-card__image {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--color-cream-dark);
}

.tp-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tp-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-sand);
}

/* --- Card body: name + dims | lfm | boards | price --- */

.tp-card__body {
    flex: 1;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    min-width: 0;
}

/* Name + dims column */
.tp-card__info {
    flex: 1 1 220px;
    min-width: 0;
}

.tp-card__name {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-charcoal);
    margin: 0 0 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tp-card__dims {
    font-size: var(--text-xs);
    color: var(--color-warm-gray);
}

.tp-card__unit-price {
    font-size: var(--text-xs);
    color: var(--color-secondary);
    font-weight: 600;
    margin-top: 2px;
    display: block;
}

/* --- Calculated results — inline columns --- */

.tp-card__results {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-shrink: 0;
}

.tp-card__stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    text-align: right;
}

.tp-card__stat-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-warm-gray);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.tp-card__stat-value {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--color-charcoal);
    white-space: nowrap;
}

.tp-card__stat--price .tp-card__stat-value {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    color: var(--color-secondary);
}

/* ==========================================================================
   SUBSTRUCTURE SECTION
   ========================================================================== */

.tp-substructure {
    margin-bottom: var(--space-2xl);
}

.tp-substructure__toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: #fff;
    border: 1.5px dashed var(--color-sand);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-charcoal);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.tp-substructure__toggle:hover {
    background: var(--color-cream-dark);
    border-color: var(--color-secondary-light);
}

.tp-substructure__toggle.open {
    border-style: solid;
    border-color: var(--color-secondary);
    background: rgba(45, 90, 61, 0.04);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.tp-substructure__toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-secondary);
    color: #fff;
    flex-shrink: 0;
}

.tp-substructure__toggle.open .tp-substructure__toggle-icon {
    background: var(--color-secondary-dark);
}

.tp-substructure__content {
    background: #fff;
    border: 1.5px solid var(--color-secondary);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: var(--space-lg);
    animation: tpSlideDown 0.3s ease;
}

@keyframes tpSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tp-uk-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.tp-uk-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: var(--space-md);
    background: var(--color-cream);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--color-accent);
}

.tp-uk-item__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--color-secondary);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.tp-uk-item__info {
    flex: 1;
    min-width: 0;
}

.tp-uk-item__info h4 {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-charcoal);
    margin: 0 0 2px;
}

.tp-uk-item__detail {
    font-size: 11px;
    color: var(--color-warm-gray);
    margin: 0;
}

.tp-uk-item__values {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    flex-shrink: 0;
}

.tp-uk-item__qty {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-charcoal);
    white-space: nowrap;
}

.tp-uk-item__lfm {
    font-size: var(--text-xs);
    color: var(--color-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.tp-uk-note {
    margin-top: var(--space-md);
    font-size: var(--text-xs);
    color: var(--color-warm-gray);
    text-align: center;
}

/* ==========================================================================
   CTA — QUOTE BUTTON
   ========================================================================== */

.tp-cta {
    text-align: center;
    padding: var(--space-xl) 0;
}

.tp-cta__button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 48px;
    background: var(--color-accent);
    color: #fff;
    font-family: var(--font-body);
    font-size: var(--text-lg);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-full);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(196, 148, 61, 0.35);
}

.tp-cta__button:hover {
    background: var(--color-accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 148, 61, 0.45);
    color: #fff;
}

.tp-cta__button:active {
    transform: translateY(0);
}

.tp-cta__button svg {
    transition: transform 0.2s;
}

.tp-cta__button:hover svg {
    transform: translateX(4px);
}

.tp-cta__note {
    margin-top: var(--space-md);
    font-size: var(--text-sm);
    color: var(--color-warm-gray);
}

/* ==========================================================================
   INFO SECTION
   ========================================================================== */

.planner-info {
    padding: var(--space-2xl) 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
}

.info-box {
    text-align: center;
    padding: var(--space-xl);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.info-box__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--color-cream);
    color: var(--color-primary);
    border-radius: 50%;
    margin-bottom: var(--space-md);
}

.info-box__icon svg {
    width: 28px;
    height: 28px;
}

.info-box h4 {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    margin-bottom: var(--space-sm);
}

.info-box p {
    font-size: var(--text-sm);
    color: var(--color-warm-gray);
    margin: 0;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 900px) {
    .tp-input-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .tp-input-bar__fields {
        flex-direction: column;
    }

    .tp-field {
        min-width: 100%;
    }

    .tp-area-badge {
        flex-direction: row;
        gap: var(--space-md);
        justify-content: space-between;
    }

    .tp-uk-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .tp-card__body {
        gap: 16px;
    }

    .tp-card__results {
        gap: 16px;
    }
}

@media (max-width: 700px) {
    .tp-card {
        flex-direction: column;
    }

    .tp-card__image {
        width: 100%;
        height: 140px;
    }

    .tp-card__body {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .tp-card__results {
        width: 100%;
        justify-content: space-between;
        padding-top: 12px;
        border-top: 1px solid var(--color-cream-dark);
    }

    .tp-card__stat {
        align-items: flex-start;
        text-align: left;
    }
}

@media (max-width: 600px) {
    .tp-direction-toggle {
        flex-direction: column;
    }

    .tp-dir-btn + .tp-dir-btn {
        border-left: none;
        border-top: 1.5px solid var(--color-sand);
    }

    .tp-cta__button {
        width: 100%;
        justify-content: center;
        padding: 16px 24px;
    }
}

@media print {
    .tp-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}