/* Reset y variables CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores principales */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #64748b;
    --accent: #f59e0b;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #8b5cf6;
    
    /* Colores de fondo */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-muted: #f1f5f9;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    /* Colores de texto */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    
    /* Colores de borde */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-dark: #94a3b8;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --gradient-secondary: linear-gradient(135deg, #f59e0b, #ef4444);
    --gradient-bg: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Transiciones */
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
}


/* Variables específicas del analizador para no colisionar con el tema WP */
.roof-analyzer-wrapper {
    --primary: #3b82f6;
    --bg-primary: #ffffff;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.roof-analyzer-wrapper .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

#canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #e2e8f0;
    cursor: crosshair;
}
/* Agrega aquí el resto de tus estilos del archivo original */

/* Estilos base */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--gradient-bg);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.icon-solar {
    width: 3rem;
    height: 3rem;
    background: var(--gradient-secondary);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-white);
    box-shadow: var(--shadow-md);
}

.header-title {
    font-size: 3rem;
    font-weight: bold;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.header-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 48rem;
    margin: 0 auto;
}

/* Upload Section */
.upload-section {
    max-width: 32rem;
    margin: 0 auto 2rem;
}

.upload-area {
    border: 2px dashed var(--border-medium);
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-primary);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: var(--bg-secondary);
    transform: scale(1.02);
}

.upload-content .upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.upload-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-content p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.upload-formats {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Status Bar */
.status-bar {
    background: var(--bg-primary);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
}

.status-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Analysis Section */
.analysis-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.controls-bar {
    display: flex;
    justify-content: center;
}

.analysis-grid {
    display: grid;
    grid-template-columns: 7fr 3fr; /* 70% canvas, 30% results */
    gap: 2rem;
}

@media (max-width: 1024px) {
    .analysis-grid {
        grid-template-columns: 1fr;
    }
}

/* Canvas Area */
.canvas-area {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

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

.canvas-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

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

/* Image Controls */
.image-controls {
    background: var(--bg-muted);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

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

.canvas-container {
    border: 2px solid var(--border-light);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#canvas {
    max-width: 100%;
    height: auto;
    cursor: crosshair;
}

/* Perspective Controls */
.perspective-controls {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.perspective-info {
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 500;
    color: var(--info);
}

.perspective-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Line Controls */
.line-controls {
    background: var(--bg-muted);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.line-info {
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.slider-container {
    margin-bottom: 1rem;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.slider-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.angle-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.angle-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.angle-slider::-webkit-slider-thumb:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.angle-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.angle-slider::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
}

.angle-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Angle Measurement Controls */
.angle-measurement-controls {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

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

.measurement-header h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.angle-results {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.angle-result-item {
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: 0.375rem;
    border-left: 3px solid var(--success);
    font-size: 0.875rem;
}

.angle-value {
    font-weight: 600;
    color: var(--success);
}

.canvas-tip {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Results Panel */
.results-panel {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    height: fit-content;
    
}

.results-panel {
    max-width: 100%; /* para evitar que se desborde si el grid cambia */
    width: 100%;
}


.results-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.results-content {
    min-height: 200px;
}

.results-placeholder {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 1rem;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-item {
    padding: 1rem;
    border-radius: 0.5rem;
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.result-item:hover {
    background: var(--bg-muted);
    transform: translateX(2px);
}

.result-item.selected {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.result-item h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.result-details {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.result-angle {
    font-weight: 600;
    color: var(--primary);
}

.result-efficiency {
    font-weight: 500;
}

.result-category {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.category-optimal {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.category-good {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.category-poor {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.recommendations {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
}

.recommendations h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.recommendations ul {
    list-style: none;
    padding: 0;
}

.recommendations li {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

.recommendations li:before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Instructions */
.instructions {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(16, 185, 129, 0.1));
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
    margin-bottom: 2rem;
}

.instructions h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.instruction-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.instruction-group p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.instruction-group strong {
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary);
    color: var(--text-white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    box-shadow: var(--shadow-sm);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

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

.btn-icon {
    font-size: 1rem;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
    color: var(--text-secondary);
}

/* Perspective corner markers */
.perspective-corner {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--info);
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.perspective-corner:hover {
    background: var(--primary);
    transform: scale(1.2);
}

.perspective-corner.dragging {
    cursor: grabbing;
    background: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header-title {
        font-size: 2rem;
    }
    
    .header-subtitle {
        font-size: 1rem;
    }
    
    .canvas-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .canvas-controls {
        justify-content: center;
    }
    
    .instructions-grid {
        grid-template-columns: 1fr;
    }
    
    .measurement-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rotation-controls {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 1.75rem;
    }
    
    .canvas-controls {
        flex-direction: column;
    }
    
    .angle-controls {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
}