* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.header-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    opacity: 0.9;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

#nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#userMenu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#userName {
    font-weight: 500;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.admin-section {
    padding-top: 0.75rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

/* Buttons */
button, .btn-primary, .btn-secondary {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-group {
    display: flex;
    gap: 1.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

/* Toast Notifications */
#toastContainer {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast.removing {
    animation: slideOut 0.3s ease-in forwards;
}

.toast-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.toast-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.toast-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* Features Grid */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.feature-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Lists */
.child-item, .meal-item, .order-item, .user-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 0.8rem;
    border-left: 4px solid #667eea;
}

.child-item h4, .meal-item h4, .order-item h4 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.meal-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
}

.meal-info {
    flex: 1;
}

.meal-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 0.5rem;
}

.badge-vegetarian {
    background: #d4edda;
    color: #155724;
}

.badge-vegan {
    background: #cce5ff;
    color: #004085;
}

.badge-status {
    background: #fff3cd;
    color: #856404;
}

.badge-status.ausstehend {
    background: #fff3cd;
    color: #856404;
}

.badge-status.bestaetigt {
    background: #d4edda;
    color: #155724;
}

.badge-status.storniert {
    background: #f8d7da;
    color: #721c24;
}

.badge-status.geliefert {
    background: #d1ecf1;
    color: #0c5460;
}

.price {
    font-size: 1.2rem;
    font-weight: 600;
    color: #28a745;
}

/* Footer */
footer {
    background: #343a40;
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    margin-top: 2rem;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 2rem;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .meal-item {
        grid-template-columns: 1fr;
    }

    .meal-actions {
        justify-content: flex-start;
    }

    #nav {
        flex-direction: column;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Scrollable meals list when many items */
#mealsList {
    max-height: 420px;
    overflow: auto;
    padding-right: 8px;
}

/* Parent week menu cards */
#weekMenuContainer {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.day-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    width: calc(20% - 12px);
    min-width: 160px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
    border-left: 4px solid #667eea;
}
.day-card h4 { margin-bottom: 6px; color: #667eea; }
.day-meal { background: white; padding: 8px; border-radius:6px; margin-bottom:8px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.day-meal .price { font-size: 0.95rem; margin-top:6px; }

/* Dropdown styling für mehrzeilige Anzeige */
.day-select {
    width: 100% !important;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.day-select option {
    padding: 8px;
    white-space: normal;
    line-height: 1.4;
}

/* Admin Tab Navigation */
.admin-tab-btn {
    padding: 12px 20px !important;
    border: none !important;
    background: none !important;
    cursor: pointer !important;
    font-weight: bold !important;
    margin-bottom: -2px;
    transition: all 0.3s ease !important;
    font-size: 1em;
}

.admin-tab-btn:hover {
    background-color: #f0f0f0 !important;
    color: #0056b3 !important;
}

.admin-tab-btn.active {
    color: #007bff !important;
    border-bottom: 3px solid #007bff !important;
}

.admin-tab-content {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .day-card { width: calc(50% - 12px); }
    .admin-tab-btn {
        padding: 10px 12px !important;
        font-size: 0.9em;
    }
}
@media (max-width: 480px) {
    .day-card { width: 100%; }
    .admin-tab-btn {
        padding: 8px 10px !important;
        font-size: 0.85em;
    }
}

/* Komponenten-Editor */
.component-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    background: #f9f9f9;
    position: relative;
}

.component-item .component-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.component-item .component-header h4 {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.component-item .remove-component-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.component-item .remove-component-btn:hover {
    background: #c82333;
}

.component-item .form-group {
    margin-bottom: 12px;
}

.component-item .form-group:last-child {
    margin-bottom: 0;
}

.component-item input[type="text"],
.component-item textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.component-item label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 13px;
    color: #333;
}

.component-item small {
    font-size: 11px;
    color: #666;
}

/* Mahlzeiten-Filter */
.meal-filter-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #f5f5f5;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.meal-filter-btn:hover {
    background: #e0e0e0;
}

.meal-filter-btn.active {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

#mealsListAdmin {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 8px;
}

#mealsListAdmin::-webkit-scrollbar {
    width: 8px;
}

#mealsListAdmin::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#mealsListAdmin::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#mealsListAdmin::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Speiseplan Dropdown-Auswahl */
.meal-select {
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    box-sizing: border-box;
}

.meal-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.meal-select option {
    padding: 8px;
    font-size: 14px;
    line-height: 1.4;
}

/* Tabellen-Style für Speiseplan-Editor */
#weekEditor {
    overflow-x: auto;
    margin-top: 10px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    table-layout: auto;
    min-width: 900px;
}

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

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

.table td:first-child {
    white-space: nowrap;
    font-weight: 500;
    width: 1%;
    min-width: 90px;
    font-size: 13px;
}

.table td:not(:first-child) {
    min-width: 200px;
}
