/**
 * Estilos para el componente de Detección de Enfermedades de Patatas
 * Sistema de Seguimiento Satelital Patatas Meléndez
 */

/* Contenedor principal */
.disease-detection-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
.detection-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detection-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.detection-header h2 i {
    margin-right: 0.5rem;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.header-controls .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.header-controls .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Área principal */
.detection-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 600px;
}

/* Panel de imagen */
.image-panel {
    padding: 2rem;
    border-right: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* Área de upload */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-content i {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.upload-content h3 {
    margin: 0 0 0.5rem;
    color: #374151;
}

.upload-content p {
    margin: 0.5rem 0;
    color: #6b7280;
}

.formats-info {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Área de cámara */
.camera-area {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.camera-area video {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.camera-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
}

/* Preview de imagen */
.image-preview {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.image-preview img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.image-info {
    padding: 1rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
}

.preview-controls {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Panel de resultados */
.results-panel {
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

/* Indicador de procesamiento */
.processing-indicator {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Resultados de detección */
.detection-results h3 {
    margin-bottom: 1.5rem;
    color: #111827;
    font-size: 1.25rem;
}

/* Resultado principal */
.main-result {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.disease-icon {
    width: 60px;
    height: 60px;
    background: #dbeafe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    font-size: 1.5rem;
}

.result-details {
    flex: 1;
}

.result-details h4 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    color: #111827;
}

.confidence-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.confidence-progress {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    transition: width 0.5s ease;
}

.severity-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.severity-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-none {
    background: #d1fae5;
    color: #065f46;
}

.severity-low {
    background: #fef3c7;
    color: #92400e;
}

.severity-medium {
    background: #fed7aa;
    color: #9a3412;
}

.severity-high {
    background: #fee2e2;
    color: #991b1b;
}

.severity-critical {
    background: #fecaca;
    color: #7f1d1d;
}

/* Sección de tratamiento */
.treatment-section {
    margin-bottom: 2rem;
}

.treatment-section h4 {
    margin-bottom: 1rem;
    color: #374151;
}

.treatment-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
}

.treatment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.treatment-header h5 {
    margin: 0;
    color: #111827;
    font-size: 1.125rem;
}

.urgency-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.urgency-low {
    background: #d1fae5;
    color: #065f46;
}

.urgency-medium {
    background: #fef3c7;
    color: #92400e;
}

.urgency-high {
    background: #fee2e2;
    color: #991b1b;
}

.urgency-immediate {
    background: #fecaca;
    color: #7f1d1d;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.treatment-description {
    color: #6b7280;
    margin-bottom: 1rem;
}

.treatment-chemicals h6 {
    margin: 0 0 0.5rem;
    color: #374151;
    font-size: 0.875rem;
}

.chemicals-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.chemical-tag {
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.treatment-prevention h6 {
    margin: 0 0 0.5rem;
    color: #374151;
    font-size: 0.875rem;
}

.treatment-prevention ul {
    margin: 0;
    padding-left: 1.25rem;
    color: #6b7280;
}

.treatment-prevention li {
    margin-bottom: 0.25rem;
}

/* Probabilidades */
.all-probabilities h4 {
    margin-bottom: 1rem;
    color: #374151;
}

.probability-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.probability-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.75rem;
}

.probability-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.probability-info .disease-name {
    font-weight: 600;
    color: #374151;
}

.probability-info .probability-value {
    color: #6b7280;
    font-size: 0.875rem;
}

.probability-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.probability-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    transition: width 0.5s ease;
}

/* Acciones de resultado */
.result-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

/* Historial */
.detection-history h3 {
    margin-bottom: 1rem;
    color: #111827;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.history-filters {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.history-filters select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.history-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.history-info {
    flex: 1;
}

.history-disease {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.history-date {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.history-confidence {
    font-size: 0.875rem;
    color: #6b7280;
}

.no-history {
    text-align: center;
    color: #6b7280;
    padding: 2rem;
}

/* Panel satelital */
.satellite-panel {
    padding: 2rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.satellite-panel h3 {
    margin-bottom: 1.5rem;
    color: #111827;
}

.satellite-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.parcel-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.parcel-selector label {
    font-weight: 600;
    color: #374151;
}

.satellite-controls {
    margin-top: 1rem;
}

.satellite-results {
    grid-column: 1 / -1;
}

.satellite-result-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
}

.satellite-result-card h4 {
    margin-bottom: 1rem;
    color: #111827;
}

.satellite-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 4px;
}

.stat-label {
    font-weight: 600;
    color: #374151;
}

.stat-value {
    color: #111827;
}

.satellite-map {
    height: 300px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.map-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.map-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Estado vacío */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin: 0 0 0.5rem;
    color: #374151;
}

.empty-state p {
    margin: 0;
}

/* Botones */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-info {
    background: #06b6d4;
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: #0891b2;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Formulario */
.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Responsive */
@media (max-width: 1024px) {
    .detection-main {
        grid-template-columns: 1fr;
    }

    .image-panel {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .satellite-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .detection-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .header-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .image-panel,
    .results-panel {
        padding: 1rem;
    }

    .main-result {
        flex-direction: column;
        text-align: center;
    }

    .treatment-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .result-actions {
        flex-direction: column;
    }

    .history-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .history-filters {
        justify-content: center;
    }

    .history-item {
        flex-direction: column;
        text-align: center;
    }
}