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

:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --footer-color: #666666;
    --bg-color-rgb: 255, 255, 255;
    --accent-color: rgba(0, 255, 150, 0.8);
    --glass-bg: rgba(0, 0, 0, 0.05);
    --glass-border: rgba(0, 0, 0, 0.15);
    --glass-hover: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --footer-color: #cccccc;
    --bg-color-rgb: 26, 26, 26;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-hover: rgba(255, 255, 255, 0.2);
}

/* Universal Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: var(--bg-color);
    background: rgb(var(--bg-color-rgb));
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
    transition: background-color 0.3s, background 0.3s, color 0.3s;
    position: relative;
}

/* Flex Layout for Homepage */
body.homepage {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0;
}

/* Content Layout for Text Pages */
body.text-page {
    padding: 2rem;
    padding-top: 5rem;
    /* Add space for back button */
    padding-bottom: 8rem;
    /* Add space for footer */
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-weight: 700;
}

h2 {
    font-size: 1.8rem;
    margin: 2rem 0 1rem 0;
    color: var(--text-color);
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
    color: var(--text-color);
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--text-color);
    text-decoration: none;
}

/* Container Styles */
.container {
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 1rem;
    max-width: 100vw;
    box-sizing: border-box;
    /* Calculate center point considering footer height */
    margin-bottom: calc(5rem + 4rem);
    /* Footer height + bottom margin */
}

/* Footer Styles */
footer {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
    color: var(--footer-color);
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

/* Footer for text pages */
body.text-page footer {
    position: fixed;
    left: 2rem;
    right: 2rem;
    bottom: 2rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-right p {
    margin: 0;
    font-size: 0.9rem;
    white-space: nowrap;
}

.social-link {
    color: var(--footer-color);
    text-decoration: none;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.social-link i {
    font-size: 1.2rem;
    width: 1.2rem;
    text-align: center;
}

.social-link:hover {
    background: var(--glass-hover);
    color: var(--text-color);
    transform: translateY(-1px);
}

footer:hover {
    background: var(--glass-hover);
    transform: translateY(-2px);
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

footer a {
    color: var(--footer-color);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

footer a:hover {
    background: var(--glass-hover);
    color: var(--text-color);
    transform: translateY(-1px);
}

/* Button Styles */
.theme-toggle,
.cookie-settings-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
}

.theme-toggle:hover,
.cookie-settings-btn:hover:not(:disabled) {
    background: var(--glass-hover);
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cookie-settings-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Back to Home Link for Text Pages */
.back-home {
    position: fixed;
    top: 2rem;
    left: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-home:hover {
    background: var(--glass-hover);
    transform: translateY(-1px);
    color: var(--text-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    body.text-page {
        padding: 1rem;
        padding-top: 4rem;
        /* Space for back button */
        padding-bottom: 7rem;
        /* Space for footer */
    }

    .heading {
        font-size: 2.5rem;
        padding: 0.5rem 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    footer {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        max-width: calc(100vw - 2rem);
    }

    .footer-left {
        order: 1;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    .footer-left p {
        font-size: 0.75rem;
        text-align: center;
        margin: 0;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .footer-left a,
    .footer-left .theme-toggle,
    .footer-left .cookie-settings-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.35rem;
        min-width: 36px;
        min-height: 36px;
    }

    .footer-right {
        order: 2;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        border-top: 1px solid var(--glass-border);
        padding-top: 0.5rem;
    }

    .footer-right p {
        font-size: 0.75rem;
        margin: 0 0.25rem 0 0;
        white-space: nowrap;
    }

    .social-link {
        font-size: 1rem;
        width: 36px;
        height: 36px;
        padding: 0.4rem;
    }

    .social-link i {
        font-size: 1rem;
    }

    .back-home {
        top: 1rem;
        left: 1rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    /* Adjust container margin for mobile footer */
    .container {
        margin-bottom: calc(4rem + 2rem);
        /* Smaller footer on mobile */
    }
}

@media (max-width: 480px) {
    body.text-page {
        padding: 0.75rem;
        padding-top: 3.5rem;
        /* Space for back button */
        padding-bottom: 6rem;
        /* Space for footer */
    }

    h1 {
        font-size: 1.8rem;
    }

    footer {
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
    }

    .footer-left {
        gap: 0.4rem;
    }

    .footer-left p {
        font-size: 0.7rem;
        margin-bottom: 0.4rem;
    }

    .footer-left a,
    .footer-left .theme-toggle,
    .footer-left .cookie-settings-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.3rem;
        min-width: 32px;
        min-height: 32px;
    }

    .footer-right {
        gap: 0.4rem;
        padding-top: 0.4rem;
    }

    .footer-right p {
        font-size: 0.7rem;
        margin: 0 0.2rem 0 0;
    }

    .social-link {
        font-size: 0.9rem;
        width: 32px;
        height: 32px;
        padding: 0.3rem;
    }

    .social-link i {
        font-size: 0.9rem;
    }

    .back-home {
        top: 0.75rem;
        left: 0.75rem;
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    /* Further adjust container margin for smaller screens */
    .container {
        margin-bottom: calc(3.5rem + 1.5rem);
        /* Even smaller footer */
    }
}

@media (max-width: 320px) {
    body.text-page {
        padding: 0.5rem;
        padding-top: 3rem;
        /* Space for back button */
        padding-bottom: 5.5rem;
        /* Space for footer */
    }

    .heading {
        font-size: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    footer {
        padding: 0.3rem 0.4rem;
        gap: 0.3rem;
    }

    .footer-left {
        gap: 0.3rem;
    }

    .footer-left p {
        font-size: 0.65rem;
        margin-bottom: 0.3rem;
    }

    .footer-left a,
    .footer-left .theme-toggle,
    .footer-left .cookie-settings-btn {
        font-size: 0.65rem;
        padding: 0.15rem 0.2rem;
        min-width: 28px;
        min-height: 28px;
    }

    .footer-right {
        gap: 0.3rem;
        padding-top: 0.3rem;
    }

    .footer-right p {
        font-size: 0.65rem;
        margin: 0 0.15rem 0 0;
    }

    .footer-right p {
        font-size: 0.7rem;
    }

    .social-link {
        font-size: 0.8rem;
        width: 28px;
        height: 28px;
        padding: 0.25rem;
    }

    .social-link i {
        font-size: 0.8rem;
    }

    .back-home {
        top: 0.5rem;
        left: 0.5rem;
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Minimal container margin for very small screens */
    .container {
        margin-bottom: calc(3rem + 1rem);
        /* Compact footer */
    }
}

/* Height-based responsive adjustments */
@media (max-height: 600px) {

    footer {
        bottom: 0.5rem;
    }
}