/* Verbesserte Molekül-Container für klare Trennung */
.molecule-container {
    display: flex;
    gap: 20px;
    margin: 20px 0 60px 0; /* Erhöhter Abstand nach unten */
    flex-wrap: wrap;
    justify-content: center;
    position: relative;
    width: 100%;
    clear: both;
}

.molecule-item {
    border: 1px solid #ccc;
    padding: 15px 15px 55px 15px; /* Erhöhter Padding am unteren Rand für Button */
    border-radius: 5px;
    background-color: #f9f9f9;
    width: 250px;
    min-height: 300px;
    text-align: center;
    position: relative; /* Wichtig für Button-Positionierung */
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px; /* Abstand zwischen Items */
}

/* Überarbeitete Button-Gestaltung */
.btn-toggle {
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 8px 15px;
    min-width: 150px;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    
    /* Bessere Positionierung innerhalb des Containers */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 15px;
    z-index: 10;
    
    /* Übergang für Hover-Effekt */
    transition: background-color 0.3s;
}

.btn-toggle:hover {
    background-color: #45a049;
}

/* Canvas-Stile mit konstanten Größen */
.view-2d, .view-3d {
    width: 200px;
    height: 200px;
    margin: 0 auto 15px auto;
    display: block;
}

.view-3d {
    display: none; /* 3D-Ansicht standardmäßig ausblenden */
}

/* Verbesserte Molekül-Modelle Sektion */
.molecule-models {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin: 30px 0 60px 0; /* Erhöhter Abstand nach unten */
    gap: 20px;
    width: 100%;
    clear: both;
}

.molecule-model {
    text-align: center;
    margin: 15px;
    padding: 15px 15px 55px 15px; /* Erhöhter Padding am unteren Rand für Button */
    background-color: #f5f5f5;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 220px;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.molecule-model h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1em;
    width: 100%;
}

/* Verbesserte Nomenklatur-Beispiele */
.nomenklatur-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    margin: 20px 0 40px 0; /* Verbesserter vertikaler Abstand */
    width: 100%;
}

.nomenklatur-example {
    margin: 10px;
    padding: 15px;
    background-color: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 240px;
    text-align: center;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative; /* Falls Buttons hinzugefügt werden */
}

/* Verbesserte Canvas-Container */
.canvas-container {
    width: 100%;
    position: relative;
    margin-bottom: 25px;
    clear: both;
}

/* Clearfix Helper */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Optimiertes Responsive Design */
@media (max-width: 768px) {
    .molecule-container {
        flex-direction: column;
        align-items: center;
        margin-bottom: 40px;
    }
    
    .molecule-item, 
    .molecule-model,
    .nomenklatur-example {
        width: 90%;
        max-width: 300px;
        margin-bottom: 30px; /* Erhöhter Abstand für bessere Lesbarkeit */
    }
    
    .btn-toggle {
        position: absolute;
        bottom: 10px;
        width: 80%;
        min-width: unset;
    }
    
    .molecule-models {
        flex-direction: column;
        align-items: center;
        margin-bottom: 40px;
    }
    
    /* Kleinere Canvas-Größe auf mobilen Geräten */
    .view-2d, .view-3d {
        width: 180px;
        height: 180px;
    }
    
    /* Kleinere Mindesthöhen bei mobilen Geräten */
    .molecule-item {
        min-height: 260px;
    }
    
    .molecule-model {
        min-height: 240px;
    }
    
    /* Verbesserte Ausrichtung von Tabellen */
    table {
        display: block;
        overflow-x: auto;
        width: 100%;
    }
    
    /* Anpassungen für den Quiz-Bereich */
    .quiz-molecule {
        max-width: 100%;
        overflow-x: auto;
    }
    
    .quiz-options label {
        display: block;
        margin-bottom: 10px;
    }
}

/* Extra Anpassungen für sehr kleine Bildschirme */
@media (max-width: 480px) {
    .view-2d, .view-3d {
        width: 160px;
        height: 160px;
    }
    
    .molecule-item,
    .molecule-model,
    .nomenklatur-example {
        padding: 10px 10px 50px 10px;
    }
    
    .btn-toggle {
        font-size: 13px;
        padding: 7px 12px;
    }
}
/* Verbesserte Container-Struktur */
.molecule-container, 
.molecule-models, 
.nomenklatur-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 20px 0 40px 0;
    position: relative;
    width: 100%;
    clear: both;
}

.molecule-container::after,
.molecule-models::after,
.nomenklatur-examples::after {
    content: "";
    display: table;
    clear: both;
}

/* Verbesserte Item-Container */
.molecule-item, 
.molecule-model,
.nomenklatur-example {
    position: relative;
    padding-bottom: 60px !important; /* Raum für Button */
    margin-bottom: 20px;
}

/* Verbesserte Button-Positionierung */
.btn-toggle {
    position: absolute !important;
    bottom: 15px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 100 !important;
    background-color: #4CAF50 !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    padding: 8px 15px !important;
    min-width: 150px !important;
}

/* Explizite Canvas-Größen */
.view-2d, .view-3d {
    display: block !important;
    margin: 0 auto 10px auto !important;
}

.view-3d {
    display: none !important; /* Standardmäßig ausgeblendet */
}

/* Für mobile Geräte */
@media (max-width: 768px) {
    .molecule-container, 
    .molecule-models, 
    .nomenklatur-examples {
        flex-direction: column;
        align-items: center;
    }
    
    .molecule-item, 
    .molecule-model,
    .nomenklatur-example {
        width: 90% !important;
        max-width: 300px !important;
    }
    
    .btn-toggle {
        width: 80% !important;
        min-width: unset !important;
    }
    
    /* Anpassungen für kleine Canvas */
    .view-2d, .view-3d {
        width: 180px !important;
        height: 180px !important;
    }
}

/* Für sehr kleine Bildschirme */
@media (max-width: 480px) {
    .view-2d, .view-3d {
        width: 160px !important;
        height: 160px !important;
    }
    
    .molecule-item, 
    .molecule-model,
    .nomenklatur-example {
        padding: 10px 10px 60px 10px !important;
    }
}

/* Clearfix-Helfer */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}
