/* 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 Properties-Beispiele */
.properties-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    margin: 20px 0 40px 0; /* Verbesserter vertikaler Abstand */
    width: 100%;
}

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

/* Spezielle Styling für Reaktionsbeispiele */
.reaction-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 20px 0 40px 0;
    width: 100%;
}

.reaction-item {
    margin: 15px;
    padding: 15px 15px 55px 15px;
    background-color: #f8fff8;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 320px;
    text-align: center;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Styling für Wasserstoffbrücken-Hervorhebung */
.h-bonds-highlight {
    border: 2px dashed #2196F3;
    border-radius: 8px;
    padding: 5px;
    margin: 5px 0;
    display: inline-block;
}

/* Styling für Experimental-Abschnitte */
.experimental-section {
    background-color: #f5f8ff;
    border-radius: 10px;
    padding: 20px;
    margin: 30px 0;
    border: 1px solid #dde4f0;
}

.experimental-section h3 {
    color: #1565C0;
    margin-top: 0;
}

/* Styling für die pKs-Tabelle */
.pks-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.pks-table th, .pks-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: center;
}

.pks-table th {
    background-color: #4CAF50;
    color: white;
}

.pks-table tr:nth-child(even) {
    background-color: #f5f5f5;
}

.pks-table tr:hover {
    background-color: #e9f7e9;
}

/* Styling für die Leitfähigkeits-Demonstration */
.conductivity-demo {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f0f8ff;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.demo-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
}

/* Styling für die Säure-Base-Reaktions-Animation */
.reaction-animation {
    position: relative;
    width: 100%;
    height: 300px;
    background-color: #f9f9f9;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

/* Verbesserte Canvas-Container */
.canvas-container {
    width: 100%;
    position: relative;
    margin-bottom: 25px;
    clear: both;
    overflow: visible; /* Wichtig: Damit Tooltips nicht abgeschnitten werden */
}

/* Neue Styles für Siedepunkt-Visualisierung */
.canvas-container canvas#siedepunkt-canvas {
    max-width: 100%;
    height: auto;
}

/* Verbesserte Controls-Container */
.controls-container {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* Verbesserte Formularelemente */
.form-control {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 200px;
}

/* CTA-Buttons im Siedepunkt-Chart */
.cta-button {
    padding: 8px 16px;
    background-color: #1a3a6d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.cta-button:hover {
    background-color: #255cb3;
}

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

/* Info-Box Styling */
.info-box {
    background-color: #e3f2fd;
    border-left: 5px solid #2196F3;
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

.info-box h4 {
    margin-top: 0;
    color: #0d47a1;
}

/* Wichtig-Box Styling */
.important-box {
    background-color: #ffebee;
    border-left: 5px solid #f44336;
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

.important-box h4 {
    margin-top: 0;
    color: #b71c1c;
}

/* Optimiertes Responsive Design */
@media (max-width: 768px) {
    .molecule-container, 
    .properties-examples,
    .reaction-examples {
        flex-direction: column;
        align-items: center;
        margin-bottom: 40px;
    }
    
    .molecule-item, 
    .molecule-model,
    .property-example,
    .reaction-item {
        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;
    }
    
    /* Anpassungen für Siedepunkt-Visualisierung */
    .canvas-container {
        overflow-x: auto;
        padding-bottom: 20px;
    }
    
    canvas#siedepunkt-canvas {
        min-width: 800px; /* Mindestbreite für mobile Ansicht */
    }
    
    .controls-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-control, .cta-button {
        width: 100%;
        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,
    .property-example,
    .reaction-item {
        padding: 10px 10px 50px 10px;
    }
    
    .btn-toggle {
        font-size: 13px;
        padding: 7px 12px;
    }
}

/* Verbesserte Container-Struktur */
.molecule-container, 
.molecule-models, 
.properties-examples,
.reaction-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,
.properties-examples::after,
.reaction-examples::after {
    content: "";
    display: table;
    clear: both;
}

/* Verbesserte Item-Container */
.molecule-item, 
.molecule-model,
.property-example,
.reaction-item {
    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 */
}

/* Spezielle Stile für die Siedepunkt-Diagramme */
.boiling-point-chart {
    width: 100%;
    max-width: 700px;
    margin: 20px auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    background-color: #fff;
}

/* Stile für die Dimere-Sektion */
.dimers-section {
    background-color: #f0f9ff;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
    border: 1px solid #c2e0ff;
}

.dimers-illustration {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
}

/* Stile für die Leitfähigkeits-Visualisierung */
.conductivity-visualization {
    background-color: #f0f0f0;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    min-height: 300px;
    position: relative;
}

/* Für mobile Geräte */
@media (max-width: 768px) {
    .molecule-container, 
    .molecule-models, 
    .properties-examples,
    .reaction-examples {
        flex-direction: column;
        align-items: center;
    }
    
    .molecule-item, 
    .molecule-model,
    .property-example,
    .reaction-item {
        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,
    .property-example,
    .reaction-item {
        padding: 10px 10px 60px 10px !important;
    }
}

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

/* Stilregeln für den Bildplatzhalter des Ethansäure-Dimers */
.image-placeholder {
    text-align: center;
    margin: 15px auto;
    max-width: 100%;
}

.dimer-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.image-caption {
    font-style: italic;
    margin-top: 10px;
    color: #666;
    font-size: 0.9em;
}

/* Verbesserte Darstellung der Reaktionsgleichungen */
.reaction-item {
    margin: 15px;
    padding: 15px;
    background-color: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 45%;
    min-width: 300px;
    text-align: center;
    float: left;
}

.reaction-item h3 {
    margin-top: 0;
    color: #1976d2;
    font-size: 1.2em;
}

.reaction-item .formula {
    margin: 20px 0;
    font-size: 1.2em;
}

/* Responsive Anpassungen */
@media (max-width: 768px) {
    .reaction-item {
        width: 100%;
        float: none;
        margin: 15px 0;
    }
}

.molecule-container {
    margin-bottom: 60px; /* Vergrößert den Abstand nach unten */
}

/* Styling für die Leitfähigkeitsanimation */
.demo-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.demo-controls .cta-button {
    padding: 10px 15px;
    font-size: 14px;
}

.canvas-container {
    margin: 20px auto;
    max-width: 100%;
    overflow: hidden;
}

#leitfaehigkeit-canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}
