body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    background-color: #fdfcf8;
    color: #4A3B15;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #f4d489;
    color: #4A3B15;
    padding: 1em 1em;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

header #logo {
    height: 40px;
    width: 40px;
}

header h1 {
    margin: 0;
    font-size: 1.8em;
}

main {
    flex-grow: 1;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}

#statsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1280px;
}

.user-card {
    background-color: #FEFBF5;
    border: 1px solid #E0D8C0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.07);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, opacity 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.user-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid #f4d489; /* Linie unter den Header */
    padding-bottom: 10px;
}

.user-card h2 {
    margin-bottom: 0;
    color: #c7a040;
    font-size: 1.7em;
    flex-grow: 1;
    word-break: break-all;
    border-bottom: none; /* Entfernt, da jetzt im Header */
    padding-bottom: 0; /* Entfernt */
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 10px;
    white-space: nowrap;
    flex-shrink: 0; /* Verhindert, dass der Badge schrumpft */
}

.status-badge.online {
    background-color: #4CAF50; /* Grün */
    color: white;
}

.status-badge.recently-active-badge {
    background-color: #FF9800; /* Orange */
    color: white;
}

.user-card.recently-active {
    opacity: 0.7; /* Etwas stärker ausgeblendet */
}
.user-card.recently-active:hover {
    opacity: 0.9; /* Beim Hover etwas weniger ausgeblendet */
}


.scale-info {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #E0D8C0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}
.scale-info:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.scale-details {
    /* Nimmt den ersten Slot im Grid ein */
}

.scale-info h3 {
    font-size: 1.25em;
    color: #5a5340;
    margin-bottom: 8px;
    word-break: break-all;
}

.user-card p {
    margin: 4px 0;
    font-size: 0.95em;
}

.user-card .label {
    font-weight: bold;
    color: #7a6c50;
}

.progress-bar-container {
    width: 100%;
    background-color: #F8EBCD;
    border-radius: 5px;
    margin-top: 8px;
    height: 24px;
    overflow: hidden;
    border: 1px solid #E0D8C0;
    grid-column: 1 / -1;
}

.progress-bar {
    height: 100%;
    background-color: #f4d489;
    color: #4A3B15;
    text-align: center;
    line-height: 24px;
    font-size: 0.9em;
    font-weight: bold;
    border-radius: 4px 0 0 4px;
    transition: width 0.4s ease-out;
    white-space: nowrap;
    overflow: hidden;
}

#loadingMessage, #noUsersMessage {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 1.2em;
    color: #8C7F6C;
    padding: 30px;
    background-color: #FEFBF5;
    border-radius: 8px;
    border: 1px dashed #E0D8C0;
}

footer {
    text-align: center;
    padding: 1em;
    background-color: #4A3B15;
    color: #fdfcf8;
    margin-top: auto;
}

.glass-visualizer-container {
    width: 60px;
    height: 90px;
    position: relative;
    margin: 0;
}

.glass-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.glass-outline {
    fill: rgba(240, 230, 210, 0.2);
    stroke: #5a5340;
    stroke-width: 2;
}

.liquid-svg {
    fill: #f4d489;
    transition: transform 0.4s ease-out, y 0.4s ease-out, height 0.4s ease-out; /* y und height hinzugefügt für bessere Animation */
    transform-origin: bottom center;
}


@media (max-width: 768px) { /* Breiterer Breakpoint für Grid-Anpassung */
    .scale-info {
        grid-template-columns: 1fr; /* Untereinander auf kleineren Bildschirmen */
        text-align: center;
    }
    .glass-visualizer-container {
        margin: 10px auto;
    }
}


@media (max-width: 600px) {
    header {
        padding: 0.8em;
        gap: 10px;
    }
    header #logo {
        height: 35px;
        width: 35px;
    }
    header h1 {
        font-size: 1.5em;
    }
    #statsContainer {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .user-card h2 {
        font-size: 1.5em;
    }
    .scale-info h3 {
        font-size: 1.15em;
    }
    .user-card p {
        font-size: 0.9em;
    }
    .user-card-header {
        flex-direction: column; /* Username und Badge untereinander */
        align-items: flex-start; /* Links ausrichten */
    }
    .status-badge {
        margin-left: 0;
        margin-top: 5px; /* Kleiner Abstand zum Usernamen */
    }
}

.prost-button {
    background-color: #c7a040; /* Stärkeres Gold */
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: background-color 0.2s;
    margin-top: 10px;
    display: block; /* Macht den Button zum Blockelement für volle Breite in seinem Container */
    width: calc(100% - 10px); /* Etwas Padding links/rechts lassen */
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

.prost-button:hover {
    background-color: #b38f39; /* Dunkleres Gold */
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.5); /* Black w/ opacity */
    padding-top: 60px; /* Location of the box */
}

.modal-content {
    background-color: #fefefe;
    color: #4A3B15;
    margin: 5% auto; /* 15% from the top and centered */
    padding: 25px;
    border: 1px solid #E0D8C0;
    border-radius: 8px;
    width: 80%; /* Could be more or less, depending on screen size */
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    position: relative;
}

.modal-content h2 {
    margin-top: 0;
    color: #c7a040;
    font-size: 1.5em;
    border-bottom: 1px solid #f4d489;
    padding-bottom: 10px;
}

.modal-content div {
    margin-bottom: 15px;
}

.modal-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.modal-content input[type="text"],
.modal-content textarea {
    width: calc(100% - 22px); /* Full width minus padding and border */
    padding: 10px;
    border: 1px solid #E0D8C0;
    border-radius: 4px;
    font-size: 1em;
    background-color: #fff;
}
.modal-content textarea {
    resize: vertical;
}


.modal-content button {
    background-color: #f4d489;
    color: #4A3B15;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.2s;
}

.modal-content button:hover {
    background-color: #e0c070;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-error {
    color: #D8000C; /* Rot für Fehlermeldungen */
    background-color: #FFD2D2; /* Heller roter Hintergrund */
    border: 1px solid #D8000C;
    padding: 8px;
    border-radius: 4px;
    font-size: 0.9em;
    margin-top: 10px;
    display: none; /* Standardmäßig ausblenden */
}