body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
}

.modulo-impresion3d .container {
    display: flex;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    box-sizing: border-box;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modulo-impresion3d aside.sidebar {
    flex: 1 1 320px;
    max-width: 320px;
    padding: 25px;
    box-sizing: border-box;
    background-color: #e9f0f7;
    border-radius: 12px;
    margin-right: 30px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

.modulo-impresion3d aside.sidebar .form-group {
    margin-bottom: 20px;
}

.modulo-impresion3d aside.sidebar label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a3e5c;
}

.modulo-impresion3d aside.sidebar select,
.modulo-impresion3d aside.sidebar button {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1.5px solid #a3b8d1;
    border-radius: 6px;
    background-color: #ffffff;
    color: #1a3e5c;
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.modulo-impresion3d aside.sidebar select:focus,
.modulo-impresion3d aside.sidebar button:focus {
    outline: none;
    border-color: #0077be;
    box-shadow: 0 0 8px rgba(0, 119, 190, 0.4);
}

#startPrint {
    background-color: #0077be;
    color: white;
    font-weight: 600;
    border-color: #0077be;
}

#startPrint:hover {
    background-color: #005f8a;
    border-color: #005f8a;
}

.modulo-impresion3d main.content {
    flex: 2 1 650px;
    max-width: 650px;
    padding: 25px;
    box-sizing: border-box;
    background-color: #f0f4f8;
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

#viewer {
    width: 100%;
    min-height: 450px;
    height: 450px;
    border: 2px solid #0077be;
    border-radius: 12px;
    background-color: #e0e4ea;
    box-shadow: 0 4px 8px rgba(0, 119, 190, 0.2);
    position: relative;
    overflow: hidden;
}

#viewer canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    background: transparent;
    z-index: 1;
}

#info table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#info td {
    padding: 10px 8px;
    font-size: 1rem;
    color: #1a3e5c;
}

#info strong {
    color: #005f8a;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s, display 0.3s;
    opacity: 0;
}

.notification.show {
    display: block;
    opacity: 1;
}

.notification.error {
    background-color: #d32f2f;
}

.notification.success {
    background-color: #388e3c;
}

.notification.info {
    background-color: #1976d2;
}

@media (max-width: 768px) {
    .modulo-impresion3d .container {
        flex-direction: column;
        max-width: 100%;
        padding: 15px;
    }

    .modulo-impresion3d aside.sidebar,
    .modulo-impresion3d main.content {
        max-width: 100%;
        margin-right: 0;
        margin-bottom: 25px;
    }

    #viewer {
        height: 300px;
    }
}

.material-selector-wrapper button {
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.material-popup {
    display: none;
    position: absolute;
    z-index: 1000;
    background-color: #fff;
    border: 1px solid #a3b8d1;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px;
}

.material-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.material-popup-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

#closeMaterialPopup {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    position: relative;
    border-radius: 50%;
    transition: background-color 0.2s ease-in-out;
}

#closeMaterialPopup:hover {
    background-color: #e9e9e9;
}

#closeMaterialPopup::before,
#closeMaterialPopup::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 2px;
    background-color: #555;
}

#closeMaterialPopup::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

#closeMaterialPopup::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.material-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 5px;
}

.material-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.material-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.material-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 3px;
}

.material-item span {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #333;
}

.material-group {
    flex: 1 1 250px;
}

.material-group-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #f0f0f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.material-items-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
}

.material-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.material-item:hover {
    background-color: #f5f5f5;
}

.material-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 8px;
    border: 1px solid #ddd;
}

.material-item span {
    font-size: 0.85em;
    text-align: center;
    max-width: 80px;
    word-wrap: break-word;
}