/* Barandillas de Cristal Configurador - v1.0 */

/* === LAYOUT VERTICAL === */
.brc-layout {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* === PREVIEW SVG FRONTAL (full-width) === */
.brc-preview-container {
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    overflow: hidden;
    transition: border-color 0.3s;
    width: 100%;
}

.brc-preview-container.active {
    border-color: #2AB9AD;
}

.brc-preview-label {
    font-size: 0.8em;
    color: #888;
    text-align: center;
    padding: 8px 15px;
    background: #f8f9fa;
    font-weight: 500;
    border-bottom: 1px solid #e8e8e8;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.brc-preview {
    background: #fff;
    padding: 15px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brc-preview svg {
    width: 100%;
    max-height: 300px;
}

/* === FILA GEOMETRIA + VISTA SUPERIOR === */
.brc-geo-topview-row {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

/* === SELECTOR GEOMETRIA === */
.brc-geometry-selector {
    flex: 1;
    min-width: 0;
}

.brc-geo-label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.brc-geo-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.brc-geo-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    font-size: 0.78em;
    font-weight: 600;
    color: #555;
    min-width: 62px;
    text-align: center;
}

.brc-geo-btn:hover {
    border-color: #b2dfdb;
    background: #fafffe;
}

.brc-geo-btn.active {
    border-color: #2AB9AD;
    background: linear-gradient(135deg, #e8faf9, #d4f5f3);
    color: #000065;
    box-shadow: 0 2px 8px rgba(42, 185, 173, 0.15);
}

.brc-geo-btn svg {
    flex-shrink: 0;
}

.brc-geo-btn span {
    font-size: 0.9em;
}

/* === VISTA SUPERIOR (PLANTA) === */
.brc-topview-container {
    flex: 1;
    min-width: 0;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    overflow: hidden;
}

.brc-topview {
    background: #fff;
    padding: 10px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brc-topview svg {
    width: 100%;
    max-height: 200px;
}

/* === FILA TRAMOS + ALTURA === */
.brc-tramos-altura-row {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

/* === TRAMOS MANAGER === */
.brc-tramos-manager {
    flex: 1;
    min-width: 0;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
}

.brc-tramos-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Tramo individual (generado por JS) */
.brc-tramo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    transition: background 0.2s;
}

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

.brc-tramo-item:hover {
    background: #fafffe;
}

.brc-tramo-label {
    font-size: 0.82em;
    font-weight: 600;
    color: #555;
    min-width: 60px;
}

.brc-tramo-input-wrap {
    display: flex;
    align-items: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
    flex: 1;
}

.brc-tramo-input-wrap:focus-within {
    border-color: #2AB9AD;
    box-shadow: 0 0 0 3px rgba(42, 185, 173, 0.1);
}

.brc-tramo-input-wrap input {
    flex: 1;
    border: none;
    padding: 8px 10px;
    font-size: 0.9em;
    outline: none;
    background: transparent;
    min-width: 0;
    -moz-appearance: textfield;
}

.brc-tramo-input-wrap input::-webkit-outer-spin-button,
.brc-tramo-input-wrap input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.brc-tramo-input-unit {
    padding: 8px 10px;
    background: #f5f5f5;
    color: #666;
    font-size: 0.8em;
    font-weight: 600;
    border-left: 1px solid #e0e0e0;
    white-space: nowrap;
}

.brc-tramo-remove {
    border: none;
    background: transparent;
    color: #ccc;
    font-size: 1.1em;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.brc-tramo-remove:hover {
    color: #e53935;
    background: #ffeaea;
}

.brc-tramos-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8f9fa;
    border-top: 1px solid #e8e8e8;
}

.brc-add-tramo-btn {
    border: none;
    background: none;
    color: #2AB9AD;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.brc-add-tramo-btn:hover {
    background: #e8faf9;
}

.brc-tramos-total {
    font-size: 0.85em;
    color: #555;
}

.brc-tramos-total strong {
    color: #000065;
}

.brc-tramo-indicator {
    font-size: 0.85em;
    color: #2AB9AD;
    font-weight: 500;
}

/* === INPUT ALTURA (GLOBAL) === */
.brc-altura-global {
    flex: 0 0 140px;
}

.brc-altura-global label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.brc-altura-global label .required {
    color: #e53935;
}

/* === SHARED INPUT WRAP === */
.brc-input-wrap {
    display: flex;
    align-items: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.brc-input-wrap:focus-within {
    border-color: #2AB9AD;
    box-shadow: 0 0 0 3px rgba(42, 185, 173, 0.1);
}

.brc-input-wrap input {
    flex: 1;
    border: none;
    padding: 10px 12px;
    font-size: 1em;
    outline: none;
    background: transparent;
    min-width: 0;
    -moz-appearance: textfield;
}

.brc-input-wrap input::-webkit-outer-spin-button,
.brc-input-wrap input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.brc-input-unit {
    padding: 10px 12px;
    background: #f5f5f5;
    color: #666;
    font-size: 0.85em;
    font-weight: 600;
    border-left: 1px solid #e0e0e0;
    white-space: nowrap;
}

/* === SECCIONES COLAPSABLES === */
.brc-section {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.brc-section.active {
    border-color: #2AB9AD;
    box-shadow: 0 2px 12px rgba(42, 185, 173, 0.12);
}

.brc-section.completed {
    border-color: #4caf50;
}

.brc-section-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.brc-section-header:hover {
    background: #f0f2f5;
}

.brc-section.active .brc-section-header {
    background: linear-gradient(135deg, #e8faf9, #d4f5f3);
}

.brc-section.completed .brc-section-header {
    background: #f1f8e9;
}

.brc-section-number {
    width: 26px;
    height: 26px;
    background: #2AB9AD;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82em;
    margin-right: 12px;
    flex-shrink: 0;
}

.brc-section.completed .brc-section-number {
    background: #4caf50;
}

.brc-section-title {
    flex: 1;
    font-weight: 600;
    color: #333;
    font-size: 0.92em;
}

.brc-section-summary {
    font-size: 0.82em;
    color: #2AB9AD;
    margin-right: 10px;
    font-weight: 500;
}

.brc-section-toggle {
    color: #999;
    font-size: 0.7em;
    transition: transform 0.3s;
}

.brc-section.collapsed .brc-section-toggle {
    transform: rotate(-90deg);
}

.brc-section-content {
    padding: 16px;
    max-height: 800px;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.brc-section.collapsed .brc-section-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

/* === SISTEMA DE FIJACION OPTIONS === */
.brc-system-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.brc-system-option {
    cursor: pointer;
}

.brc-system-option input {
    display: none;
}

.brc-system-card {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.brc-system-option:hover .brc-system-card {
    border-color: #b2dfdb;
    background: #fafffe;
}

.brc-system-option.selected .brc-system-card {
    border-color: #2AB9AD;
    background: linear-gradient(135deg, #e8faf9, #d4f5f3);
    box-shadow: 0 2px 8px rgba(42, 185, 173, 0.15);
}

.brc-system-icon {
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
}

.brc-system-name {
    display: block;
    font-weight: 600;
    font-size: 0.82em;
    color: #333;
    margin-bottom: 2px;
}

.brc-system-desc {
    display: block;
    font-size: 0.7em;
    color: #888;
    line-height: 1.3;
}

/* === GLASS OPTIONS (grid botones) === */
.brc-glass-options.brc-glass-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.brc-glass-option {
    cursor: pointer;
}

.brc-glass-option input {
    display: none;
}

.brc-glass-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 12px;
    transition: border-color 0.2s, background 0.2s;
    text-align: left;
}

.brc-glass-option:hover .brc-glass-btn {
    border-color: #b2dfdb;
    background: #fafffe;
}

.brc-glass-option.selected .brc-glass-btn {
    border-color: #2AB9AD;
    background: linear-gradient(135deg, #e8faf9, #d4f5f3);
}

.brc-glass-swatch {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.08);
}

.brc-glass-name {
    font-weight: 600;
    font-size: 0.8em;
    color: #333;
    line-height: 1.2;
}

/* Recomendación de vidrio */
.brc-glass-recommendation {
    background: linear-gradient(135deg, #fff8e1, #fff3cd);
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.82em;
    color: #795548;
    font-weight: 500;
    margin-bottom: 12px;
    display: none;
}

.brc-glass-recommendation:not(:empty) {
    display: block;
}

/* === ACABADO ESTRUCTURA OPTIONS === */
.brc-finish-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.brc-finish-option {
    cursor: pointer;
}

.brc-finish-option input {
    display: none;
}

.brc-finish-card {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 12px;
    transition: border-color 0.2s, background 0.2s;
}

.brc-finish-option:hover .brc-finish-card {
    border-color: #b2dfdb;
    background: #fafffe;
}

.brc-finish-option.selected .brc-finish-card {
    border-color: #2AB9AD;
    background: linear-gradient(135deg, #e8faf9, #d4f5f3);
}

.brc-finish-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.brc-finish-name {
    font-weight: 600;
    font-size: 0.8em;
    color: #333;
    line-height: 1.2;
}

/* === UBICACION OPTIONS === */
.brc-location-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.brc-location-option {
    cursor: pointer;
}

.brc-location-option input {
    display: none;
}

.brc-location-card {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 14px;
    transition: border-color 0.2s, background 0.2s;
}

.brc-location-option:hover .brc-location-card {
    border-color: #b2dfdb;
}

.brc-location-option.selected .brc-location-card {
    border-color: #2AB9AD;
    background: linear-gradient(135deg, #e8faf9, #d4f5f3);
}

.brc-location-icon {
    font-size: 1.4em;
}

.brc-location-name {
    font-weight: 600;
    font-size: 0.85em;
    color: #333;
}

/* === PASAMANOS CHECKBOX === */
.brc-pasamanos-check {
    margin-top: 4px;
}

.brc-pasamanos-label {
    cursor: pointer;
    display: block;
}

.brc-pasamanos-label input {
    display: none;
}

.brc-pasamanos-card {
    display: flex;
    align-items: center;
    gap: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px 18px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.brc-pasamanos-label:hover .brc-pasamanos-card {
    border-color: #b2dfdb;
    background: #fafffe;
}

.brc-pasamanos-label.checked .brc-pasamanos-card {
    border-color: #2AB9AD;
    background: linear-gradient(135deg, #e8faf9, #d4f5f3);
    box-shadow: 0 2px 8px rgba(42, 185, 173, 0.15);
}

.brc-pasamanos-icon {
    flex-shrink: 0;
}

.brc-pasamanos-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.brc-pasamanos-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #333;
}

.brc-pasamanos-desc {
    font-size: 0.75em;
    color: #888;
    margin-top: 2px;
}

.brc-pasamanos-tick {
    width: 28px;
    height: 28px;
    border: 2px solid #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    color: transparent;
    flex-shrink: 0;
    transition: all 0.2s;
}

.brc-pasamanos-label.checked .brc-pasamanos-tick {
    background: #2AB9AD;
    border-color: #2AB9AD;
    color: #fff;
}

/* === RESUMEN TECNICO === */
.brc-summary {
    background: linear-gradient(135deg, #f8fffe, #edf9f8);
    border: 1px solid #b2dfdb;
    border-radius: 12px;
    padding: 16px;
}

.brc-summary-title {
    font-size: 0.82em;
    font-weight: 700;
    color: #000065;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 12px;
}

.brc-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.brc-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(178, 223, 219, 0.4);
}

.brc-summary-label {
    font-size: 0.82em;
    color: #666;
}

.brc-summary-value {
    font-size: 0.85em;
    font-weight: 700;
    color: #333;
}

/* === METROS TOTAL === */
.brc-metros-total {
    color: #000065;
    font-weight: 700;
}

/* === DROPZONE (FOTOS) === */
.brc-dropzone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.brc-dropzone:hover {
    border-color: #2AB9AD;
    background: #f5fffe;
}

.brc-dropzone.dragover {
    border-color: #2AB9AD;
    background: #e8faf9;
    border-style: solid;
}

.brc-dropzone-inner {
    pointer-events: none;
}

.brc-dropzone-icon {
    font-size: 2em;
    display: block;
    margin-bottom: 8px;
}

.brc-dropzone-text {
    font-size: 0.9em;
    color: #555;
    margin: 0 0 4px 0;
}

.brc-dropzone-link {
    color: #2AB9AD;
    font-weight: 600;
    text-decoration: underline;
}

.brc-dropzone-hint {
    font-size: 0.75em;
    color: #999;
    margin: 0;
}

.brc-photo-thumbs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.brc-photo-thumbs:empty {
    display: none;
}

.brc-photo-thumb {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    border: 2px solid #e0e0e0;
    overflow: hidden;
}

.brc-photo-thumb.loading {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brc-photo-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #2AB9AD;
    border-radius: 50%;
    animation: brc-spin 0.8s linear infinite;
}

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

.brc-photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(229, 57, 53, 0.85);
    color: #fff;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s;
}

.brc-photo-thumb:hover .brc-photo-remove {
    opacity: 1;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .brc-geo-topview-row {
        flex-direction: column;
    }

    .brc-tramos-altura-row {
        flex-direction: column;
    }

    .brc-altura-global {
        flex: none;
        width: 100%;
    }

    .brc-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .brc-system-options {
        grid-template-columns: 1fr 1fr;
    }

    .brc-glass-options.brc-glass-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

@media (max-width: 600px) {
    .brc-geo-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .brc-system-options {
        grid-template-columns: 1fr;
    }

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

    .brc-finish-options {
        grid-template-columns: 1fr 1fr;
    }

    .brc-location-options {
        grid-template-columns: 1fr;
    }

    .brc-summary-grid {
        grid-template-columns: 1fr;
    }

    .brc-section-content {
        padding: 12px;
    }

    .brc-pasamanos-card {
        padding: 12px 14px;
    }
}

@media (max-width: 400px) {
    .brc-summary {
        padding: 12px;
    }

    .brc-preview {
        padding: 10px;
    }

    .brc-glass-options.brc-glass-grid {
        grid-template-columns: 1fr 1fr;
    }
}
