/* styles.css - Versión con espaciado unificado y barra lateral más estrecha */
body { 
    margin: 0; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    overflow: hidden;
    transition: background 0.5s ease;
}

body.fondo-oscuro {
    background: #1a202c;
}

body.fondo-gris {
    background: #f5f5f5;
}

.container {
    display: flex;
    height: 100vh;
    transition: all 0.3s ease;
}

.form-container {
    width: 230px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 30px rgba(0,0,0,0.2);
    overflow-y: auto;
    overflow-x: hidden;                    /* ← AÑADIR */
    -webkit-overflow-scrolling: touch;     /* ← AÑADIR */
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.3);
}

.form-container.hidden {
    transform: translateX(-100%);
    opacity: 0;
    width: 0;
    padding: 0;
    overflow: hidden;
}

.canvas-container {
    flex: 1;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    min-width: 0;
}

canvas { 
    display: block;
    /* ELIMINAR width: 100% !important; */
    /* ELIMINAR height: 100% !important; */
}

.form-group {
    margin-bottom: 10px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2d3748;
    font-size: 13px;
}

input, select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 13px;
    transition: all 0.2s ease;
    background: white;
}

input:focus, select:focus {
    outline: none;
    border-color: #4299e1;
        box-shadow: none;
}

/* ================== ESTILOS UNIFICADOS PARA TODOS LOS BOTONES ================== */
button {
    padding: 10px;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    width: 100%;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

button:hover {
    filter: brightness(0.85);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

button.fondo-activo,
button.perspectiva-activa,
button.vista-activa {
    box-shadow: none !important;
    transform: translateY(-1px);
}

button {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

button.toggle,
.dxf-btn,
.stl-btn {
    background: linear-gradient(135deg, #0bc5ea, #00b5d8);
}

.guardar-btn,
.cargar-btn {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
}

button.fondo-btn,
.capturar-btn {
    background: linear-gradient(135deg, #9f7aea, #805ad5);
}

.info-btn {
    background: linear-gradient(135deg, #9f7aea, #805ad5);
}

/* Reset button - Verde como los botones toggle */
.reset-btn {
    background: linear-gradient(135deg, #48bb78, #38a169) !important;
}

/* Para cuando está en button-group */
.button-group .reset-btn {
    margin-bottom: 0;
    background: linear-gradient(135deg, #48bb78, #38a169) !important;
}

.separador-botones {
    width: 100%;
    height: 1px;
    background-color: #e2e8f0;
    border: none;
    margin: 10px 0;
}

.button-group,
.fondo-group,
.perspectiva-group,
.vistas-group,
.botones-final-group {
    margin-bottom: 8px;
}

.button-group {
    display: flex;
    gap: 6px;
}

.button-group button {
    margin-bottom: 0;
}

.fondo-group,
.perspectiva-group,
.vistas-group {
    display: grid;
    gap: 6px;
}

.fondo-group,
.perspectiva-group {
    grid-template-columns: 1fr 1fr;
}

.vistas-group {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.fondo-group button,
.perspectiva-group button,
.vistas-group button {
    margin-bottom: 0;
}

.botones-final-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.fila-doble {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.fila-simple {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.fila-doble button,
.fila-simple button {
    margin-bottom: 0;
}

/* ================== BOTÓN TOGGLE DE LA BARRA LATERAL ================== */
.toggle-sidebar {
    background: #48bb78;
    position: fixed;
    top: 80px;
    left: 230px;  /* Valor inicial, JS lo actualizará */
    width: 18px;
    height: 70px;
    border-radius: 0 20px 20px 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease, width 0.2s ease, background 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-left: none;
    backdrop-filter: blur(5px);
    opacity: 0.8;
}

.toggle-sidebar:hover {
    opacity: 1;
    width: 24px;
    background: #38a169;
}

.toggle-sidebar.sidebar-hidden {
    left: 0;
    opacity: 0.9;
}

.toggle-icon {
    color: white;
    font-weight: bold;
    font-size: 16px;
    transition: transform 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.toggle-sidebar.sidebar-hidden .toggle-icon {
    transform: rotate(180deg);
}


/* ================== RESTO DE ESTILOS ================== */
.info {
    position: absolute;
    top: 15px;
    left: 15px;
    color: white;
    background: rgba(0,0,0,0.8);
    padding: 15px;
    border-radius: 10px;
    font-family: 'Segoe UI', sans-serif;
    z-index: 100;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    display: none;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
}

.info.visible {
    display: block;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.info-title {
    margin: 0;
    font-size: 16px;
}

.close-info {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.close-info:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.info-content {
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}

.info-content::-webkit-scrollbar {
    width: 6px;
}

.info-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin: 5px 0;
}

.info-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.info-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.info-padding-bottom {
    padding-bottom: 20px;
}

.info-section {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.info-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #fff;
    border-left: 3px solid #4299e1;
    padding-left: 8px;
}

.info-section p {
    margin: 5px 0;
    font-size: 13px;
}

.info-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.controls-section {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.logo-container {
    text-align: center;
    margin-bottom: 15px;
    padding: 0 10px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: white;
    padding: 20px;
    text-align: center;
}

.modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-body {
    padding: 25px;
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
    color: #4a5568;
}

.modal-footer {
    padding: 0 25px 25px;
    display: flex;
    justify-content: center;
}

.modal-btn {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(66, 153, 225, 0.3);
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
}

.tabla-materiales {
    width: 100%;
    margin-top: 15px;
    margin-bottom: 50px;
    border-collapse: collapse;
    font-size: 12px;
}

.tabla-materiales th {
    background: rgba(255,255,255,0.2);
    padding: 6px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.3);
}

.tabla-materiales td {
    padding: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    text-align: center;
}

.tabla-materiales tr:nth-child(even) {
    background: rgba(255,255,255,0.1);
}

/* ================== ESTILOS PARA ACORDEONES ================== */

.acordeon {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border-radius: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #4299e1;
    overflow: hidden;
    transition: all 0.4s ease;
}

.acordeon-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
}

.acordeon-header:hover {
    background-color: rgba(66, 153, 225, 0.1);
}

.acordeon.activo .acordeon-header {
    background-color: rgba(98, 159, 209, 0.1);
}

.acordeon-titulo {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.acordeon-titulo h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #000000;
    text-align: left;
    flex-grow: 1;
}

.acordeon-icono {
    font-size: 10px;
    color: #718096;
    transition: transform 0.2s ease;
    margin-left: 8px;
}

.acordeon.activo .acordeon-icono {
    transform: rotate(180deg);
}

.acordeon-contenido {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.2s ease;
    padding: 0 12px;
}

.acordeon.activo .acordeon-contenido {
    max-height: 2000px;
    padding: 0 12px 12px 12px;
}

.titulo-punto {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.titulo-punto.verde {
    background-color: #48bb78;
}

.titulo-punto.azul {
    background-color: #4299e1;
}

.acordeon .form-group {
    margin-bottom: 10px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.acordeon.activo .form-group {
    opacity: 1;
    transform: translateY(0);
}

.acordeon .form-group:last-child {
    margin-bottom: 0;
}

/* ================== ESTILOS UNIFICADOS PARA CHECKBOXES ================== */

.checkbox-contenido-fusionado {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    padding: 6px 0;
    position: relative;
    min-height: 32px;
}

.acordeon-visibilidad .checkbox-contenido-fusionado {
    border-bottom: none;
    margin-bottom: 0;
    padding: 3px 0;
}

.acordeon-cotas .checkbox-contenido-fusionado {
    margin-bottom: 2px;
    padding: 3px 0;
}

.acordeon-cotas .checkbox-contenido-fusionado:last-child {
    margin-bottom: 0;
}

.checkbox-geometria {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 2px solid #4299e1;
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-geometria.activo {
    background-color: #4299e1;
}

.checkbox-geometria.activo::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 10px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.checkbox-geometria:hover {
    transform: scale(1.1);
    box-shadow: 0 0 4px rgba(66, 153, 225, 0.5);
}

.checkbox-label {
    margin: 0 0 0 8px;
    font-weight: 600;
    color: #2d3748;
    cursor: pointer;
    flex-grow: 1;
    font-size: 12px;
    user-select: none;
}

/* ================== ESTILOS PARA SELECTORES DE COLOR ================== */

.color-selector-fusionado {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    margin-left: 8px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.color-selector-fusionado.visible {
    opacity: 0.6;
    transform: scale(1);
    pointer-events: auto;
}

.color-selector-fusionado.visible:hover {
    border-color: #4299e1;
    transform: scale(1.05);
    opacity: 1;
}

.color-preview-fusionado {
    width: 100%;
    height: 100%;
    border-radius: 2px;
    transition: transform 0.2s ease;
}

.color-selector-fusionado.visible:hover .color-preview-fusionado {
    transform: scale(1.05);
}

.color-input-fusionado {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

/* ================== ESTILOS PARA COTAS ================== */

.cota-opciones {
    flex-shrink: 0;
    margin-left: 6px;
    display: none;
    min-width: 70px;
}

.checkbox-contenido-fusionado.cota-activa .cota-opciones {
    display: block;
}

.cota-opciones select {
    font-size: 10px;
    padding: 3px 5px;
    height: 24px;
    width: auto;
    max-width: 75px;
    min-width: 65px;
    border-radius: 3px;
    border: 1px solid #e2e8f0;
    background-color: white;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.cota-opciones select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.1);
}

.checkbox-contenido-fusionado.cota-activa .checkbox-geometria {
    background-color: #4299e1 !important;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3) !important;
}

.checkbox-contenido-fusionado.cota-activa .checkbox-geometria::after {
    content: '✓' !important;
    position: absolute;
    color: white;
    font-size: 9px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ================== ESTILOS PARA CONTROL DE TEXTO DE COTAS ================== */

.cota-texto-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 8px 0;
    border-top: 1px solid #e2e8f0;
}

.cota-texto-titulo {
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
}

.cota-texto-botones {
    display: flex;
    gap: 5px;
}

.cota-texto-btn {
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: linear-gradient(135deg, #a0aec0, #718096) !important;
    border-radius: 5px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px !important;
    font-weight: bold !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
}

.cota-texto-btn:hover {
    background: linear-gradient(135deg, #718096, #4a5568) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

.cota-texto-btn:active {
    transform: translateY(0) !important;
}

/* ================== ESTILOS PARA TÍTULOS DE CATEGORÍA EN "VER OBJETOS" ================== */

.visibilidad-categoria-titulo {
    font-size: 14px;
    font-weight: 700;
    color: #2d3748;
    margin-top: 8px;
    margin-bottom: 6px;
    text-align: left;
    padding-left: 0;
    padding-bottom: 4px;
    width: 100%;
}

.visibilidad-categoria-separador {
    height: 1px;
    background: linear-gradient(90deg, #4299e1, #cbd5e0);
    margin-bottom: 8px;
    border: none;
    width: 100%;
    border-radius: 1px;
    opacity: 0.7;
}

.acordeon-contenido .visibilidad-categoria-titulo:first-child {
    margin-top: 4px;
}

/* Responsive adjustments */
/* ================== ESTILOS RESPONSIVOS PARA MÓVILES ================== */
@media (max-width: 767px) {
    .form-container:not(.hidden) {
        width: 280px;
        padding: 12px;
    }
    
    .toggle-sidebar {
        width: 22px;
        height: 80px;
        border-radius: 0 25px 25px 0;
    }
    
    .toggle-sidebar:hover {
        width: 28px;
    }
    
    .canvas-container {
        width: 100%;
    }
}

body.fondo-oscuro .info {
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.fondo-gris .info {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ================== PANEL FLOTANTE SUPERIOR DERECHO ================== */
.panel-flotante {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 10px 14px;
    z-index: 99;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 160px;
    transition: background 0.3s ease;
}

.panel-flotante-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    gap: 12px;
}

.panel-flotante-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.panel-flotante-valor {
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

/* Ajuste para fondo oscuro */
body.fondo-oscuro .panel-flotante {
    background: rgba(0, 0, 0, 0.75);
    border-color: rgba(255, 255, 255, 0.2);
}

body.fondo-gris .panel-flotante {
    background: rgba(30, 30, 30, 0.7);
    border-color: rgba(255, 255, 255, 0.12);
}

/* ================== TÍTULO DEL PANEL FLOTANTE ================== */
.panel-flotante-titulo {
    text-align: center;
    color: #ffb32b;
    font-size: 13px;
    font-weight: 700;
    padding-bottom: 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 179, 43, 0.3);
    letter-spacing: 0.5px;
}

/* ================== ESTILOS RESPONSIVOS PARA MÓVILES ================== */
@media (max-width: 767px) {
    .form-container {
        width: 0;                /* Oculto por defecto en móviles */
        padding: 0;
        overflow: hidden;
    }
    
    .form-container:not(.hidden) {
        width: 280px;            /* Un poco más ancho que en desktop */
        padding: 12px;
    }
    
    .toggle-sidebar {
        width: 22px;             /* Botón más grande para tocar */
        height: 80px;
        border-radius: 0 25px 25px 0;
    }
    
    .toggle-sidebar:hover {
        width: 28px;
    }
    
    .canvas-container {
        width: 100%;
    }
}