/**
 * Estilos principales del Armador de PC Frontend
 */

:root {
    --tma-red: #c81a2b;
    --tma-red-dark: #9c0a25;
    --tma-white: #ffffff;
    --tma-black: #0b0b0b;
}

/* Contenedor principal */
.armador-pc-builder {
    max-width: 1200px;
    margin: 30px auto;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Encabezado */
.armador-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #2c3e50;
}

.armador-header h1 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 2.5em;
    font-weight: 600;
}

.armador-header p {
    margin: 0;
    color: #7f8c8d;
    font-size: 1.1em;
}

/* Barra de progreso */
.armador-progress {
    margin-bottom: 40px;
    background: white;
    padding: 20px;
    border-radius: 6px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.step {
    flex: 1;
    min-width: 80px;
    text-align: center;
    position: relative;
}

.step span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 auto 8px;
    background-color: #ecf0f1;
    border-radius: 50%;
    font-weight: 600;
    color: #7f8c8d;
    font-size: 16px;
    transition: all 0.3s ease;
}

.step p {
    margin: 0;
    font-size: 13px;
    color: #7f8c8d;
}

.step.active span {
    background-color: #3498db;
    color: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.step.completed span {
    background-color: #27ae60;
    color: white;
}

/* Formulario */
#armador-pc-form {
    background: white;
    padding: 30px;
    border-radius: 6px;
    margin-bottom: 30px;
}

/* Pasos del constructor */
.builder-step {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.builder-step.active {
    display: block;
}

.builder-step h2 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

/* Opciones de componentes */
.component-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.component-card {
    background: white;
    border: 2px solid #ecf0f1;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.component-card:hover {
    border-color: var(--tma-red);
    box-shadow: 0 4px 12px rgba(200, 26, 43, 0.12);
    transform: translateY(-2px);
}

.component-card.selected {
    border-color: var(--tma-red);
    background-color: #fff6f6;
    box-shadow: 0 4px 12px rgba(200, 26, 43, 0.06);
}

.component-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.component-card h3 {
    margin: 10px 0;
    font-size: 16px;
    color: #2c3e50;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.component-price {
    color: #27ae60;
    font-size: 18px;
    font-weight: 600;
    margin: 10px 0;
}

.component-specs {
    font-size: 12px;
    color: #7f8c8d;
    margin: 10px 0;
    min-height: 30px;
}

.select-component-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--tma-red);
    color: var(--tma-white);
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.select-component-btn:hover {
    background-color: var(--tma-red-dark);
}

.component-card.selected .select-component-btn {
    background-color: var(--tma-black);
    color: var(--tma-white);
}

.component-card.selected .select-component-btn:hover {
    background-color: #000000;
}

/* Acciones de pasos */
.step-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ecf0f1;
}

.prev-step,
.next-step,
.add-all-to-cart {
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 250px;
}

.prev-step {
    background-color: #95a5a6;
    color: white;
}

.prev-step:hover {
    background-color: #7f8c8d;
}

.next-step {
    background-color: var(--tma-red);
    color: var(--tma-white);
}

.next-step:hover {
    background-color: var(--tma-red-dark);
}

.add-all-to-cart {
    background-color: var(--tma-black);
    color: var(--tma-white);
    font-size: 16px;
}

.add-all-to-cart:hover {
    background-color: #000000;
}

/* Resumen */
.configuration-summary {
    margin: 25px 0;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.summary-table th,
.summary-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.summary-table th {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #2c3e50;
}

.summary-table tbody tr:hover {
    background-color: #f9f9f9;
}

.summary-table tfoot tr {
    font-weight: 600;
    background-color: #ecf0f1;
}

/* Barra lateral (legacy - no aplicar al nuevo builder) */
.armador-sidebar-legacy {
    background: white;
    padding: 20px;
    border-radius: 6px;
    margin-left: 20px;
    position: sticky;
    top: 20px;
}

.armador-sidebar-legacy h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* legacy preview container renamed */
#selected-preview-legacy {
    margin: 15px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
    min-height: 100px;
}

#selected-preview-legacy p {
    margin: 0;
    color: #7f8c8d;
    font-size: 14px;
}

.total-preview {
    margin-top: 20px;
    padding: 15px;
    background-color: #f0fdf4;
    border-left: 4px solid #27ae60;
    border-radius: 4px;
}

.total-preview h4 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 14px;
}

/* legacy preview total renamed */
#preview-total-legacy {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #27ae60;
}

/* Indicador de carga */
#armador-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#armador-loading p {
    color: white;
    margin-top: 20px;
    font-size: 16px;
}

/* Animación de entrada */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media screen and (max-width: 768px) {
    .armador-pc-builder {
        padding: 15px;
        margin: 15px;
    }
    
    .armador-header h1 {
        font-size: 1.8em;
    }
    

/* Scoped overrides to avoid Bootstrap/global leakage into the builder */
.armador-pc-builder .btn,
.armador-pc-builder .button {
    /* Ensure builder buttons use plugin palette */
    color: #ffffff !important;
    background-color: #3498db !important;
    border-color: #3498db !important;
}

.armador-pc-builder .btn:hover,
.armador-pc-builder .button:hover {
    color: #ffffff !important;
    background-color: #2980b9 !important;
    border-color: #2980b9 !important;
}

/* Danger buttons in the builder */
.armador-pc-builder .btn-danger,
.armador-pc-builder .button-danger {
    background-color: #c81a2b !important;
    border-color: #c81a2b !important;
    color: #ffffff !important;
}
.armador-pc-builder .btn-danger:hover,
.armador-pc-builder .button-danger:hover {
    background-color: #9c0a25 !important;
    border-color: #9c0a25 !important;
}

/* Override active/checked/global selectors only inside builder scope (use plugin palette) */
.armador-pc-builder .btn-check:checked + .btn,
.armador-pc-builder .btn.active,
.armador-pc-builder .btn.show,
.armador-pc-builder .btn:first-child:active,
.armador-pc-builder :not(.btn-check) + .btn:active {
    color: var(--tma-white) !important;
    background-color: var(--tma-red) !important;
    border-color: var(--tma-red) !important;
}

/* Make sure .select-component-btn follows selected color rules (override any green/other) */
.armador-pc-builder .component-card .select-component-btn {
    background-color: var(--tma-red) !important;
    border-color: var(--tma-red) !important;
    color: var(--tma-white) !important;
}
.armador-pc-builder .component-card.selected .select-component-btn {
    background-color: var(--tma-black) !important;
    border-color: var(--tma-black) !important;
    color: var(--tma-white) !important;
}

/* Steps: ensure numbers and labels are readable despite global rules */
.armador-pc-builder .step span {
    background-color: #ecf0f1 !important;
    color: #7f8c8d !important;
    box-shadow: none !important;
}
.armador-pc-builder .step.active span {
    background-color: var(--tma-red) !important;
    color: var(--tma-white) !important;
    box-shadow: 0 0 0 3px rgba(200,26,43,0.12) !important;
}
.armador-pc-builder .step.completed span {
    background-color: var(--tma-black) !important;
    color: var(--tma-white) !important;
}
.armador-pc-builder .step p {
    color: #2c3e50 !important;
}

/* Ensure step indicators have enough contrast and visibility */
.armador-pc-builder .progress-steps .step span {
    font-size: 16px !important;
    font-weight: 700 !important;
}

/* Prevent global .btn styles from changing component-card borders */
.armador-pc-builder .component-card,
.armador-pc-builder .component-card.selected {
    border-color: inherit !important;
}

/* Keep summary and sidebar buttons consistent */
.armador-pc-builder .armador-sidebar-box .button,
.armador-pc-builder #sidebar-checkout-btn {
    background-color: #27ae60 !important;
    border-color: #27ae60 !important;
    color: #fff !important;
}

/* End of scoped builder overrides */
    .progress-steps {
        gap: 5px;
    }
    
    .step {
        min-width: 60px;
    }
    
    .step span {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .step p {
        font-size: 11px;
    }
    
    .component-options {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .step-actions {
        flex-direction: column;
    }
    
    .prev-step,
    .next-step,
    .add-all-to-cart {
        max-width: 100%;
    }
    
    .armador-sidebar-legacy {
        margin-left: 0;
        margin-top: 20px;
        position: relative;
        top: 0;
    }
    
    .summary-table {
        font-size: 12px;
    }
    
    .summary-table th,
    .summary-table td {
        padding: 8px;
    }
}

@media screen and (max-width: 480px) {
    .armador-header h1 {
        font-size: 1.4em;
    }
    
    .component-options {
        grid-template-columns: 1fr;
    }
    
    .progress-steps {
        flex-direction: column;
    }
}

/* Barra de progreso */
.armador-progress {
    margin-bottom: 40px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #ddd;
    z-index: 1;
}

.step {
    text-align: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step span {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: #ddd;
    border-radius: 50%;
    line-height: 40px;
    color: white;
    margin-bottom: 10px;
}

.step.active span {
    background: #007cba;
}

.step p {
    margin: 5px 0 0;
    font-size: 14px;
    color: #666;
}

/* Tarjetas de componentes */
.component-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.component-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

.component-card:hover {
    border-color: #007cba;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.component-card img {
    max-width: 100%;
    height: 150px;
    object-fit: contain;
    margin-bottom: 15px;
}

.component-card h3 {
    font-size: 16px;
    margin: 10px 0;
    height: 40px;
    overflow: hidden;
}

.component-price {
    color: #007cba;
    font-weight: bold;
    font-size: 18px;
    margin: 10px 0;
}

.component-specs {
    font-size: 12px;
    color: #666;
    margin: 10px 0;
    height: 40px;
    overflow: hidden;
}

.select-component-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.select-component-btn:hover {
    background: #005a87;
}

/* Tabla de resumen */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.summary-table th,
.summary-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.summary-table th {
    background: #f8f9fa;
    font-weight: bold;
}

/* Botones de navegación */
.step-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.prev-step,
.next-step,
.add-all-to-cart {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.prev-step {
    background: #6c757d;
    color: white;
}

.next-step {
    background: #007cba;
    color: white;
}

.add-all-to-cart {
    background: #28a745;
    color: white;
    font-size: 16px;
}

.prev-step:hover {
    background: #545b62;
}

.next-step:hover {
    background: #005a87;
}

.add-all-to-cart:hover {
    background: #218838;
}

/* Loading spinner */
#armador-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1024px) {
    .armador-pc-builder {
        flex-direction: column;
    }
    
    .armador-sidebar-legacy {
        position: static;
        margin-top: 30px;
    }
}

@media (max-width: 768px) {
    .component-options {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .progress-steps {
        flex-wrap: wrap;
    }
    
    .step {
        flex: 0 0 calc(25% - 10px);
        margin-bottom: 20px;
    }
}

/* Strong overrides for step active/completed to enforce site palette (red/white/black) */
.armador-pc-builder .step.active,
.armador-pc-builder .step.active span,
.armador-pc-builder .step.active .step-number {
    background: var(--tma-red) !important;
    color: var(--tma-white) !important;
    border-color: var(--tma-red) !important;
    box-shadow: 0 0 0 3px rgba(200,26,43,0.12) !important;
}

.armador-pc-builder .step.completed,
.armador-pc-builder .step.completed span {
    background: var(--tma-black) !important;
    color: var(--tma-white) !important;
    border-color: var(--tma-black) !important;
}

/* Ensure non-span .step.active also displays correctly */
.armador-pc-builder .step.active p,
.armador-pc-builder .step.active .step-label {
    color: var(--tma-white) !important;
}

/* Final safety: neutralize other .step.active rules from themes */
.armador-pc-builder .step.active {
    background: var(--tma-red) !important;
    color: var(--tma-white) !important;
    border-color: var(--tma-red) !important;
}