* {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: #F2F0EB;
    padding: 20px 0;
    overflow-x: hidden;
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 40px;
}

.logo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.logo-header img {
    height: 32px;
}

/* SCHEMA BUILDER STYLES */
.schema-builder {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    min-height: 600px;
}

.palette {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.palette-section {
    margin-bottom: 25px;
}

.palette-title {
    font-weight: 600;
    font-size: 14px;
    color: #0D0D0D;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.block-template {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.block-template:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.block-template.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.block-template.circuito {
    background: #e7f3ff;
    border-color: #007AFF;
}

.block-template.compensatore {
    background: #fff3cd;
    border-color: #FFA500;
}

.block-template.accumulo {
    background: #d1ecf1;
    border-color: #17a2b8;
}

.block-template.generatore {
    background: #ffe0e0;
    border-color: #C93800;
}

.block-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.canvas-container {
    background: white;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    position: relative;
    min-height: 600px;
    overflow: hidden;
}

.canvas-container.drag-over {
    background: #f0f9f4;
    border-color: #57AD06;
}

.canvas-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #6c757d;
    pointer-events: none;
}

.canvas-hint.hidden {
    display: none;
}

.schema-block {
    position: absolute;
    min-width: 180px;
    padding: 15px;
    border-radius: 8px;
    cursor: move;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.2s;
    border: 2px solid;
    z-index: 10;
}

.schema-block:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.schema-block.selected {
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

.schema-block.circuito {
    background: #e7f3ff;
    border-color: #007AFF;
}

.schema-block.compensatore {
    background: #fff3cd;
    border-color: #FFA500;
}

.schema-block.accumulo {
    background: #d1ecf1;
    border-color: #17a2b8;
}

.schema-block.generatore {
    background: #ffe0e0;
    border-color: #C93800;
}

.block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.block-type {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.block-actions {
    display: flex;
    gap: 4px;
}

.block-action-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

.block-action-btn:hover {
    background: rgba(0, 0, 0, 0.2);
}

.block-action-btn.delete:hover {
    background: #C93800;
    color: white;
}

.block-name {
    font-size: 14px;
    color: #0D0D0D;
    margin-bottom: 8px;
}

.block-connections {
    font-size: 11px;
    color: #6c757d;
}

.connection-point {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    position: absolute;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.connection-point::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
}

.connection-point.input {
    background: #57AD06;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
}

.connection-point.output {
    background: #C93800;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
}

.connection-point:hover {
    width: 20px;
    height: 20px;
    box-shadow: 0 0 12px currentColor;
}

.connection-point.input:hover {
    box-shadow: 0 0 12px #57AD06;
}

.connection-point.output:hover {
    box-shadow: 0 0 12px #C93800;
}

.connection-line {
    position: absolute;
    pointer-events: none;
}

.toolbar {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.validation-panel {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
}

.validation-panel.valid {
    background: #f0f9f4;
    border: 2px solid #57AD06;
}

.validation-panel.invalid {
    background: #ffe0e0;
    border: 2px solid #C93800;
}

.validation-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.validation-item:last-child {
    margin-bottom: 0;
}

.validation-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.validation-icon.valid {
    background: #57AD06;
    color: white;
}

.validation-icon.invalid {
    background: #C93800;
    color: white;
}

svg.connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-temp {
    stroke: #007AFF;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
    fill: none;
    opacity: 0.6;
}

.connection-permanent {
    stroke: #0D0D0D;
    stroke-width: 2;
    fill: none;
    marker-end: url(#arrowhead);
}

/* END SCHEMA BUILDER STYLES */

.step-indicator {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.step-number {
    display: inline-block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #007AFF;
    color: white;
    text-align: center;
    line-height: 30px;
    font-size: 14px;
    font-weight: bold;
}

.btn-primary {
    background-color: #007AFF;
    border: none;
}

.btn-primary:hover {
    background-color: #0056d4;
}

.btn-success {
    background-color: #57AD06;
    border: none;
}

.btn-success:hover {
    background-color: #459105;
}

.btn-outline-secondary {
    color: #0D0D0D;
    border-color: #0D0D0D;
}

.btn-outline-secondary:hover {
    background-color: #0D0D0D;
    border-color: #0D0D0D;
    color: white;
}

.module-badge {
    display: inline-block;
    padding: 8px 16px;
    margin: 5px;
    border-radius: 20px;
    background: #e7f3ff;
    color: #007AFF;
    font-weight: 500;
}

.config-card {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.config-card:hover {
    background: #F2F0EB;
    border-color: #007AFF;
}

.config-card.latest {
    border-color: #57AD06;
    background: #f0f9f4;
}

.hidden {
    display: none !important;
}

.question-section {
    margin: 30px 0;
}

.item-card {
    border-left: 4px solid #007AFF;
    padding: 15px;
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 4px;
    position: relative;
}

.item-card.terminale {
    border-left-color: #007AFF;
}

.item-card.termostato {
    border-left-color: #57AD06;
}

.item-card.compensatore {
    border-left-color: #FFA500;
}

.item-card.generatore {
    border-left-color: #C93800;
}

.item-card .item-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #C93800;
    cursor: pointer;
    font-size: 18px;
}

.item-card .item-remove:hover {
    color: #a02d00;
}

.navigation-buttons {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-complete {
    background: #57AD06;
}

.status-partial {
    background: #FFA500;
}

.status-missing {
    background: #C93800;
}

.riepilogo-item {
    padding: 15px;
    border-radius: 6px;
    background: white;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #dee2e6;
}

.riepilogo-item:hover {
    border-color: #007AFF;
    box-shadow: 0 2px 4px rgba(0, 122, 255, 0.1);
}

.delete-btn {
    color: #C93800;
    cursor: pointer;
    margin-left: 10px;
    font-size: 18px;
}

.delete-btn:hover {
    color: #a02d00;
}

.add-item-btn {
    border: 2px dashed #007AFF;
    color: #007AFF;
    background: transparent;
    padding: 12px;
    border-radius: 6px;
    width: 100%;
    margin-top: 15px;
    cursor: pointer;
    font-weight: 500;
}

.add-item-btn:hover {
    background: #e7f3ff;
}

.device-list-item {
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.device-list-item:hover {
    background: #f8f9fa;
    border-color: #007AFF;
}

.io-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin: 15px 0;
}

.io-channel {
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.io-channel.available {
    background: #f0f9f4;
    border-color: #57AD06;
}

.io-channel.available:hover {
    background: #57AD06;
    color: white;
}

.io-channel.used {
    background: #ffe0e0;
    border-color: #C93800;
    cursor: not-allowed;
    opacity: 0.6;
}

.io-channel.selected {
    background: #007AFF;
    color: white;
    border-color: #0056d4;
}

.io-channel.interlock {
    background: #fff3cd;
    border-color: #FFA500;
}

.io-section {
    margin-bottom: 20px;
}

.io-section-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #0D0D0D;
}

.app-footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
    text-align: center;
    font-size: 12px;
    color: #6c757d;
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.cursor-pointer {
    cursor: pointer;
}

/* MODE SELECTION TILES */
.mode-selection-container {
    padding: 20px;
    background: #fdfdfd;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.mode-tile {
    cursor: pointer;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    padding: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.mode-tile:hover {
    border-color: #dee2e6;
    transform: translateY(-2px);
}

.mode-tile i {
    font-size: 1.4rem;
    transition: transform 0.3s ease;
}

.mode-tile .mode-name {
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

/* Caldo State */
.btn-check:checked+.mode-tile.caldo {
    border-color: #FFA500;
    background: rgba(255, 165, 0, 0.05);
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.15);
}

.btn-check:checked+.mode-tile.caldo i {
    color: #FFA500;
    transform: scale(1.1);
}

.btn-check:checked+.mode-tile.caldo .mode-name {
    color: #FFA500;
}

/* Freddo State */
.btn-check:checked+.mode-tile.freddo {
    border-color: #007AFF;
    background: rgba(0, 122, 255, 0.05);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}

.btn-check:checked+.mode-tile.freddo i {
    color: #007AFF;
    transform: scale(1.1);
}

.btn-check:checked+.mode-tile.freddo .mode-name {
    color: #007AFF;
}

.mode-tile::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    opacity: 0.3;
}

.btn-check:checked+.mode-tile::after {
    background: currentColor;
    opacity: 1;
}