/* =====================================================
   ESTILOS PARA MÓDULO DE MATERIALES - SISTEMA NAP FTTH
   Fecha: 2025-08-03
   ===================================================== */

/* Sección principal de materiales */
#materialesSection {
    margin: 20px 0;
    padding: 30px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.materiales-header {
    margin-bottom: 20px;
    text-align: center;
}

.materiales-header h4 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.materiales-header small {
    color: #6c757d;
    font-style: italic;
}

/* Grid de materiales */
.materiales-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.categoria-group {
    background: white;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.categoria-title {
    color: #495057;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
    font-size: 16px;
    font-weight: 600;
}

.materiales-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
}

/* Items individuales de materiales */
.material-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.material-item:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.material-item.stock-bajo {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.material-item.stock-bajo:hover {
    background: #ffeaa7;
}

.material-info {
    flex: 1;
    margin-right: 15px;
}

.material-nombre {
    font-weight: 600;
    color: #343a40;
    font-size: 14px;
    margin-bottom: 2px;
}

.material-codigo {
    font-size: 12px;
    color: #6c757d;
    font-family: 'Courier New', monospace;
    margin-bottom: 4px;
}

.material-stock {
    font-size: 12px;
    color: #28a745;
    font-weight: 500;
}

.material-stock.stock-bajo {
    color: #dc3545;
}

/* Controles de cantidad */
.material-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cantidad-input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    text-align: center;
    font-size: 14px;
}

.cantidad-input:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.material-controls label {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
}

/* Resumen de materiales */
.materiales-resumen {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.materiales-resumen h5 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.no-materials {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    margin: 0;
}

.resumen-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.resumen-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
}

.item-nombre {
    flex: 1;
    font-weight: 500;
    color: #343a40;
}

.item-cantidad {
    margin: 0 15px;
    color: #6c757d;
    font-size: 13px;
}

.item-costo {
    color: #28a745;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.resumen-total {
    text-align: right;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
    color: #2c3e50;
    font-size: 16px;
}

/* Validación SMARTOLT */
.materiales-validacion {
    margin-top: 20px;
    padding: 15px;
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
}

.materiales-validacion h5 {
    color: #1976d2;
    margin-bottom: 10px;
}

#validacionResults {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: white;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

/* Estados de validación */
.validacion-success {
    color: #28a745;
}

.validacion-error {
    color: #dc3545;
}

.validacion-warning {
    color: #ffc107;
}

/* Alertas de stock */
.stock-alert {
    background: #f8d7da;
    color: #721c24;
    padding: 10px 15px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
}

.stock-alert strong {
    display: block;
    margin-bottom: 5px;
}

/* Responsive design */
@media (max-width: 768px) {
    .materiales-items {
        grid-template-columns: 1fr;
    }
    
    .material-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .material-controls {
        align-self: flex-end;
    }
    
    .resumen-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .item-cantidad,
    .item-costo {
        margin: 0;
    }
}

/* Animaciones */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.material-item {
    animation: slideIn 0.3s ease-out;
}

/* Estados de carga */
.materiales-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.materiales-loading::before {
    content: "⏳";
    font-size: 24px;
    display: block;
    margin-bottom: 10px;
}

/* Botones específicos del módulo */
.materiales-action-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.materiales-action-btn:hover {
    background: #0056b3;
}

.materiales-action-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* ONT específicos */
.ont-item {
    border: 2px solid #007bff;
    background: #f8f9ff;
}

.ont-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ont-select {
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    min-width: 200px;
}

.ont-select:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.ont-select:disabled {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
}

.ont-info {
    padding: 6px 8px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 12px;
}

.ont-mac {
    font-family: monospace;
    font-weight: bold;
}

.smartolt-status {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 8px;
    cursor: help;
    transition: all 0.2s ease;
}

.smartolt-status:hover {
    transform: scale(1.02);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.smartolt-status.validating {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
    animation: pulse-validating 1.5s ease-in-out infinite;
}

@keyframes pulse-validating {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.smartolt-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.smartolt-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.smartolt-status.blocked {
    background: #ff9800;
    color: white;
    border: 1px solid #f57c00;
    animation: blink-blocked 2s ease-in-out infinite;
}

@keyframes blink-blocked {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.smartolt-status.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Tooltip mejorado para estado SMARTOLT */
.smartolt-status[title]:hover::after {
    content: attr(title);
    position: absolute;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 11px;
    white-space: pre-line;
    z-index: 1000;
    margin-top: 25px;
    margin-left: -50px;
    max-width: 250px;
}

/* Diseño compacto para campo */
.materiales-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.materiales-compact .material-item {
    padding: 12px;
    margin-bottom: 0;
}

.materiales-compact .material-info {
    margin-bottom: 8px;
}

.materiales-compact .material-nombre {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.materiales-compact .material-codigo {
    font-size: 11px;
    color: #6c757d;
    margin-bottom: 4px;
}

.materiales-compact .material-stock {
    font-size: 11px;
}

.materiales-compact .ont-select {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 180px;
}

.materiales-compact .cantidad-input {
    width: 60px;
    padding: 4px 8px;
    font-size: 13px;
}

.categoria-group {
    margin-bottom: 20px;
}

.categoria-title {
    margin-bottom: 10px;
    font-size: 16px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

/* Integración with tema existente - usar estilos por defecto */