/* Explain: Styles for UI components including the kitchen calculator and 3D preview. */
.site-header {
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--background-color) 88%, transparent),
        color-mix(in srgb, var(--background-color) 58%, transparent)
    );
    backdrop-filter: blur(18px);
}

.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--sage-dark);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.section-kicker::before {
    display: inline-block;
    width: 2.4rem;
    height: 1px;
    background: var(--accent-color);
    content: "";
}

.glass-panel {
    border: 1px solid var(--glass-border);
    background: linear-gradient(
        145deg,
        color-mix(in srgb, var(--background-color) 82%, transparent),
        color-mix(in srgb, var(--surface-color) 58%, transparent)
    );
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.arch-frame {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: var(--surface-color);
    box-shadow: var(--shadow-soft);
}

.arch-frame::after {
    position: absolute;
    inset: 1.1rem;
    border: 1px solid color-mix(in srgb, var(--background-color) 64%, transparent);
    border-radius: inherit;
    content: "";
    pointer-events: none;
}

.arch-frame-large {
    height: min(74vh, 720px);
    min-height: 500px;
    border-radius: 999px 999px 2.5rem 2.5rem;
}

.arch-frame-medium {
    height: 620px;
    max-width: 450px;
    border-radius: 999px 999px 2.1rem 2.1rem;
}

.floating-metric {
    position: absolute;
    right: -1rem;
    bottom: 3rem;
    display: flex;
    max-width: 270px;
    align-items: center;
    gap: 0.9rem;
    border-radius: 1.5rem;
    padding: 1rem 1.2rem;
}

.process-card,
.service-card {
    height: 100%;
    border: 1px solid var(--glass-border);
    border-radius: 1.8rem;
    background: color-mix(in srgb, var(--background-color) 66%, transparent);
    padding: 1.5rem;
    transition: transform 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.process-card:hover,
.service-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-soft);
    transform: translateY(-5px);
}

.process-number {
    display: inline-flex;
    width: 2.8rem;
    height: 2.8rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--sage-soft);
    color: var(--sage-dark);
    font-weight: 700;
}

.service-icon {
    display: inline-flex;
    width: 3rem;
    height: 3rem;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: var(--sage-soft);
    color: var(--accent-color);
}

.service-image-wrap {
    height: 660px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: 3rem 999px 999px 3rem;
    box-shadow: var(--shadow-soft);
}

.tool-shell {
    border: 1px solid var(--glass-border);
    border-radius: 2.4rem;
    background: color-mix(in srgb, var(--background-color) 88%, transparent);
    padding: clamp(1.3rem, 3vw, 2.2rem);
    box-shadow: var(--shadow-soft);
}

.form-label {
    display: block;
    margin-bottom: 0.55rem;
    color: var(--text-color);
    font-size: 0.78rem;
    font-weight: 700;
}

.unit-front-control {
    display: grid;
    gap: 0.7rem;
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    background: var(--field-bg);
    padding: 0.9rem;
}

.unit-front-control[hidden] {
    display: none;
}

.unit-title {
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 700;
}

.unit-field {
    display: grid;
    gap: 0.35rem;
}

.unit-field[hidden] {
    display: none;
}

.unit-field-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.unit-light-toggle {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-color);
    font-size: 0.82rem;
    cursor: pointer;
}

.preview-stage {
    position: relative;
    min-height: 500px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: 2rem;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface-color) 86%, transparent), var(--background-color));
}

.reference-image {
    display: block;
    width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: .75rem;
    background: var(--background-color);
}

.reference-image[hidden], .reference-controls [hidden] {
    display: none;
}


.reference-panel {
    min-width: 0;
}

.reference-controls {
    display: grid;
    gap: .65rem;
    padding: 1rem;
}

#reference-upload {
    scroll-margin-top: 7rem;
}

.reference-upload-icon {
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1.1rem;
    background: color-mix(in srgb, var(--accent-color) 16%, var(--field-bg));
    color: var(--accent-color);
}

.reference-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.reference-actions input {
    flex: 1 1 12rem;
    min-width: 0;
    padding: .5rem .75rem;
    border: 1px solid var(--glass-border);
    border-radius: .75rem;
    background: var(--field-bg);
}

.preview-canvas-host {
    width: 100%;
    min-height: 500px;
}

.kitchen-preview-canvas {
    display: block;
    width: 100%;
    min-height: 500px;
    cursor: grab;
    touch-action: none;
}

.kitchen-preview-canvas:active {
    cursor: grabbing;
}

.preview-toolbar {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 2;
    display: flex;
    gap: 0.5rem;
}

.preview-dimensions {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.preview-dimension {
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--background-color) 88%, transparent);
    padding: 0.75rem;
    text-align: center;
    backdrop-filter: blur(14px);
}

.summary-card {
    border: 1px solid var(--glass-border);
    border-radius: 1.4rem;
    background: var(--field-bg);
    padding: 1rem;
}

.summary-card strong {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-color);
    font-size: 1.25rem;
}

.cut-list-wrap {
    overflow-x: auto;
    border: 1px solid #63766c;
    border-radius: .8rem;
    background: #fff;
}

.cut-list-table {
    width: 100%;
    border-collapse: collapse;
    color: #18271f;
    font-family: Tahoma, Arial, sans-serif;
}

.cut-list-table th,
.cut-list-table td {
    border-bottom: 1px solid #c8d3cb;
    padding: .85rem .8rem;
    text-align: right;
    white-space: nowrap;
    line-height: 1.55;
}

.cut-list-table th {
    background: #23483a;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.cut-list-table td {
    font-size: 1.0625rem;
    font-weight: 500;
}

.cut-list-table tbody tr:nth-child(even) {
    background: #eef4ef;
}

.cut-list-table td:first-child {
    font-weight: 700;
}

.cut-list-table :is(th, td):nth-child(n+2):nth-child(-n+6) {
    text-align: center;
    border-inline-start: 1px solid #c8d3cb;
}

.cut-list-table td:nth-child(n+2):nth-child(-n+6) {
    font-size: 1.1875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.cut-list-table td:last-child {
    white-space: normal;
    min-width: 13rem;
}

.cut-list-table tbody tr:last-child td {
    border-bottom: 0;
}

@media print {
    .cut-list-wrap .cut-list-table { min-width: 0; }
    .cut-list-table :is(th, td) { padding: .35rem; white-space: normal; }
    .cut-list-table th { background: #e2ebe5; color: #18271f; }
    .cut-list-table td:last-child { min-width: 0; }
    .cut-list-table :is(th, td):nth-child(n) { font-size: 10pt; }
}

.calculator-status,
.form-status {
    min-height: 1.5rem;
    color: var(--text-muted);
}

.calculator-status.success,
.form-status.success {
    color: var(--primary-color);
}

.calculator-status.error,
.form-status.error {
    color: var(--logo-subtitle-color);
}

.contact-note {
    border: 1px solid var(--glass-border);
    border-radius: 1.4rem;
    background: color-mix(in srgb, var(--background-color) 66%, transparent);
    padding: 1rem;
}

.mobile-action-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 45;
    border-top: 1px solid var(--glass-border);
    background: color-mix(in srgb, var(--background-color) 88%, transparent);
    padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
    backdrop-filter: blur(18px);
}

@media (max-width: 767px) {
    .section-kicker::before {
        width: 1.6rem;
    }

    .arch-frame-large,
    .arch-frame-medium,
    .service-image-wrap {
        height: 500px;
        min-height: 0;
    }

    .arch-frame-large {
        margin-right: auto;
        margin-left: auto;
        width: min(100%, 450px);
    }

    .floating-metric {
        position: relative;
        right: auto;
        bottom: auto;
        margin: -2.5rem auto 0;
    }

    .service-image-wrap {
        border-radius: 999px 999px 2rem 2rem;
    }

    .preview-stage,
    .preview-canvas-host,
    .kitchen-preview-canvas {
        min-height: 420px;
    }

    .preview-dimensions {
        grid-template-columns: 1fr;
    }
}

.upload-drop {
    position: relative;
    border: 1.5px dashed var(--glass-border);
    border-radius: 1.6rem;
    background: var(--field-bg);
    padding: 1.4rem;
    transition: border-color 300ms ease, background 300ms ease;
}

.upload-drop.is-dragging {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 10%, var(--field-bg));
}

.upload-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    text-align: center;
}

.upload-empty[hidden],
.upload-preview[hidden] {
    display: none;
}

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.upload-preview img {
    height: 5.5rem;
    width: 5.5rem;
    flex-shrink: 0;
    border: 1px solid var(--glass-border);
    border-radius: 1.1rem;
    object-fit: cover;
}

.upload-status {
    min-height: 1.4rem;
    margin-top: 0.6rem;
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.upload-status.success {
    color: var(--primary-color);
}

.upload-status.error {
    color: var(--logo-subtitle-color);
}

.ai-studio-grid {
    display: grid;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .ai-studio-grid {
        grid-template-columns: 0.9fr 1.1fr;
        align-items: start;
    }
}

.ai-result-stage {
    position: relative;
    display: flex;
    min-height: 480px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: 2rem;
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface-color) 86%, transparent), var(--background-color));
    box-shadow: var(--shadow-soft);
}

.ai-result-empty,
.ai-result-loading {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2.5rem;
    text-align: center;
}

.ai-result-empty[hidden],
.ai-result-loading[hidden],
.ai-result-canvas[hidden],
.ai-result-actions[hidden] {
    display: none;
}

.ai-result-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.ai-result-canvas img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-spinner {
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    border: 3px solid var(--sage-soft);
    border-top-color: var(--accent-color);
    animation: ai-spin 900ms linear infinite;
}

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

.ai-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 1rem;
}

.ai-gallery-grid {
    display: grid;
    gap: 1.4rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .ai-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .ai-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.ai-gallery-card {
    display: flex;
    height: 100%;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 1.8rem;
    background: color-mix(in srgb, var(--background-color) 66%, transparent);
    padding: 1rem;
    transition: transform 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.ai-gallery-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-soft);
    transform: translateY(-5px);
}

.ai-gallery-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: 1.3rem;
    background: var(--surface-color);
}

.ai-gallery-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-gallery-placeholder {
    display: flex;
    height: 100%;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: var(--text-muted);
    padding: 1rem;
    text-align: center;
}

.ai-gallery-placeholder[hidden] {
    display: none;
}

.sketch-result {
    border: 1px solid var(--glass-border);
    border-radius: 1.8rem;
    background: var(--field-bg);
    padding: 1.3rem;
}

.sketch-result[hidden] {
    display: none;
}
