/* CSS Variables */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --font-size: 16px;
    --background-color: #303F9F;
    --background-gradient: linear-gradient(to left, #ff1a8c, #303F9F);
    --text-color: #FAFAFA;
    --link-color: #FEFEFE;
    --link-hover-color: #FFD700;
    --header-background: linear-gradient(to right, #ff1a8c, #4653bf);
    --post-background: rgba(255, 255, 255, 0.2);
    --button-background: rgba(255, 255, 255, 0.2);
    --scrollbar-bg: #303F9F;
    --scrollbar-thumb: #ff1a8c;
    --selection-bg: #ff1a8c;
    --selection-text: #FAFAFA;

    /* Nowe zmienne dla bloków kodu */
    --code-background: #2e3440;
    --code-text: #d8dee9;
    --code-border: #4c566a;
    --code-inline-bg: rgba(255, 255, 255, 0.1);
}

[data-theme="sunny-gold"] {
    --background-color: #FFF8E1;
    --background-gradient: linear-gradient(to left, #FFF3C4, #E1B978);
    --text-color: #FAFAFA; /* Adjusted to a shade of white */
    --link-color: #FFA726; /* Adjusted to match the theme */
    --link-hover-color: #FFBF78; /* Matched to selection background color */
    --header-background: linear-gradient(to right, #FFECB3, #E1B978);
    --post-background: rgba(0, 0, 0, 0.1);
    --button-background: rgba(255, 255, 255, 0.2);
    --scrollbar-bg: #FFF8E1; /* Matched to background color */
    --scrollbar-thumb: #FFBF78; /* Matched to selection background color */
    --selection-bg: #FFBF78;
    --selection-text: #FAFAFA; /* Adjusted to a shade of white */

    /* Nowe zmienne dla bloków kodu w "sunny-gold" */
    --code-background: #fff3c4;
    --code-text: #222222;
    --code-border: #e1b978;
    --code-inline-bg: rgba(0, 0, 0, 0.05);
}
 

[data-theme="midnight-eclipse"] {
    --background-color: #121212;
    --background-gradient: linear-gradient(to right, #000000, #363636);
    --text-color: #999999;
    --link-color: #FF9800;
    --link-hover-color: #FF5722;
    --header-background: linear-gradient(to left, #535353, #151515);
    --post-background: rgba(255, 255, 255, 0.15);
    --button-background: rgba(255, 255, 255, 0.2);
    --scrollbar-bg: #000000;
    --scrollbar-thumb: #FF9800;
    --selection-bg: #FF9800;
    --selection-text: #121212;

    /* Nowe zmienne dla bloków kodu w "midnight-eclipse" */
    --code-background: #1e1e1e;
    --code-text: #f0f0f0;
    --code-border: #ff9800;
    --code-inline-bg: rgba(255, 255, 255, 0.1);
}

[data-theme="forest-harmony"] {
    --background-color: #191A19;
    --background-gradient: linear-gradient(to left, #1E5128, #141514);
    --text-color: #99A799;
    --link-color: #4CAF50;
    --link-hover-color: #8BC34A;
    --header-background: linear-gradient(to right, #2E7D32, #191A19);
    --post-background: rgba(255, 255, 255, 0.1);
    --button-background: rgba(255, 255, 255, 0.2);
    --scrollbar-bg: #191A19;
    --scrollbar-thumb: #4CAF50;
    --selection-bg: #4CAF50;
    --selection-text: #191A19;

    /* Nowe zmienne dla bloków kodu w "forest-harmony" */
    --code-background: #1e5128;
    --code-text: #d1e7dd;
    --code-border: #4caf50;
    --code-inline-bg: rgba(0, 0, 0, 0.1);
}

@keyframes gradientAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

/* Enable word wrapping */
.post-content, .post-item, p, h1, h2, h3, h4, h5, h6, a, div, span, li {
    word-wrap: break-word; /* Allows long words to be broken and wrapped to the next line */
    word-break: break-word; /* Ensures that long words are broken and wrapped */
    overflow-wrap: break-word; /* Similar to word-wrap, ensures text is wrapped within the container */
    text-align: justify; /* Justifies the text */
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    background: var(--background-gradient);
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
    font-size: var(--font-size);
}

/* Header and Footer */
header {
    background: var(--header-background);
    background-size: 200% 200%;
    color: var(--text-color);
    padding: 1em 0;
    text-align: center;
    animation: gradientAnimation 5s linear infinite;
    border-radius: 8px;
    margin: 10px;
    position: relative;
}

footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: var(--header-background);
    color: var(--text-color);
    animation: gradientAnimation 5s linear infinite;
    bottom: 0;
    width: 100%;
    margin-bottom: 0px;
    background-size: 200%;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    transition: position 0.3s;
    position: fixed; /* Change to fixed */
    z-index: 1000; /* Ensure it stays above other content */
}


/* Footer and Back to Blog Link */
footer a#back-to-blog {
    display: flex;
    align-items: center;
    color: var(--text-color);
    font-size: 1.2rem;
    text-decoration: none;
    transition: color 0.3s;
}

footer a#back-to-blog:hover {
    color: var(--link-hover-color);
}

footer a#back-to-blog i {
    margin-right: 8px;
}

/* Theme Buttons */
footer div#theme-buttons {
    display: flex;
    align-items: center;
    margin-right: 30px;
}

footer button {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    margin: 0 10px;
    cursor: pointer;
    transition: color 0.3s;
}

footer button:hover {
    color: var(--link-hover-color);
    transition: color 0.3s ease-in-out;
}

footer button:focus, footer button:hover {
    background-color: var(--post-background);
    outline: none;
}

#post-header {
    text-align: center;
    margin-bottom: 10px;
}

#share-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 10px;
}

#share-buttons a {
    display: inline-flex;
    align-items: center;
    margin: 5px;
    font-size: 1.5rem;
    color: var(--text-color);
    background: var(--button-background);
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    transition: color 0.3s, transform 0.3s;
}

#share-buttons a:hover {
    color: var(--link-hover-color);
    transform: scale(1.1);
}

div#spacer {
    margin: 8%;
}

div#content-container, div#main {
    padding: 20px;
    padding-top: 60px;
    padding-bottom: 80px;
    min-height: calc(100vh - 160px);
    justify-content: center;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s, background 0.3s;
}

a:hover {
    text-decoration: underline;
    color: var(--link-hover-color);
    transform: scale(1.05);
    transition: color 0.3s, transform 0.3s;
}

.post-item {
    margin-bottom: 2em;
    padding: 1em;
    background: var(--post-background);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.post-item h2 {
    font-size: 2rem;
    color: var(--text-color);
}

.post-item p {
    font-size: 1rem;
    color: var(--text-color);
}

.post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
}

h1, h2, h3, h4, h5, h6 {
    margin: 1em 0;
    color: var(--text-color);
}

p {
    margin: 0.5em 0;
    color: var(--text-color);
}

header h1 {
    font-size: 3rem;
}

#post-title {
    font-size: 2.5rem;
    color: var(--text-color);
    text-align: center;
}

#post-date, #main {
    font-size: 1.2rem;
    color: var(--text-color);
    text-align: center;
}

#main {
    background: var(--post-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#scroll-to-top {
    position: fixed;
    bottom: 80px; /* Adjust position above the fixed footer */
    right: 20px;
    display: none;
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 18px;
    z-index: 1001; /* Ensure it stays above the footer */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s, transform 0.3s;
}

#scroll-to-top:hover {
    background-color: rgba(0, 0, 0, 0.3);
    transform: scale(1.1);
}


#post-content {
    font-size: 1.2rem;
    color: var(--text-color);
    background: var(--post-background);
    padding: 40px;
    max-width: 86%;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin: 20px auto;
}

/* Adjust font sizes for smaller screens */
@media (max-width: 860px) {
    body {
        font-size: 0.65rem; /* Slightly smaller font size for screens up to 860px */
    }
    header, footer {
        flex-direction: column;
        text-align: center;
    }
    footer 
    {
        position: relative;
    }
    footer div#theme-buttons {
        margin-right: 0;
        margin-top: 10px;
        flex-direction: column;
    }
    footer button {
        margin: 5px 0;
    }
    footer a#back-to-blog {
        font-size: 0.5rem;
    }
    footer a#back-to-blog i {
        font-size: 1rem;
    }
    .pdf {
        height: 78vh; /* Adjusts the height to 60% of the viewport height on smaller screens */
    }
    #scroll-to-top {
        position: fixed; /* Ensure the button is fixed on smaller screens as well */
        bottom: 20px;
        right: 20px;
    }

    #post-content {
        font-size: 0.8rem;
        color: var(--text-color);
        background: var(--post-background);
        padding: 40px;
        max-width: 95%;
        border-radius: 8px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        margin: 20px auto;
    }
}

@media (max-width: 500px) {
    body {
        font-size: 0.75rem; /* Even smaller font size for screens up to 500px */
    }
    header, footer {
        flex-direction: column;
    }
    footer a#back-to-blog {
        font-size: 0.8rem;
    }
    footer a#back-to-blog i {
        font-size: 1.5rem;
    }
    footer button {
        font-size: 1rem;
    }
    footer div#theme-buttons {
        flex-direction: column;
        align-items: center;
    }
    footer button {
        margin: 5px 0;
    }
    .pdf {
        height: 73vh; /* Adjusts the height to 50% of the viewport height on very small screens */
    }
    #scroll-to-top {
        position: fixed; /* Ensure the button is fixed on smaller screens as well */
        bottom: 20px;
        right: 20px;
    }
}

#after-post-buttons, #after-pdf-buttons {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    background: var(--header-background);
    padding: 10px 0;
    border-radius: 8px;
    flex-wrap: wrap;
}

.social-button {
    display: inline-flex;
    align-items: center;
    font-size: 1.2rem;
    color: var(--text-color);
    background: var(--post-background);
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    margin: 0 10px;
    transition: background 0.3s, color 0.3s, transform 0.3s;
}

.social-button i {
    margin-right: 8px;
}

.social-button:hover {
    background: var(--link-hover-color);
    color: var(--text-color);
    transform: scale(1.1);
}

.pdf {
    width: 95%;
    max-width: 100%;
    height: 90vh; /* Adjust height as needed */
    border: none;
    display: block;
    margin: 0px auto;
    padding: 0;
}

.hidden {
    display: none;
}

::selection {
    background: var(--selection-bg);
    color: var(--selection-text);
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-bg);
    border-radius: 6px; /* Ensure the track is rounded */
}

::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 6px;
    border: 3px solid var(--scrollbar-bg);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--link-hover-color);
}

/* Firefox scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-bg);
}

/* Edge and IE scrollbar styling */
* {
    -ms-overflow-style: -ms-autohiding-scrollbar;
}

#after-post-buttons, #after-pdf-buttons, #share-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 10px 0;
    padding: 10px;
}

#after-post-buttons a, #share-buttons a, #after-pdf-buttons a {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 5px;
    padding: 10px 20px;
    background: var(--button-background);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s, color 0.3s;
}

#after-post-buttons a:hover, #share-buttons a:hover, #after-pdf-buttons a:hover {
    background: var(--link-hover-color);
    color: var(--selection-text);
}

#post-list h2 {
    font-size: 1.5r
    margin-bottom: 10px;
}

#pdf-buttons {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    padding: 10px 0;
    border-radius: 8px;
    flex-wrap: wrap;
    background: var(--header-background);
}

.pdf-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-color);
    background: var(--post-background);
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    margin: 0 10px;
    transition: background 0.3s, color 0.3s, transform 0.3s;
    cursor: pointer;
    border: none; /* Remove default button border */
}

.pdf-button:hover {
    background: var(--link-hover-color);
    color: var(--text-color);
    transform: scale(1.1);
}



@media (max-width: 860px) {
    #post-list h2 {
        font-size: 1.2rem;
    }
    #after-post-buttons, #after-pdf-buttons {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 500px) {
    #post-list h2 {
        font-size: 1rem;
    }
    footer div#theme-buttons {
        flex-direction: column;
        align-items: center;
    }
    footer button {
        margin: 5px 0;
    }
    #after-post-buttons a, #share-buttons a, #after-pdf-buttons a {
        font-size: 0.9rem;
        padding: 8px 16px;
    }
}

/* Post content adjustments */
@media (min-width: 768px) {
    .post-content {
        width: 86%;
        margin: 0 auto;
    }
}

@media (max-width: 767px) {
    .post-content {
        width: 100%;
        margin: 0 auto;
        text-align: center;
    }
}

/* Error message styling */
.error-message {
    display: none;
    color: var(--link-hover-color);
    background-color: var(--post-background);
    border: 1px solid var(--link-hover-color);
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
    text-align: center;
}
.error-message.show 
{
    display: block;
    color: var(--link-hover-color);
    background-color: var(--post-background);
    border: 1px solid var(--link-hover-color);
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
    text-align: center;
}
/* Error message styling */
.comment-header {
    color: var(--link-hover-color);
    background-color: var(--post-background);
    border: 1px solid var(--link-hover-color);
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0 20px 0;
    text-align: center;
}

/* Form styling */
#for-comments {
    margin: 20px auto;
    max-width: 86%; /* Adjust the width as necessary */
    background: var(--post-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#for-comments form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px; /* Ensure form fields are responsive */
    margin: 0 auto;
}

#for-comments form input, 
#for-comments form textarea {
    width: 100%;
    margin: 10px 0;
    padding: 10px;
    border: 1px solid var(--link-color);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

#for-comments form button {
    background: var(--button-background);
    color: var(--text-color);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
    margin: 0px auto 10px auto; /* Add margin to the top of the button */
}

#for-comments form button:hover {
    background: var(--link-hover-color);
    color: var(--text-color);
}

/* Comments container styling */
#commentsContainer {
    margin-top: 20px;
    width: 95%;
    max-width: 86%; /* Ensure container is responsive */
    margin: 0 auto;
}

@media (max-width: 768px) {
    #commentsContainer {
        width: 86%;
    }
    #for-comments form {
        max-width: 100%;
    }
}

#commentsContainer div {
    margin-bottom: 10px;
    padding: 5px;
    border-bottom: 1px solid var(--link-color);
    color: var(--text-color);
    background: var(--post-background);
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Comments title */
#commentsTitle {
    font-size: 1.5rem;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 20px;
}
#for-comments form input:-webkit-autofill, 
#for-comments form textarea:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px var(--post-background) inset;
    -webkit-text-fill-color: var(--text-color);
    transition: background-color 5000s ease-in-out 0s;
}

/* Active Form Outline Styling */
#for-comments form input:focus, 
#for-comments form textarea:focus {
    outline: 2px solid var(--link-hover-color);
    background: rgba(255, 255, 255, 0.2);
}


.comment-author {
    font-weight: bold;
    color: var(--link-color);
}

.comment-text {
    margin: 10px 10px;
    color: var(--text-color);
}

.comment-date {
    font-size: 0.9rem;
    color: var(--text-color);
    text-align: right;
}
/* Stylowanie dla elementów pre */
pre {
    background-color: var(--code-background);
    color: var(--code-text);
    padding: 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    overflow-x: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin: 1.5em 0;
    border: 1px solid var(--code-border);
}

/* Stylowanie dla elementów code wewnątrz pre */
pre code {
    display: block;
    font-family: 'Source Code Pro', monospace;
}

/* Upewnij się, że tekst kodu nie jest wyśrodkowany */
pre {
    text-align: left; /* Tekst kodu zawsze będzie wyrównany do lewej */
}
/* Stylowanie dla klas syntax highlighting */
.language-html {
    background-color: var(--code-background); /* Tło dla kodu HTML z użyciem zmiennej */
    color: var(--code-text); /* Kolor tekstu dla kodu HTML z użyciem zmiennej */
    padding: 10px;
}


/* Inline code styling */
code {
    background-color: var(--code-inline-bg);
    color: var(--code-text);
    padding: 3px 5px;
    font-size: 0.85rem;
}
#language-switch {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.language-btn {
    color: var(--text-color); /* Używamy zmiennej kolorystycznej */
    font-size: 1.2rem;
    text-decoration: none;
    margin: 0 10px;
    padding: 5px 10px;
    border-radius: 5px;
    background-color: var(--post-background);
    transition: background-color 0.3s, transform 0.3s;
}

.language-btn:hover {
    background-color: var(--link-hover-color);
    transform: scale(1.1);
    color: var(--text-color);
}
