/* Apply transition to all elements with custom properties */
* {
    transition: color 0.3s var(--trspeed); /* Added time unit to var(--trspeed) */
}

/* Body styles */
body {
    transition: color 2s; /* Changed transition property */
    background-color: var(--background-color);
    margin: 0;
    font-family: sans-serif;
    overflow-x: hidden;
}

/* Header styles */
header {
    border-color: var(--header-background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: 30px;
    height: 30px;
    gap: 30px;
    backdrop-filter: blur(0);
    position: sticky;
    top: 0;
    width: 400px;
    margin: 0 auto; /* Centering header */
    background-color: transparent;
    z-index: 10;
    border-radius: 0;
    left: calc(50% - 220px); /* Adjusted for older browser compatibility */
}

/* Button container within header */
header #btns {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 20px;
    gap: 30px;
}

/* Links within the button container */
header #btns a {
    text-decoration: none;
    transition: all 0.5s;
    height: 30px;
    padding: 0 5px;
    color: var(--primary-color);
    border-color: calc(--primary-color);
    background-color: transparent;
    font-size: 30px;
    border: none;
    border-bottom: 5px solid transparent;
    border-radius: 2px;
    white-space: nowrap;
    text-wrap: nowrap;
}

header #btns a:hover {
    border-bottom: 5px solid var(--extra-color-2);
    color: var(--extra-color-2);
    padding: 5px 5px;
}

/* Toggle button */
 #color-toggle {
    transition: all 0.5s;
    background-color: transparent;
    border: none;
    color: var(--primary-color);
    position: fixed;
    top: 25px;
    right: 40px;
    z-index: 900;
    cursor: pointer;
}
	
#color-toggle #icon_l {
     transition: all 0.5s;
        height: 40px;
        width: 40px;
        color: var(--primary-color);
        font-size: 30px;
        background-color: transparent;
        border: none;
        border-bottom:  5px solid transparent;
        border-radius: 2px;
        cursor: pointer;
}

/* H2 tag */
h2 {
    color: var(--primary-color);
    font-size: 30px;
    background-color: transparent;
    border: none;
    border-bottom: 5px solid transparent;
    border-radius: 2px;
    position: fixed;
    top: 15px;
    left: 40px;
    margin: 0;
    z-index: 200;
    display: block;
    padding-top: 5px;
}

/* Floating class */
.floating {
    transition: all 0.6s;
    background-color: var(--header-background-color);
    border: 1px solid var(--header-background-color);
    backdrop-filter: blur(2px);
    top: 10px;
    margin: 10px;
    border-radius: 20px;
    padding: 10px;
    padding-bottom: 15px;
    left: calc(50% - 210px); /* Adjusted for older browser compatibility */
}

/* Page class */
.page {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--extra-color-2);
    text-align: center;
    width: 100%; /* Changed to full width */
    z-index: 2;
}

.page h1 {
    font-size: 2.9rem;
    background-color: var(--primary-color);
    color: var(--extra-color);
    display: inline-block; /* Changed to inline-block */
    padding: 5px 10px;
    border-radius: 20px;
    box-shadow: 0 0 50px -10px var(--primary-color);
    z-index: 2;
}

/* Media Queries */
@media only screen and (max-width: 650px) {
    header,
    .floating {
        width: auto;
        left: calc(50% - 150px - 20px);
        margin: 10px;
        border-radius: 20px;
        padding: 10px;
        padding-top: 15px;
        position: fixed;
        bottom: 0;
        top: auto;
        background-color: var(--header-background-color);
        backdrop-filter: blur(2px);
        margin: 10px;
        border-radius: 20px;
        padding: 10px;
        padding-bottom: 12px;
    }

    .page {
        margin-bottom: 100px;
        margin-top: 50px;
    }
}

@media only screen and (max-width: 500px) {
    h2 {
        left: 10px;
    }

    #color-toggle {
        right: 10px;
    }
}

@media only screen and (max-width: 420px) {
    header,
    .floating {
        width: calc(100% - 40px);
        left: 0;
        right: 0;
        margin: 10px;
        border-radius: 20px;
        padding: 10px;
        padding-top: 15px;
        position: fixed;
        bottom: 0;
        top: auto;
        border: 1px solid var(--header-background-color);
    }
}
