/* Grundlegendes Styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    margin: 0;
    display: flex;
    flex-direction: column; /* Mobile-first */
    min-height: 100vh;
}

/* Container für Sidebar + Main Content */
.container {
    display: flex;
    width: 100%;
    flex: 1;
    height: 100%;
    flex-direction: row; /* Desktop: Sidebar + Content nebeneinander */
}

/* Sidebar */
.sidebar {
    background: #1f2937;
    color: white;
    width: 220px;
    padding: 2rem 1rem;
    border-radius: 0 12px 12px 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar h2 {
    margin-bottom: 2rem;
    font-size: 1.5rem;
    text-align: center;
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar ul li {
    margin: 1rem 0;
}

.sidebar ul li a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    display: block;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.sidebar ul li a:hover {
    background: #374151;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    overflow: hidden; /* verhindert, dass das gesamte Main scrollt */
}

/* Header */
header {
    position: relative;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 2rem;
    padding-right: 20px;
}

header h1 {
    font-size: 1.8rem;
    color: #111827;
    margin: 0;
}

/* Dashboard Cards */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 1.5rem;
}

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

/* Login-Formular */
.login-container {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 400px;
    text-align: center;
    margin: auto;
}

.login-container h2 {
    margin-bottom: 1.5rem;
    color: #333;
}

.login-container input,
.login-container button {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-size: 1rem;
}

.login-container input {
    border: 1px solid #ccc;
}

.login-container button {
    border: none;
    background: #4CAF50;
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
}

.login-container button:hover {
    background: #45a049;
}

#errorMsg {
    color: red;
    margin-top: 0.5rem;
}

/* Profil rechts oben */
.header-right {
    position: absolute;
    top: 10px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #4CAF50;
    transition: transform 0.2s;
}

.profile-icon:hover {
    transform: scale(1.1);
}

/* Profil-Dropdown modern gestalten */
.profile-menu {
    position: absolute;
    top: 50px; /* unter Profilbild */
    right: 0;
    background: #fff;
    border-radius: 12px; /* abgerundet */
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); /* moderner Schatten */
    overflow: hidden;
    transform: translateY(-20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    width: 180px; /* feste Breite, wirkt wie Karte */
}

/* Dropdown sichtbar */
.profile-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Menüeinträge als „Buttons“ */
.profile-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.profile-menu li {
    border-bottom: 1px solid #eee; /* Trennung zwischen Buttons */
}

.profile-menu li:last-child {
    border-bottom: none; /* letzter Eintrag ohne Linie */
}

.profile-menu li a {
    display: block;
    padding: 0.8rem 1.2rem;
    text-decoration: none;
    color: #111827;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
    border-radius: 8px; /* abgerundet wie Karte */
    margin: 4px; /* Abstand zwischen Buttons */
}

.profile-menu li a:hover {
    background: #f0f2f5;
    color: #4CAF50;
}


/* Mobile-Styles */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-radius: 0 0 12px 12px;
        flex-direction: row;
        justify-content: space-around;
        padding: 1rem 0.5rem;
    }
    .sidebar ul {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
    }
    .sidebar ul li {
        margin: 0;
    }
    .main-content {
        padding: 1rem;
        overflow: hidden; /* verhindert, dass das gesamte Main scrollt */
    }
    header h1 {
        font-size: 1.4rem;
    }
    .dashboard {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }
    .profile-icon {
        width: 35px;
        height: 35px;
    }
    .header-right {
        top: 5px;
        right: 10px;
    }
}
