/* Calculadora de Materiales - Estilos Mejorados */

.calculadora-materiales-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8f9fa;
}

.calc-header {
    margin-bottom: 40px;
    text-align: center;
    background: white;
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.calc-title {
    font-size: 2.5em;
    color: #BF0411;
    margin-bottom: 15px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.calc-description {
    font-size: 1.2em;
    color: #6c757d;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.calc-content {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.calc-list-header {
    display: none; /* Ocultamos el header para un diseño más limpio */
}

.calc-item {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 24px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.calc-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border-color: rgba(191, 4, 17, 0.1);
}

.calc-item-header {
    display: flex;
    align-items: center;
    padding: 30px;
    transition: background-color 0.2s ease;
    position: relative;
}

.calc-item-header:hover {
    background-color: rgba(248, 249, 250, 0.5);
}

.calc-col-img {
    width: 100px;
    flex-shrink: 0;
    margin-right: 25px;
}

.calc-item-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    background: #f8f9fa;
    padding: 8px;
    transition: all 0.3s ease;
}

.calc-item-image:hover {
    border-color: #BF0411;
    transform: scale(1.05);
}

.calc-col-content {
    flex: 1;
    padding: 0;
}

.calc-item-name {
    font-size: 1.4em;
    color: #212529;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.3;
}

.calc-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.calc-metros-input {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1.1em;
    width: 180px;
    transition: all 0.2s ease;
    background: #f8f9fa;
    font-weight: 600;
}

.calc-metros-input:focus {
    outline: none;
    border-color: #BF0411;
    box-shadow: 0 0 0 4px rgba(191, 4, 17, 0.1);
    background: white;
}

.calc-unit {
    color: #6c757d;
    font-size: 1em;
    font-weight: 600;
    background: #e9ecef;
    padding: 8px 12px;
    border-radius: 8px;
}

.calc-total {
    font-size: 1.2em;
    color: #495057;
    font-weight: 600;
}

.calc-total-amount {
    font-weight: 800;
    color: #BF0411;
    font-size: 1.3em;
}

.calc-toggle {
    width: 60px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.calc-toggle-btn {
    background: linear-gradient(135deg, #BF0411, #d63447);
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: all 0.3s ease;
    color: white;
    font-size: 1.4em;
    font-weight: bold;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(191, 4, 17, 0.3);
}

.calc-toggle-btn:hover {
    background: linear-gradient(135deg, #a0030e, #BF0411);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(191, 4, 17, 0.4);
}

.calc-toggle-btn:active {
    transform: scale(0.95);
}

.calc-details {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 16px 16px;
}

.calc-details-header {
    display: flex;
    padding: 20px 30px;
    background: linear-gradient(135deg, #495057, #6c757d);
    color: white;
    font-weight: 700;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.calc-detail-col-img {
    width: 80px;
    flex-shrink: 0;
}

.calc-detail-col-name {
    flex: 2;
    padding-left: 15px;
}

.calc-detail-col-brand {
    flex: 1.5;
}

.calc-detail-col-ref {
    flex: 1;
}

.calc-detail-col-qty {
    flex: 0.8;
    text-align: center;
}

.calc-detail-col-price {
    flex: 1.2;
    text-align: right;
    padding-right: 15px;
}

.calc-products-list {
    max-height: 500px;
    overflow-y: auto;
}

.calc-product-item {
    display: flex;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #dee2e6;
    transition: all 0.2s ease;
    font-size: 0.95em;
}

.calc-product-item:hover {
    background: linear-gradient(90deg, rgba(191, 4, 17, 0.03), rgba(191, 4, 17, 0.01));
    border-left: 4px solid #BF0411;
    padding-left: 26px;
}

.calc-product-item:last-child {
    border-bottom: none;
}

.calc-product-item .calc-detail-col-img img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: white;
    padding: 4px;
}

.calc-product-item .calc-detail-col-name {
    font-weight: 600;
    color: #212529;
}

.calc-product-item .calc-detail-col-brand {
    color: #6c757d;
    font-weight: 500;
}

.calc-product-item .calc-detail-col-ref {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #495057;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.calc-product-item .calc-detail-col-qty {
    font-weight: 700;
    color: #BF0411;
    font-size: 1.1em;
}

.calc-product-item .calc-detail-col-price {
    font-weight: 800;
    color: #28a745;
    font-size: 1.1em;
}

.calc-product-link {
    color: #BF0411;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.calc-product-link:hover {
    color: #8b0309;
    text-decoration: underline;
}

.calc-no-items {
    padding: 60px 40px;
    text-align: center;
    color: #6c757d;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.calc-no-items p {
    font-size: 1.2em;
    margin: 0;
}

.calc-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
    backdrop-filter: blur(4px);
}

.calc-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    border-top-color: #BF0411;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

.calc-loading p {
    font-size: 1.2em;
    font-weight: 600;
    margin: 0;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .calculadora-materiales-container {
        padding: 20px 15px;
    }
    
    .calc-header {
        padding: 30px 20px;
        margin-bottom: 30px;
    }
    
    .calc-title {
        font-size: 2em;
    }
    
    .calc-description {
        font-size: 1.1em;
    }
    
    .calc-item {
        margin-bottom: 20px;
    }
    
    .calc-item-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 25px 20px;
        position: relative;
    }
    
    .calc-col-img {
        width: 100%;
        margin-right: 0;
        margin-bottom: 15px;
        display: flex;
        justify-content: center;
    }
    
    .calc-item-image {
        width: 70px;
        height: 70px;
    }
    
    .calc-col-content {
        width: 100%;
        text-align: center;
    }
    
    .calc-item-name {
        font-size: 1.3em;
    }
    
    .calc-input-group {
        justify-content: center;
        margin-bottom: 20px;
    }
    
    .calc-metros-input {
        width: 150px;
    }
    
    .calc-toggle {
        position: absolute;
        top: 20px;
        right: 20px;
    }
    
    .calc-details-header {
        padding: 15px 20px;
        font-size: 0.8em;
    }
    
    .calc-product-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        text-align: left;
    }
    
    .calc-product-item:hover {
        border-left: none;
        padding-left: 20px;
        background: rgba(191, 4, 17, 0.05);
    }
    
    .calc-detail-col-img,
    .calc-detail-col-name,
    .calc-detail-col-brand,
    .calc-detail-col-ref,
    .calc-detail-col-qty,
    .calc-detail-col-price {
        width: 100%;
        margin-bottom: 8px;
        padding: 0;
        text-align: left;
    }
    
    .calc-product-item .calc-detail-col-img img {
        width: 40px;
        height: 40px;
        margin-bottom: 10px;
    }
    
    .calc-details-header {
        display: none;
    }
}

/* Estilos para estados de carga y error */
.calc-error {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border: 2px solid #f1919a;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 12px;
    margin: 15px 0;
    font-weight: 600;
}

.calc-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 2px solid #a3d9a5;
    color: #155724;
    padding: 15px 20px;
    border-radius: 12px;
    margin: 15px 0;
    font-weight: 600;
}

/* Animaciones mejoradas */
.calc-item {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calc-details {
    transition: all 0.4s ease;
}

/* Mejoras de accesibilidad */
.calc-metros-input:focus,
.calc-toggle-btn:focus {
    outline: 3px solid rgba(191, 4, 17, 0.3);
    outline-offset: 2px;
}

/* Scrollbar personalizada para la lista de productos */
.calc-products-list::-webkit-scrollbar {
    width: 8px;
}

.calc-products-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.calc-products-list::-webkit-scrollbar-thumb {
    background: #BF0411;
    border-radius: 4px;
}

.calc-products-list::-webkit-scrollbar-thumb:hover {
    background: #8b0309;
}

/* Estilos para impresión */
@media print {
    .calc-toggle,
    .calc-loading {
        display: none !important;
    }
    
    .calc-details {
        display: block !important;
    }
    
    .calculadora-materiales-container {
        box-shadow: none;
        background: white;
    }
    
    .calc-item {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}