/* Grundlegende Stile für html und body (für Sticky Footer) */
html { 
    height: 100%; 
}
body { 
    font-family: sans-serif; 
    margin: 0; 
    padding: 0; 
    color: #333; /* Standard Textfarbe für Inhalte */
    line-height: 1.6; 
    font-size: 16px; 
    background-color: #f3f4f6; /* Tailwind gray-100 als Seitenhintergrund */
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
}

/* Header: Dunkelgrau */
header { 
    background-color: #1f2937; /* Tailwind gray-800 */
    color: #f9fafb; /* Tailwind gray-50 */
    padding: 1rem; 
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); /* Tailwind shadow-md */
    position: relative; /* Wichtig für mobiles Menü */
    z-index: 20; 
    flex-shrink: 0; 
}
/* Container im Header für max-width und Flexbox-Layout */
header .container { 
    max-width: 1280px; /* Tailwind container max-width (xl) oder nach Bedarf */
    margin-left: auto;
    margin-right: auto;
    display: flex; 
    flex-wrap: wrap; /* Erlaubt Umbruch auf kleinen Screens */
    justify-content: space-between; 
    align-items: center; 
    gap: 1rem; 
}
header h1 { 
    font-size: 1.5rem; /* Tailwind text-2xl */
    font-weight: 700; /* Tailwind font-bold */
    color: #ffffff; 
    margin: 0; 
}

/* Navigation & Burger Menu */
/* Styling für den Navigationscontainer selbst */
nav#mobile-menu {
    order: 3; /* Standardmäßig unter dem Auth-Bereich im Flex-Wrap */
    width: 100%; /* Nimmt volle Breite auf Mobile ein */
    display: none; /* Wird von JS getoggled oder durch @media überschrieben */
    background-color: #1f2937; /* Hintergrund für ausgeklapptes Menü */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: absolute; 
    top: 100%; /* Direkt unter dem Header */
    left: 0;
    right: 0;
}
/* Klasse zum Anzeigen (wird von JS getoggled) */
nav#mobile-menu.open { 
    display: block;
}
/* Liste im Menü */
nav ul { 
    list-style: none; 
    padding: 0; 
    margin: 0; 
    display: flex; 
    flex-direction: column; /* Mobile: Untereinander */
    align-items: center;
    padding: 1rem 0; 
}
nav ul li {
    width: 100%; 
}
/* Links und Buttons im Menü */
nav ul li a, 
nav ul li button { 
    display: block; 
    padding: 0.75rem 1rem; 
    color: #d1d5db; /* Tailwind gray-300 */
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out;
    width: 100%; 
    text-align: center; 
    background: none; 
    border: none; 
    cursor: pointer;
    font-size: 1rem; 
    text-decoration: none; /* Für a-Tags */
}
nav ul li a:hover,
nav ul li button:hover {
    color: #ffffff; 
    background-color: #374151; /* Tailwind gray-700 als Hover */
}
/* Trennlinie für mobile Auth-Items */
#login-link-item, #logout-link-item {
    border-top: 1px solid #374151; /* Tailwind gray-700 */
    margin-top: 0.5rem; 
    padding-top: 0.5rem; 
}

/* Burger Button Styling */
#burger-menu-button {
    padding: 0.5rem; 
    border-radius: 0.25rem; 
    background: none;
    border: none;
    color: #d1d5db; /* gray-300 */
    cursor: pointer;
    display: none; /* Wird nur auf Mobile angezeigt durch @media */
}
#burger-menu-button:hover {
    background-color: #374151; /* gray-700 */
    color: #ffffff;
}
#burger-menu-button i {
    font-size: 1.25rem; /* text-xl */
    display: block; 
}

/* Desktop Navigation */
@media (min-width: 768px) { /* md: Breakpoint */
    nav#mobile-menu { 
        display: block !important; 
        position: static; 
        width: auto; 
        background-color: transparent;
        box-shadow: none;
        margin-top: 0;
        padding: 0;
        order: 0; 
    }
    nav ul { 
        flex-direction: row; 
        padding: 0;
        gap: 1.5rem; 
    }
     nav ul li {
         width: auto; 
     }
     nav ul li a, 
     nav ul li button { 
         padding: 0.5rem; 
         text-align: left; 
     }
     /* KORREKTUR: Mobile Auth Items explizit verstecken */
     #login-link-item, #logout-link-item { display: none !important; } 
     #burger-menu-button { display: none !important; }
     #auth-section { display: flex; }
}
/* Mobile Navigation */
@media (max-width: 767px) { 
     #burger-menu-button { display: block !important; } 
     #auth-section { display: none !important; } 
     nav#mobile-menu { /* display: none; ist Standard */ }
     nav#mobile-menu.open { display: block; }
     header .container { justify-content: space-between; }
     nav#mobile-menu { order: 10; }
}


/* Authentifizierungsbereich im Header (Desktop) */
#auth-section { align-items: center; gap: 0.75rem; margin-left: auto; }
#login-link-header { font-size: 0.875rem; font-weight: 500; color: #d1d5db; background: none; border: none; cursor: pointer; transition: color 0.2s ease-in-out; padding: 0.5rem; }
#login-link-header:hover { color: #ffffff; }
#logout-button-header { background: none; border: none; color: #d1d5db; font-size: 1.125rem; cursor: pointer; padding: 0.25rem; line-height: 1; transition: color 0.2s ease-in-out; }
#logout-button-header:hover { color: #ffffff; }
#user-status-header { align-items: center; gap: 0.75rem; }
#user-greeting { font-size: 0.875rem; color: #e5e7eb; }

/* Login/Logout Status CSS Steuerung */
#user-status-header, #logout-link-item { display: none; } 
/* Wenn eingeloggt: Zeige Logout/Status, verstecke Login */
body.logged-in #user-status-header { display: flex; } 
body.logged-in #logout-link-item { display: block; } 
body.logged-in #login-link-header { display: none; } 
body.logged-in #login-link-item { display: none; } 

/* Main-Bereich */
main { padding: 2rem 1rem; flex-grow: 1; } /* flex-grow ist wichtig für Sticky Footer */
main > .container { max-width: 1280px; margin-left: auto; margin-right: auto; }

/* Lade-Nachricht */
.loading-message { text-align: center; padding: 2.5rem; color: #6b7280; }
/* Blog-Einträge Container */
#blog-entries { }
/* Einzelner Blog-Eintrag */
.blog-entry { 
    background-color: #ffffff; 
    padding: 1.5rem; 
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); 
    border-bottom: 1px solid #e5e7eb; 
    /* NEU: Maximale Breite und Zentrierung wie Einzelansicht */
    max-width: 56rem; /* Tailwind max-w-4xl */
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1.5rem; /* Abstand zwischen den Karten */
}
#blog-entries > .blog-entry:last-child { 
    border-bottom: none; 
    margin-bottom: 0; /* Kein Abstand nach dem letzten Eintrag */
}
.blog-entry h2 { font-size: 1.5rem; font-weight: 600; color: #111827; margin-bottom: 0.5rem; margin-top:0; }
.entry-timestamp { font-size: 0.875rem; color: #6b7280; margin-bottom: 1rem; }
.entry-preview { color: #374151; margin-bottom: 1rem; white-space: pre-wrap; word-wrap: break-word; }
.article-actions { margin-top: 1rem; padding-top: 1rem; display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; border-top: 1px solid #f3f4f6; }
.article-actions button, .article-actions a { padding: 0.25rem 0.75rem; border-radius: 0.25rem; font-size: 0.875rem; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; transition: background-color 0.2s ease, color 0.2s ease; border: 1px solid transparent; }
.read-more { color: #4f46e5; background-color: transparent; padding-left: 0; padding-right: 0; } 
.read-more:hover { color: #3730a3; text-decoration: underline; }
.edit-btn { background-color: #f59e0b; color: #ffffff; }
.edit-btn:hover { background-color: #d97706; }
.delete-btn { background-color: #ef4444; color: #ffffff; }
.delete-btn:hover { background-color: #dc2626; }
.edit-btn i, .delete-btn i { margin-right: 0.25rem; }

/* Einzelansicht-Container */
#single-article-view { background-color: #ffffff; padding: 2rem; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); max-width: 56rem; margin: 2rem auto 1rem auto; border-radius: 0.375rem; }
#single-article-view h2 { font-size: 1.875rem; font-weight: 700; color: #111827; margin-bottom: 1rem; margin-top: 0; }
#single-article-view .entry-timestamp { font-size: 0.875rem; color: #6b7280; margin-bottom: 1.5rem; }
#single-article-view div.prose { color: #374151; line-height: 1.75; }
#single-article-view div.prose p { margin-bottom: 1.25rem; }
#single-article-view div.prose pre { background-color: #f3f4f6; padding: 1rem; border-radius: 0.375rem; overflow-x: auto; }
#back-to-list { margin-bottom: 1.5rem; display: inline-flex; align-items: center; padding: 0.5rem 1rem; border: 1px solid transparent; font-size: 0.875rem; font-weight: 500; border-radius: 0.375rem; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); color: #ffffff; background-color: #4b5563; cursor: pointer; transition: background-color 0.2s ease; }
#back-to-list:hover { background-color: #374151; }

/* Add-Button (FAB) */
#add-article-button { position: fixed; bottom: 1.5rem; right: 1.5rem; background-color: #4f46e5; color: #ffffff; border-radius: 9999px; width: 3rem; height: 3rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); z-index: 40; transition: background-color 0.2s ease; cursor: pointer; }
#add-article-button:hover { background-color: #4338ca; }

/* Modal-Fenster Basis */
#new-entry-modal, #login-modal { position: fixed; inset: 0; background-color: rgba(0, 0, 0, 0.5); display: none; justify-content: center; align-items: center; z-index: 50; padding: 1rem; }
#new-entry-modal.flex, #login-modal.flex { display: flex; } 
/* Modal Inhalt Container */
.modal-content { background-color: #ffffff; padding: 2rem; border-radius: 0.5rem; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); width: 100%; position: relative; }
#new-entry-modal .modal-content { max-width: 36rem; }
#login-modal .modal-content { max-width: 24rem; }
/* Modal Schließen Button (X) */
.close-article-modal-button, #close-login-modal-button { position: absolute; top: 0.75rem; right: 0.75rem; color: #9ca3af; background: none; border: none; cursor: pointer; padding: 0.25rem; transition: color 0.2s ease; }
.close-article-modal-button:hover, #close-login-modal-button:hover { color: #374151; }
.close-article-modal-button i, #close-login-modal-button i { font-size: 1.125rem; display: block; }
/* Modal Formular Elemente */
#new-entry-form, #login-modal-form { display: flex; flex-direction: column; gap: 1rem; }
#new-entry-form h3, #login-modal-form h3 { font-size: 1.125rem; font-weight: 500; line-height: 1.5rem; color: #111827; margin-bottom: 1rem; margin-top: 0; }
#login-modal-form h3 { text-align: center; } 
#new-entry-form label, #login-modal-form label { display: block; font-size: 0.875rem; font-weight: 500; color: #374151; margin-bottom: 0.25rem; }
#new-entry-form input[type="text"], #new-entry-form textarea, #login-modal-form input[type="text"], #login-modal-form input[type="password"] { margin-top: 0; display: block; width: 100%; border-radius: 0.375rem; border: 1px solid #d1d5db; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); font-size: 0.875rem; padding: 0.5rem 0.75rem; box-sizing: border-box; }
#new-entry-form input[type="text"]:focus, #new-entry-form textarea:focus, #login-modal-form input[type="text"]:focus, #login-modal-form input[type="password"]:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2); outline: none; }
#new-entry-form textarea { min-height: 150px; resize: vertical; }
/* Modal Formular Buttons Container */
#new-entry-form .form-buttons, #login-modal-form .form-buttons { display: flex; padding-top: 1rem; }
#new-entry-form .form-buttons { justify-content: flex-end; }
#login-modal-form .form-buttons { justify-content: center; }
/* Modal Submit Buttons */
#save-button, #login-modal-submit { display: inline-flex; justify-content: center; border-radius: 0.375rem; border: 1px solid transparent; padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 500; color: #ffffff; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); cursor: pointer; transition: background-color 0.2s ease; }
#save-button { background-color: #16a34a; }
#save-button:hover { background-color: #15803d; }
#login-modal-submit { background-color: #4f46e5; padding-left: 1.5rem; padding-right: 1.5rem; }
#login-modal-submit:hover { background-color: #4338ca; }
/* Login-Fehler (im Modal) */
#login-modal-error { color: #dc2626; font-size: 0.875rem; margin-top: 0.5rem; text-align: center; }

/* Klasse, um Admin-Elemente zu steuern */
.admin-only { display: none; }
body.logged-in .admin-only { display: inline-block; }
body.logged-in #add-article-button { display: flex; }


/* Media Queries für kleinere Anpassungen */
@media (max-width: 768px) {
    header .container { flex-direction: row; align-items: center; } 
    header h1 { text-align: left; width: auto; margin-bottom: 0;}
    #burger-menu-button { display: block !important; } 
    #auth-section { display: none !important; } 
    main { padding: 1rem 0.5rem; } 
    .blog-entry { padding: 1rem; max-width: 95%; margin-bottom: 1rem; /* Wieder MB für Mobile */ } 
    .blog-entry h2 { font-size: 1.25rem; }
    .article-actions { flex-wrap: wrap; justify-content: flex-end; } 
    .article-actions button, .article-actions a { font-size: 0.75rem; padding: 0.25rem 0.5rem;} 
    #add-article-button { width: 2.75rem; height: 2.75rem; bottom: 1rem; right: 1rem; }
    #add-article-button i { font-size: 1rem; }
    #new-entry-modal .modal-content { padding: 1.5rem; } 
    #login-modal .modal-content { padding: 1.5rem; } 
    #single-article-view { padding: 1.5rem; margin: 1rem 0.5rem; max-width: 95%;} 
    #single-article-view h2 { font-size: 1.5rem; }
    #single-article-view p { font-size: 1rem; }
}

/* Footer */
footer { 
    background-color: #1f2937; /* Tailwind gray-800 */
    color: #9ca3af; /* Tailwind gray-400 */
    padding: 1rem; 
    margin-top: 3rem; /* Tailwind mt-12 */
    flex-shrink: 0; /* Wichtig für Sticky Footer */
    text-align: center;
    font-size: 0.875rem; /* Tailwind text-sm */
}

