/* Container für gesamten Versuch */
#federpendel-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    min-height: 600px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Hauptbereich mit Pendel */
#pendel-bereich {
    position: relative;
    width: 100%;
    height: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Lineal / Skala */
#lineal {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 35px;
    width: 70px;
    background: linear-gradient(90deg, #fffdf5 0%, #f6ecd2 50%, #fffdf5 100%);
    border: 2px solid #c8b897;
    border-radius: 10px;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: stretch;
    justify-content: center;
    z-index: 1;
    pointer-events: none;
}

.lineal-body {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 0;
}

#lineal-skala {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.lineal-tick {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    color: #5a4d3a;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.lineal-tick::before {
    content: '';
    display: block;
    height: 1px;
    border-radius: 1px;
    background: currentColor;
    opacity: 0.7;
    margin-left: 10px;
    margin-right: 6px;
}

.lineal-tick.major::before {
    width: 26px;
    height: 2px;
    opacity: 0.9;
}

.lineal-tick.minor::before {
    width: 16px;
}

.lineal-label {
    margin-left: auto;
    margin-right: 8px;
}

#lineal-marker {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: #e53935;
    border-radius: 4px;
    box-shadow: 0 0 6px rgba(229, 57, 53, 0.6);
    transform: translateY(-50%);
}

/* Auslenkungslabel neben der Kugel */
#auslenkung-label {
    position: absolute;
    padding: 0.3rem 0.6rem;
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid #e53935;
    border-radius: 8px;
    color: #e53935;
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-50%);
    pointer-events: none;
    min-width: 70px;
    text-align: center;
    z-index: 6;
}

/* Halterung */
#halterung {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 30px;
    z-index: 10;
}

.halterung-balken {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #666 0%, #444 100%);
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Feder Container */
#feder-container {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(var(--feder-offset, 0px));
    width: 40px;
    height: var(--feder-laenge, 200px);
    will-change: height; /* Optimierung für Animation */
}

#feder-svg {
    width: 100%;
    height: 100%;
    overflow: visible; /* Sicherstellen, dass die ganze Feder sichtbar ist */
}

/* Gewicht */
#gewicht {
    position: absolute;
    top: var(--gewicht-position, 230px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    will-change: top; /* Optimierung für Animation */
}

.gewicht-koerper {
    width: 80px;
    height: 80px;
    background: var(--gewicht-farbe, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), inset 0 -2px 5px rgba(0, 0, 0, 0.2);
    position: relative;
    background-size: 100% 100%;
}

.gewicht-koerper::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 10px;
    background: #444;
    border-radius: 2px;
}

#gewicht-anzeige {
    color: white;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Entfernte CSS-Animationen - wird jetzt durch JavaScript gesteuert */
/* Die Animation wird nun vollständig durch JavaScript mit RequestAnimationFrame
   gesteuert für eine realistischere physikalische Simulation */

#gewicht {
    transition: none; /* Keine CSS-Transitions für flüssige Animation */
}

#feder-container {
    transition: none; /* Keine CSS-Transitions für flüssige Animation */
}

/* Steuerungsbereich */
#steuerung,
#steuerung-fortsetzung {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

#steuerung-fortsetzung .steuerung-gruppe:last-child {
    grid-column: 1 / -1;
}

.steuerung-gruppe {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
}

/* Gewicht Auswahl rechts vom Lineal */
#gewicht-auswahl-rechts {
    position: absolute;
    top: 50px;
    right: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

.gewicht-buttons-vertikal {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Gewicht Buttons */
.gewicht-buttons {
    flex-wrap: wrap;
}

.gewicht-btn {
    min-width: 80px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
}

.gewicht-btn.active {
    background: #0e4194;
    transform: scale(1.05);
}

.gewicht-btn:not(.active) {
    background: #6c757d;
}

/* Slider Styling */
#auslenkung-slider {
    width: 100%;
}

/* Button Gruppe */
.button-gruppe {
    flex-wrap: wrap;
}

.button-gruppe button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.button-gruppe button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.button-gruppe button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Stopuhr Bereich */
.stopuhr-bereich {
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border: 2px solid #dee2e6;
}

.stopuhr-anzeige {
    background: #f8f9fa;
    color: #212529;
    padding: 1rem 2rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    border: 1px solid #ced4da;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.stopuhr-anzeige-kompakt {
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 1px solid #ced4da;
}

.stopuhr-anzeige-kompakt #stopuhr-zeit {
    font-size: 1.2rem;
    letter-spacing: 1px;
}

#stopuhr-zeit {
    font-size: 2rem;
    letter-spacing: 2px;
}

.schwingungszaehler {
    padding: 0.5rem;
    background: #e9ecef;
    border-radius: 4px;
    text-align: center;
}

.schwingungszaehler-kompakt {
    padding: 0.5rem 1rem;
    background: #e9ecef;
    border-radius: 4px;
}

#schwingungen-count {
    font-size: 1.5rem;
    font-weight: bold;
    color: #0e4194;
}

/* Ergebnisse Box */
.ergebnisse-box {
    background: white;
    border: 2px solid #0e4194;
}

.ergebnis-zeile {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
}

.ergebnis-zeile:last-child {
    border-bottom: none;
}

.ergebnis-zeile span:last-child {
    font-weight: bold;
    color: #0e4194;
}

/* Responsive Design */
@media (max-width: 768px) {
    #federpendel-container {
        padding: 1rem;
    }

    #pendel-bereich {
        height: 400px;
    }

    #gewicht-auswahl-rechts {
        right: 10px;
        top: 30px;
        gap: 0.3rem;
    }

    .gewicht-btn {
        min-width: 60px;
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }

    .gewicht-koerper {
        width: 60px;
        height: 60px;
    }

    #gewicht-anzeige {
        font-size: 14px;
    }

    .button-gruppe {
        flex-direction: column;
    }

    .button-gruppe button {
        width: 100%;
    }

    #steuerung,
    #steuerung-fortsetzung {
        grid-template-columns: 1fr;
    }
}

/* Utility Classes */
.gap-small { gap: 0.5rem; }
.gap-middle { gap: 1rem; }
.gap-large { gap: 1.5rem; }
.flex-grow-1 { flex-grow: 1; }
.text-h2 { font-size: 1.5rem; }
.text-h3 { font-size: 1.25rem; }
.primarycolor { color: #0e4194; }
