/* Reset general y Modo Oscuro */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; }
body { background-color: #000; color: #e0e0e0; overflow: hidden; }

/* NUEVA ESTRUCTURA DE PANTALLA (Invertida) */
.app-container {
    display: grid;
    grid-template-columns: 300px 1fr 240px; /* Resultados | Imagen | Herramientas */
    height: 100vh;
    width: 100vw;
}

/* Paneles laterales */
.sidebar, .results-panel {
    background-color: #1a1a1a;
    padding: 20px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    z-index: 10;
}

.sidebar h2, .results-panel h2 { color: #3498db; font-size: 1.2rem; text-align: center; margin-bottom: 5px;}
hr { border: 0; border-top: 1px solid #444; }
.tool-section h3 { font-size: 0.75rem; color: #888; text-transform: uppercase; margin-top: 10px; }

/* Botones con colores */
button {
    width: 100%; padding: 12px; cursor: pointer;
    background: #2c2c2c; color: #fff;
    border: 1px solid #444; border-radius: 6px;
    font-size: 0.9rem; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
button:hover { background: #3d3d3d; border-color: #3498db; }
button.active-tool { background: #3498db; color: #fff; border-color: #2980b9; }

#btn-calibrate { border-left: 5px solid #e74c3c; }
#btn-line { border-left: 5px solid #2ecc71; }
#btn-angle { border-left: 5px solid #3498db; }
#btn-angle-v2 { border-left: 5px solid #f1c40f; }
#btn-roi { border-left: 5px solid #9b59b6; }
#btn-circle { border-left: 5px solid #e67e22; }
#btn-pan { border-left: 5px solid #95a5a6; }
#btn-fit { border-left: 5px solid #95a5a6; }
#btn-undo { color: #e74c3c; margin-top: 10px;}

.action-btn { background: #27ae60 !important; font-weight: bold; border: none !important; }
.action-btn:hover { background: #2ecc71 !important; }

.upload-label {
    display: block; background: #3498db; color: white;
    padding: 12px; text-align: center; border-radius: 6px;
    cursor: pointer; font-weight: bold; transition: background 0.2s;
}
.upload-label:hover { background: #2980b9; }

.instructions { background: #262626; padding: 10px; border-radius: 4px; margin-top: auto; border: 1px solid #333;}
.instructions p { color: #aaa; margin-bottom: 4px; }

/* Área central de la radiografía */
.workspace {
    background-color: #000;
    display: flex; justify-content: center; align-items: center;
    overflow: hidden; position: relative;
}
canvas { box-shadow: 0 0 50px rgba(0,0,0,0.8); }

/* Items de resultados (Izquierda) */
.result-item {
    background: #262626; border-radius: 6px;
    padding: 15px; margin-bottom: 12px;
    border-left: 4px solid #3498db;
    border: 1px solid #333;
}
.result-item strong { color: #2ecc71; font-size: 1.1rem; display: block; margin-bottom: 5px; }
.result-item small { color: #aaa; }

.empty-msg { text-align: center; color: #666; margin-top: 50px; font-style: italic; }

/* ESTILOS PARA LA VENTANA DE RECORTE (MODAL) */
.modal {
    display: none; /* Oculta por defecto */
    position: fixed; z-index: 100; left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.85); /* Fondo muy oscuro */
    backdrop-filter: blur(5px); /* Desenfoque de fondo */
    align-items: center; justify-content: center;
}
.modal-content {
    background-color: #1a1a1a; padding: 25px;
    border-radius: 10px; border: 1px solid #444;
    width: 90%; max-width: 800px;
    max-height: 90vh; overflow: hidden;
    display: flex; flex-direction: column; gap: 15px;
}
.modal-content h3 { color: #3498db; text-align: center; }
.img-container {
    max-height: 60vh; overflow: hidden;
    background: #000; border: 2px solid #333;
}
#imageToCrop { max-width: 100%; } /* Necesario para Cropper.js */
.modal-buttons { display: flex; gap: 15px; justify-content: flex-end; margin-top: 10px; }
.cancel-btn { background: #c0392b !important; border: none !important; }
.cancel-btn:hover { background: #e74c3c !important; }
/* Encabezado Profesional */
.app-header {
    background: linear-gradient(90deg, #1a1a1a 0%, #2c3e50 100%);
    padding: 10px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #3498db;
    height: 60px;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo h1 { font-size: 1.5rem; color: #fff; letter-spacing: 1px; }
.logo h1 span { color: #3498db; font-weight: 300; }
.logo .icon { font-size: 1.8rem; }
.subtitle { color: #888; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 2px; }

/* Ajuste del contenedor para el nuevo header */
.app-container {
    height: calc(100vh - 60px); /* Restamos la altura del header */
}