@import url('https://fonts.googleapis.com/css2?family=Noto+Serif:ital,wght@0,400;0,700;1,400&display=swap');

#ve-mb-nha-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 0;
    padding-bottom: 0;
    background: linear-gradient(to bottom, #f0f0f0, #d9e4f5);
    font-family: 'Noto Serif', serif;
    box-sizing: border-box;
    width: 100%;
    max-width: 600px;
    z-index: 100;
}

#ve-mb-nha-section .back-btn,
#ve-mb-nha-section .action-btn {
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 6px 8px;
    font-size: 14px;
    border-radius: 4px;
    font-family: 'Noto Serif', serif;
    transition: background-color 0.3s;
    margin: 4px;
    width: 80px;
    text-align: center;
}

#ve-mb-nha-section .back-btn:hover,
#ve-mb-nha-section .action-btn:hover {
    background-color: #45a049;
}

#ve-mb-nha-section .back-btn:active,
#ve-mb-nha-section .action-btn:active {
    transform: scale(0.95);
}


/* Ensure the canvas container sticks to the top on mobile */
#ve-mb-nha-section #canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    background-color: #f0f0f0; /* Background to make the canvas distinct */
    box-sizing: border-box;
    z-index: 1001;
}

/* Canvas styling */
#ve-mb-nha-section #ve-mb-nha-floorplan {
    display: block;
    border: 1px solid #2c3e50;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    background-color: transparent;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    z-index: 1002;
}

#ve-mb-nha-section #controls {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 4px;
    margin: 8px 0;
    width: 92.5%;
    max-width: 600px;
}

#ve-mb-nha-section #top-controls {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 4px;
    margin: 8px 0;
    padding: 4px 0;
    width: 92.5%;
    max-width: 600px;
    overflow-x: auto;
}

#ve-mb-nha-section .input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 4px;
    min-width: 60px;
}

#ve-mb-nha-section .input-group label {
    font-size: 13px;
    color: #2c3e50;
    margin-bottom: 4px;
    text-align: center;
}

#ve-mb-nha-section .input-group select,
#ve-mb-nha-section .input-group input[type="number"],
#ve-mb-nha-section .input-group input[type="range"] {
    padding: 5px;
    font-size: 13px;
    border: 1px solid #34495e;
    border-radius: 4px;
    background-color: #ecf0f1;
    font-family: 'Noto Serif', serif;
    width: 80px;
    box-sizing: border-box;
}

#ve-mb-nha-section .input-group input[type="checkbox"] {
    margin-top: 4px;
}

#ve-mb-nha-section #edgeInputsContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
    width: 100%;
    padding: 0 2px;
    justify-content: space-between;
}

#ve-mb-nha-section .edge-input-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex: 1 1 100%;
    max-width: 100%;
    margin: 4px 0;
}

#ve-mb-nha-section .edge-input-group label {
    font-size: 13px;
    color: #2c3e50;
    min-width: 60px;
    text-align: left;
}

#ve-mb-nha-section .edge-input-group input[type="range"] {
    flex: 1;
    min-width: 100px;
    max-width: 200px;
    padding: 4px;
    font-size: 13px;
    border: 1px solid #34495e;
    border-radius: 4px;
    background-color: #ecf0f1;
    font-family: 'Noto Serif', serif;
}

#ve-mb-nha-section .edge-input-group input[type="number"] {
    width: 30px;
    padding: 4px;
    font-size: 13px;
    border: 1px solid #34495e;
    border-radius: 4px;
    background-color: #ecf0f1;
    font-family: 'Noto Serif', serif;
    text-align: center;
}
#ve-mb-nha-section #controls .edge-btn {
    /* Giữ nguyên phần bố cục gốc */
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px;
    font-size: 14px;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 4px;
    font-family: 'Noto Serif', serif;
    
    /* Nâng cấp hệ thống màu */
    --btn-color: #e67e22;
    --btn-hover: #d35400;
    --shadow-intensity: 0.4;
    
    background-color: var(--btn-color);
    color: white;
    border: none;
    cursor: pointer;
    
    /* Hiệu ứng shadow nâng cấp */
    box-shadow: 
        0 0.15em 0.3em rgba(0, 0, 0, calc(var(--shadow-intensity) - 0.1)),
        0 0.25em 0.5em rgba(0, 0, 0, var(--shadow-intensity)),
        inset 0.05em 0.1em 0.1em rgba(255, 255, 255, 0.7),
        inset -0.05em -0.1em 0.1em rgba(0, 0, 0, 0.2);
    
    /* Hiệu ứng chuyển động mượt hơn */
    transition: 
        background-color 0.3s ease,
        transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.3s ease;
    
    /* Tối ưu hiển thị */
    will-change: transform, box-shadow;
    transform-style: preserve-3d;
}

#ve-mb-nha-section #controls .edge-btn:hover {
    background-color: var(--btn-hover);
    box-shadow: 
        0 0.2em 0.4em rgba(0, 0, 0, calc(var(--shadow-intensity) - 0.05)),
        0 0.35em 0.7em rgba(0, 0, 0, var(--shadow-intensity)),
        inset 0.07em 0.14em 0.14em rgba(255, 255, 255, 0.8),
        inset -0.07em -0.14em 0.14em rgba(0, 0, 0, 0.25);
}

#ve-mb-nha-section #controls .edge-btn:active {
    transform: scale(0.95) translateY(0.1em);
    box-shadow: 
        0 0.1em 0.2em rgba(0, 0, 0, calc(var(--shadow-intensity) - 0.15)),
        0 0.15em 0.3em rgba(0, 0, 0, var(--shadow-intensity)),
        inset 0.03em 0.06em 0.06em rgba(255, 255, 255, 0.6),
        inset -0.03em -0.06em 0.06em rgba(0, 0, 0, 0.3);
}

#ve-mb-nha-section .highlight {
    border: 2px solid red;
}

#ve-mb-nha-section h2,
#ve-mb-nha-section p {
    color: #2c3e80;
    text-align: center;
    font-family: 'Noto Serif', serif;
    margin: 8px 0;
}
#ve-mb-nha-section .controls label {
  margin-right: 10px;
  font-size: 14px;
  color: #2c3e50;
}

#ve-mb-nha-section .controls input[type="checkbox"] {
  margin-right: 5px;
  vertical-align: middle;
}

@media (max-width: 600px) {
    #ve-mb-nha-section {
        padding: 0;
        padding-bottom: 15px;
    }

    #ve-mb-nha-section .back-btn,
    #ve-mb-nha-section .action-btn {
        font-size: 13px;
        padding: 4px 6px;
        width: 60px;
    }

    #ve-mb-nha-section .input-group label,
    #ve-mb-nha-section .edge-input-group label {
        font-size: 12px;
    }

    #ve-mb-nha-section .input-group select,
    #ve-mb-nha-section .input-group input[type="number"],
    #ve-mb-nha-section .input-group input[type="range"] {
        font-size: 12px;
        padding: 4px;
        width: 70px;
    }

    #ve-mb-nha-section .edge-input-group {
        flex-direction: row;
        gap: 2px;
    }

    #ve-mb-nha-section .edge-input-group label {
        font-size: 12px;
        min-width: 50px;
    }

    #ve-mb-nha-section .edge-input-group input[type="range"] {
        min-width: 150px;
        max-width: 200px;
        padding: 3px;
    }

    #ve-mb-nha-section .edge-input-group input[type="number"] {
        width: 30px;
        font-size: 12px;
        padding: 3px;
    }

    #ve-mb-nha-section #controls .edge-btn {
        font-size: 13px;
        padding: 6px;
        min-width: calc(25% - 9px);
    }

    /* Fix typo: change #canvas-container to #canvas-container */
    #ve-mb-nha-section #canvas-container {
        position: sticky;
        top: 0;
        background-color: #f0f0f0;
        z-index: 1000;
        width: 100%;
        margin: 0;
        padding: 0px 0px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    #ve-mb-nha-section #canvas-container.sticky-active {
        background-color: #e0e0e0; /* Slightly darker when sticky */
        border-bottom: 2px solid #2c3e50; /* Visual indicator */
    }

    #ve-mb-nha-section #ve-mb-nha-floorplan {
        border: 1px solid #2c3e50;
        max-width: 100%;
    }

    #ve-mb-nha-section #top-controls,
    #ve-mb-nha-section #controls {
        position: relative;
        z-index: 10;
        margin: 8px 8px;
        padding: 0 8px;
    }

}

@media (max-width: 360px) {
    #ve-mb-nha-section {
        padding: 0;
        padding-bottom: 15px;
    }

    #ve-mb-nha-section .back-btn,
    #ve-mb-nha-section .action-btn {
        font-size: 12px;
        padding: 4px 6px;
        width: 50px;
    }

    #ve-mb-nha-section .input-group label,
    #ve-mb-nha-section .edge-input-group label {
        font-size: 11px;
    }

    #ve-mb-nha-section .input-group select,
    #ve-mb-nha-section .input-group input[type="number"],
    #ve-mb-nha-section .input-group input[type="range"] {
        font-size: 11px;
        padding: 3px;
        width: 60px;
    }

    #ve-mb-nha-section .edge-input-group {
        flex-direction: row;
        gap: 2px;
    }

    #ve-mb-nha-section .edge-input-group label {
        font-size: 11px;
        min-width: 40px;
    }

    #ve-mb-nha-section .edge-input-group input[type="range"] {
        min-width: 90px;
        max-width: 120px;
        padding: 2px;
    }

    #ve-mb-nha-section .edge-input-group input[type="number"] {
        width: 30px;
        font-size: 11px;
        padding: 2px;
    }

    #ve-mb-nha-section #controls .edge-btn {
        font-size: 12px;
        padding: 6px 4px;
        min-width: calc(25% - 6px);
    }

    #ve-mb-nha-section #canvas-container {
        position: sticky;
        top: 0;
        background-color: #f0f0f0;
        z-index: 1000;
        width: 100%;
        margin: 0;
        padding: 0px 0px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    #ve-mb-nha-section #canvas-container.sticky-active {
        background-color: #e0e0e0;
        border-bottom: 2px solid #2c3e50;
    }

    #ve-mb-nha-section #top-controls,
    #ve-mb-nha-section #controls {
        gap: 4px;
        margin: 8px 0;
    }
}
