/* ===== PONTEGO.CH - SISTEMA PROFESSIONALE PONTEGGI ===== */
/* File: public/css/pontego-app.css */

/* ===== CSS VARIABLES ===== */
:root {
    --primary-color: #dc3545;
    --primary-dark: #c82333;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    
    --grid-color: #e9ecef;
    --snap-color: #28a745;
    --border-color: #dee2e6;
    
    --sidebar-width: 320px;
    --toolbar-height: 60px;
    --status-bar-height: 40px;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.2);
    
    --transition-fast: 0.2s;
    --transition-normal: 0.3s;
    
    --font-size-sm: 0.85rem;
    --font-size-base: 0.9rem;
    --font-size-lg: 1.1rem;
}

/* ===== GLOBAL STYLES ===== */
body {
    background-color: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.app-container {
    display: flex;
    min-height: calc(100vh - 56px);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    height: calc(100vh - 56px);
    position: relative;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 600;
}

.sidebar-header small {
    opacity: 0.9;
    font-size: var(--font-size-sm);
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--grid-color);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: 15px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-section h3 i {
    color: var(--primary-color);
    font-size: 1rem;
}

/* ===== MAIN AREA ===== */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--light-color);
    min-width: 0;
}

/* ===== TOOLBAR ===== */
.toolbar {
    background: white;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.tool-group {
    display: flex;
    gap: 5px;
    padding: 0 10px;
    border-right: 1px solid var(--border-color);
    align-items: center;
}

.tool-group:last-child {
    border-right: none;
}

.tool-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: var(--font-size-base);
    color: var(--dark-color);
}

.tool-btn:hover {
    background: var(--light-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.tool-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.tool-btn i {
    font-size: 1rem;
}

/* ===== CANVAS CONTAINER ===== */
.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: 
        radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.02) 100%),
        var(--light-color);
}

#mainCanvas {
    background: white;
    cursor: crosshair;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: var(--shadow-md);
    border-radius: 4px;
}

/* ===== STATUS BAR ===== */
.status-bar {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-base);
    min-height: var(--status-bar-height);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-item i {
    color: var(--secondary-color);
}

/* ===== SCAFFOLD TYPE SELECTOR ===== */
.scaffold-type-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scaffold-type {
    border: 2px solid var(--grid-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: white;
}

.scaffold-type:hover {
    border-color: var(--info-color);
    background: #e3f2fd;
    transform: translateX(5px);
}

.scaffold-type.selected {
    border-color: var(--info-color);
    background: #e3f2fd;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.2);
}

.scaffold-type h5 {
    font-size: 0.95rem;
    margin: 0 0 5px 0;
    color: #495057;
    font-weight: 600;
}

.scaffold-type small {
    color: var(--secondary-color);
    font-size: var(--font-size-sm);
}

/* ===== MEASUREMENTS DISPLAY ===== */
.measurements {
    background: var(--light-color);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--grid-color);
}

.measurement-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--grid-color);
}

.measurement-item:last-child {
    border-bottom: none;
}

.measurement-label {
    color: var(--secondary-color);
    font-size: var(--font-size-base);
}

.measurement-value {
    font-weight: 600;
    color: #495057;
    font-size: var(--font-size-base);
}

/* ===== FACADE LIST ===== */
.facade-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px;
}

.facade-list::-webkit-scrollbar {
    width: 6px;
}

.facade-list::-webkit-scrollbar-track {
    background: var(--light-color);
    border-radius: 3px;
}

.facade-list::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 3px;
}

.facade-list::-webkit-scrollbar-thumb:hover {
    background: #495057;
}

.facade-item {
    background: var(--light-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--grid-color);
    transition: all var(--transition-fast);
}

.facade-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
    transform: translateX(5px);
}

.facade-info {
    flex: 1;
}

.facade-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
    font-size: var(--font-size-base);
}

.facade-details {
    font-size: var(--font-size-sm);
    color: var(--secondary-color);
}

.badge {
    display: inline-block;
    padding: 0.25em 0.4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.badge.bg-warning {
    background-color: var(--warning-color) !important;
    color: #212529;
}

/* ===== ZOOM CONTROLS ===== */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.zoom-btn {
    padding: 10px 15px;
    border: none;
    background: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--grid-color);
    color: var(--secondary-color);
}

.zoom-btn:last-child {
    border-bottom: none;
}

.zoom-btn:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

.zoom-btn:active {
    background: var(--grid-color);
}

/* ===== HELP TIPS ===== */
.help-tip {
    background: #ffeaa7;
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
    font-size: var(--font-size-sm);
    color: #795548;
    border: 1px solid #fdcb6e;
}

.help-tip i {
    color: #f39c12;
    margin-right: 8px;
}

/* ===== HEIGHT EDITOR MODAL ===== */
.height-editor-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 0;
    z-index: 1000;
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    display: none;
    overflow: hidden;
}

/* ===== VISUAL HEIGHT EDITOR ===== */
/* DEBUG: Editor visivo caricato - {{ date('Y-m-d H:i:s') }} */
.visual-height-editor {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Header */
.editor-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.header-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.header-content h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.3rem;
    font-weight: 700;
}

.header-content p {
    margin: 5px 0 0 0;
    color: #718096;
    font-size: 0.9rem;
}

/* Canvas container */
.facade-canvas-container {
    position: relative;
    margin: 20px auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 2px solid #e9ecef;
    /* Centra il container */
    width: fit-content;
    text-align: center;
}

#facadeCanvas {
    width: 100%;
    height: auto;
    border-radius: 6px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Linee draggabili */
.drag-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #667eea;
    cursor: ew-resize;
    z-index: 10;
    transition: background-color 0.2s;
}

.drag-line:hover {
    background: #5a67d8;
    width: 3px;
}

.drag-line.dragging {
    background: #4c51bf;
    width: 4px;
}

.line-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #667eea;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: ew-resize;
}

.measure-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Sezioni */
.sections-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
    /* Allineamento perfetto con il canvas */
    width: 800px;
    height: 400px;
    margin: 0 auto;
}

.section-area {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.08);
    pointer-events: none;
    /* Allineamento perfetto con il canvas */
    box-sizing: border-box;
}

.section-label {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(102, 126, 234, 0.7);
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Controlli sezioni */
.sections-controls {
    margin-top: 20px;
}

.section-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.section-input-group {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.section-info {
    flex: 1;
}

.section-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.section-measure {
    font-size: 0.9rem;
    color: #718096;
}

.height-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.height-input-group label {
    font-weight: 500;
    color: #4a5568;
    white-space: nowrap;
}

.height-input-group input {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.height-input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.height-input-group .unit {
    color: #718096;
    font-weight: 500;
}

/* Istruzioni */
.instructions {
    margin-top: 20px;
    padding: 15px;
    background: #e6fffa;
    border: 1px solid #81e6d9;
    border-radius: 8px;
}

.instructions p {
    margin: 0;
    color: #2c7a7b;
    font-size: 0.9rem;
}

.instructions i {
    margin-right: 8px;
}

/* Pulsanti azione */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.action-buttons .btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-buttons .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.action-buttons .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.action-buttons .btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.action-buttons .btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

/* Modal per altezze - GRANDE E CENTRATO - {{ date('Y-m-d H:i:s') }} */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

.height-editor-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background-color: #fefefe;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    /* DEBUG: Bordo rosso per vedere se è centrato */
    border: 5px solid #ff0000 !important;
}

.height-editor-modal.show {
    display: block !important;
}

.modal-overlay.show {
    display: block !important;
}



#heightEditorModal .close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 32px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#heightEditorModal .close:hover {
    color: #000;
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

/* Header con gradiente */
.editor-header {
    background: rgba(255,255,255,0.95);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.header-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.header-content h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.4rem;
    font-weight: 700;
}

.header-content p {
    margin: 5px 0 0 0;
    color: #718096;
    font-size: 0.9rem;
}

.current-height-display {
    margin-left: auto;
    text-align: center;
}

.height-number {
    font-size: 2.5rem;
    font-weight: 900;
    color: #667eea;
    display: block;
    line-height: 1;
}

.height-unit {
    font-size: 1rem;
    color: #718096;
    font-weight: 500;
}

/* Contenuto principale */
.modern-height-editor > div:not(.editor-header) {
    background: white;
    margin: 15px;
    border-radius: 12px;
    padding: 20px;
}

/* Slider moderno */
.slider-section {
    margin-top: 0 !important;
}

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

.slider-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 1rem;
}

.slider-value {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.modern-slider {
    position: relative;
    margin: 20px 0;
}

.range-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: transparent;
    outline: none;
    -webkit-appearance: none;
    position: relative;
    z-index: 2;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    border: 3px solid white;
}

.slider-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    z-index: 1;
}

.slider-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.slider-minmax {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #718096;
    margin-top: 10px;
}

/* Cards per altezze rapide */
.quick-height-section h4 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-weight: 600;
}

.height-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.height-card {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.height-card:hover {
    border-color: #667eea;
    background: #edf2f7;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.card-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
}

.card-label {
    font-size: 0.8rem;
    color: #718096;
}

/* Input moderno */
.exact-height-section h4 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-weight: 600;
}

.modern-input-group {
    display: flex;
    align-items: center;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 5px;
    transition: border-color 0.3s ease;
}

.modern-input-group:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modern-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 15px;
    font-size: 1rem;
    color: #2d3748;
    outline: none;
}

.input-suffix {
    padding: 12px 15px;
    color: #718096;
    font-weight: 500;
    background: #edf2f7;
    border-radius: 8px;
    margin-right: 5px;
}

/* Preview moderno */
.preview-section h4 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-weight: 600;
}

.modern-preview {
    display: flex;
    align-items: center;
    gap: 20px;
}

.building-preview {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.building-base {
    width: 80px;
    height: 8px;
    background: #4a5568;
    border-radius: 4px;
}

.building-facade {
    width: 60px;
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e0 100%);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
    min-height: 12px;
    position: relative;
}

.building-facade::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 8px,
        rgba(0,0,0,0.1) 8px,
        rgba(0,0,0,0.1) 10px
    );
    border-radius: 4px 4px 0 0;
}

.building-roof {
    width: 70px;
    height: 6px;
    background: #2d3748;
    border-radius: 2px;
}

.preview-info {
    flex: 1;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 8px;
}

.info-label {
    color: #718096;
    font-weight: 500;
}

.info-value {
    color: #2d3748;
    font-weight: 600;
}

.height-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.height-header h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1.2rem;
}

.current-height {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.height-slider-section {
    margin-bottom: 25px;
}

.height-slider-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.height-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

.height-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.height-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.8rem;
    color: #6c757d;
}

.quick-buttons {
    margin-bottom: 25px;
}

.quick-buttons label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.quick-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.quick-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.numeric-input {
    margin-bottom: 25px;
}

.numeric-input label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.height-input {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    font-size: 1rem;
}

.unit {
    color: #6c757d;
    font-weight: 500;
}

.facade-preview {
    text-align: center;
}

.facade-preview label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.preview-container {
    display: inline-block;
}

.facade-bar {
    width: 40px;
    background: var(--primary-color);
    border-radius: 4px;
    margin: 0 auto;
    transition: height 0.3s ease;
    min-height: 16px;
}

.facade-label {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

.height-slider-container {
    text-align: center;
    margin-bottom: 20px;
}

.height-display {
    margin-top: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.height-display small {
    font-size: 0.8rem;
    color: #6c757d;
    margin-left: 5px;
}

.height-preview-simple {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.facade-preview {
    width: 60px;
    margin: 0 auto;
    background: var(--primary-color);
    border-radius: 4px;
    position: relative;
    transition: height 0.3s ease;
    min-height: 20px;
}

.facade-label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: #6c757d;
    white-space: nowrap;
}

.height-editor-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.height-editor-header h5 {
    margin: 0;
    font-size: 1.1rem;
}

.btn-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.btn-close:hover {
    opacity: 1;
}

.height-editor-body {
    padding: 20px;
    max-height: calc(80vh - 120px);
    overflow-y: auto;
}

.height-section {
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    position: relative;
}

.height-section:hover {
    box-shadow: var(--shadow-sm);
}

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

.height-section-title {
    font-weight: 600;
    color: #495057;
    font-size: var(--font-size-base);
}

.height-section-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.height-input-group {
    display: flex;
    flex-direction: column;
}

.height-input-group label {
    font-size: var(--font-size-sm);
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.height-input-group input {
    padding: 5px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: var(--font-size-base);
    transition: border-color var(--transition-fast);
}

.height-input-group input:focus {
    outline: none;
    border-color: var(--info-color);
    box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.25);
}

.height-input-group input[readonly] {
    background-color: var(--light-color);
    cursor: not-allowed;
}

.btn-remove-section {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    font-size: 0.8rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.btn-remove-section:hover {
    background: var(--primary-dark);
}

.height-editor-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--light-color);
}

/* Modalità Editor Altezze */
.height-mode {
    transition: all var(--transition-normal);
}

.btn-group-vertical {
    display: flex;
    flex-direction: column;
}

.btn-group-vertical .btn {
    border-radius: 0;
    margin-bottom: 5px;
}

.btn-group-vertical .btn:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.btn-group-vertical .btn:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    margin-bottom: 0;
}

.visual-editor-container {
    text-align: center;
}

.visual-editor-container canvas {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.visual-editor-container canvas:hover {
    box-shadow: var(--shadow-sm);
}

/* Slider personalizzati */
.form-range {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    outline: none;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-range::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.form-range::-moz-range-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.height-preview {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 150px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    backdrop-filter: blur(2px);
}

/* ===== 3D VIEW CONTAINER ===== */
#view3DContainer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: none;
    z-index: 100;
}

#view3DCanvas {
    width: 100%;
    height: 100%;
}

.view3d-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: var(--shadow-md);
    z-index: 101;
    min-width: 150px;
}

.view3d-controls h6 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: var(--font-size-base);
    display: flex;
    align-items: center;
    gap: 8px;
}

.view3d-controls .btn {
    display: block;
    width: 100%;
    margin-bottom: 5px;
    padding: 6px 10px;
    font-size: var(--font-size-sm);
}

.view3d-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: var(--shadow-md);
    z-index: 101;
}

.view3d-info p {
    margin: 0 0 5px 0;
    font-size: var(--font-size-base);
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.view3d-info p:last-child {
    margin-bottom: 0;
}

/* ===== SCAFFOLD MANUAL STYLES ===== */
.scaffold-stats {
    background: var(--light-color);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    border: 1px solid var(--grid-color);
}

.scaffold-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: var(--font-size-base);
}

.scaffold-stat-item span:first-child {
    color: var(--secondary-color);
}

.scaffold-stat-item span:last-child {
    font-weight: 600;
    color: #495057;
}

/* ===== CAMPATE OPTIONS POPUP ===== */
#campateOptions {
    position: absolute;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 400px;
    max-width: 500px;
}

/* ===== ERROR & LOADING STATES ===== */
.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin: 10px;
    display: none;
    font-size: var(--font-size-base);
}

.error-message i {
    margin-right: 8px;
}

.loading-spinner {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading-spinner i {
    font-size: 2em;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.loading-spinner p {
    margin-top: 10px;
    color: var(--secondary-color);
    font-size: var(--font-size-base);
}

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

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-base);
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    color: white;
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-success {
    color: white;
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-danger {
    color: white;
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-danger:hover {
    background-color: var(--primary-dark);
    border-color: #bd2130;
}

.btn-outline-primary {
    color: var(--primary-color);
    background-color: transparent;
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    color: white;
    background-color: var(--primary-color);
}

.btn-outline-secondary {
    color: var(--secondary-color);
    background-color: transparent;
    border-color: var(--secondary-color);
}

.btn-outline-secondary:hover {
    color: white;
    background-color: var(--secondary-color);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-sm);
    border-radius: 0.2rem;
}

.btn-group {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.btn-group > .btn {
    position: relative;
    flex: 1 1 auto;
}

.btn-group > .btn:not(:first-child) {
    margin-left: -1px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.btn-group > .btn:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* ===== FORM CONTROLS ===== */
.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: white;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    color: #495057;
    background-color: white;
    border-color: var(--info-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.25);
}

.form-select {
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

.form-select-sm {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    padding-left: 0.5rem;
    font-size: var(--font-size-sm);
    border-radius: 0.2rem;
}

.form-label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: #495057;
}

textarea.form-control {
    min-height: calc(1.5em + 0.75rem + 2px);
}

/* ===== UTILITIES ===== */
.mb-3 {
    margin-bottom: 1rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.d-grid {
    display: grid !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

.d-flex {
    display: flex !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.text-muted {
    color: var(--secondary-color) !important;
}

.w-100 {
    width: 100% !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 50vh;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tool-group {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px;
        justify-content: center;
    }
    
    .zoom-controls {
        bottom: 60px;
    }
}

@media (max-width: 576px) {
    .sidebar-header h1 {
        font-size: 1.2rem;
    }
    
    .height-editor-modal {
        width: 95vw;
        max-height: 90vh;
    }
    
    .height-section-inputs {
        grid-template-columns: 1fr;
    }
    
    #campateOptions {
        min-width: 95vw;
        left: 2.5vw !important;
        right: 2.5vw !important;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar,
    .toolbar,
    .status-bar,
    .zoom-controls,
    .view3d-controls,
    .view3d-info {
        display: none !important;
    }
    
    .main-area {
        width: 100%;
    }
    
    #mainCanvas {
        position: static;
        transform: none;
        box-shadow: none;
        margin: 0 auto;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--info-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn,
    .form-control,
    .form-select {
        border-width: 2px;
    }
    
    .sidebar-section,
    .facade-item,
    .height-section {
        border-width: 2px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #495057;
}

/* ===== DEBUG MODE ===== */
body.debug-mode #mainCanvas {
    border: 2px dashed red;
}

body.debug-mode .status-bar::after {
    content: " | DEBUG MODE";
    color: var(--danger-color);
    font-weight: bold;
}

/* ===== APP READY STATE ===== */
body:not(.app-ready) .app-container {
    opacity: 0;
}

body.app-ready .app-container {
    animation: fadeIn 0.5s ease-in-out;
    opacity: 1;
}