:root{
    /* Gray mode for non-logged in users - same shading but no color */
    --c1: #0d0d0d; /* Primary background - exactly #0d0d0d */
    --c2: hsl(0, 0%, 12%);
    --c3: hsl(0, 0%, 20%);
    --c4: hsl(0, 0%, 28%);
    --c5: hsl(0, 0%, 36%);
    --c6: hsl(0, 0%, 44%);
    --c7: hsl(0, 0%, 55%);
    --c8: hsl(0, 0%, 65%);
    --c9: hsl(0, 0%, 75%);
    --c10: hsl(0, 0%, 85%);
    --c11: hsl(0, 0%, 95%);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--c1);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--c3);
    border-radius: 6px;
    border: 2px solid var(--c1);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--c4);
}

::-webkit-scrollbar-thumb:active {
    background: var(--c5);
}

::-webkit-scrollbar-corner {
    background: var(--c1);
}

/* Floating Label Design */
.floating-input-container {
    position: relative;
}

.floating-input-container input {
    width: 100%;
    padding: 16px 12px 8px 12px;
    border: 1px solid var(--c3);
    border-radius: 4px;
    font-size: 16px;
    background: var(--c2);
    color: var(--c11);
    outline: none;
    transition: border-color 0.2s ease;
    max-width: 400px;
}

/* Prevent browser autofill from changing input colors */
.floating-input-container input:-webkit-autofill,
.floating-input-container input:-webkit-autofill:hover,
.floating-input-container input:-webkit-autofill:focus,
.floating-input-container input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--c2) inset !important;
    -webkit-text-fill-color: var(--c11) !important;
    background-color: var(--c2) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.floating-input-container label {
    position: absolute;
    left: 12px;
    top: 11px;
    color: var(--c5);
    font-size: 16px;
    pointer-events: none;
    transition: all 0.2s ease;
    background: var(--c2);
    padding: 0 4px;
    white-space: nowrap;
    max-width: calc(100% - 24px); /* Prevent overflow */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* When input is focused or has content */
.floating-input-container input:focus + label,
.floating-input-container input:not(:placeholder-shown) + label {
    top: -8px;
    font-size: 12px;
    color: var(--c6);
    border-radius: 5px;
    left: 8px;
    max-width: calc(100% - 16px); /* Adjust for smaller label */
}

.floating-input-container input:focus {
    border-color: var(--c6);
}

/* Error state for password confirmation */
.floating-input-container input.error {
    border-color: #f44336;
}

.floating-input-container input.error + label {
    color: #f44336;
}

*{
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--c3) var(--c1);
}
html, body{
    height: 100%;
    max-height: 100%;
    min-height: 100%;

    overflow: hidden;
    display: flex;
    flex-direction: column;

    background-color: #0d0d0d; /* Ensure default background is #0d0d0d */
}
body{
    font-family: "segoe ui", sans-serif;

    margin: 0;
    padding: 0;

    background-color: var(--c1);
    color: var(--c11);

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
a{
    color: var(--c10);
    text-decoration: none;
    transition: 0.1s ease-in-out;
}
a:hover{
    color: var(--c11);
    text-decoration: underline;
}

.top-bar{
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--c2);
    border-bottom: 1px solid var(--c3);
    padding: 5px 10px;

    width: 100%;
}

.top-bar-left{
    flex: 1;
}
.top-bar-left a{
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--c10);
    transition: 0.1s ease-in-out;
}
.top-bar-left a img{
    width: 32px;
    height: 32px;
}
.top-bar-left a h1{
    font-weight: bold;
    font-size: 20px;
    padding: 0px;
    margin: 0px;
}
.top-bar-left a:hover{
    color: var(--c11);
    cursor: pointer;
}

.top-bar-right{
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.top-bar-right a{
    padding: 5px 10px;
    border-radius: 5px;
    background-color: var(--c3);
    color: var(--c10);
    text-decoration: none;
    font-size: 16px;
    border: 1px solid var(--c5);
    transition: 0.1s ease-in-out;
}
.top-bar-right a:hover{
    background-color: var(--c4);
    cursor: pointer;
    color: var(--c11);
}

.top-bar-right .profile-link{
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-profile-image{
    height: 32px;
    width: 32px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--c5);
}

#main{
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    min-height: 0; /* Allow flexbox to shrink properly */

}

#content{
    flex: 5;
    padding: 10px;

    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 10px;

    overflow-y: auto;
    overflow-x: hidden;

    height: 100%;

    width: 100%;
    max-width: 100%;
}

#sideBar{
    display: flex;
    flex-direction: column;
    background-color: var(--c2);
    border-right: 1px solid var(--c3);

    flex: 1;
    max-width: 200px;

    position: sticky;
    top: 0;
    height: 100%;
    overflow-y: auto;
    transition: transform 0.3s ease-in-out;
}

/* Hamburger menu button */
.sidebar-toggle {
    display: none;
    font-size: 20px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    margin-right: 10px;
    transition: all 0.3s ease-in-out;
}

.sidebar-toggle:hover {
    transform: scale(1.1);
}
#sideBar a{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    text-decoration: none;
    color: var(--c10);
}
#sideBar a:hover,
#sideBar a.active{
    color: var(--c11);
    background-color: var(--c3);
}

.sideBar-divider{
    height: 1px;
    width: 100%;
    background-color: var(--c3);
}



h1,h2,h3,h4,h5,h6,p{
    margin: 5px 10px;
    padding: 0;
}

input{
    background-color: var(--c3);
    border: 1px solid var(--c5);
    outline: none;
    border-radius: 5px;
    padding: 10px 5px;
    color: var(--c10);
    max-width: 300px;
}
input[type="submit"]{
    background-color: var(--c3);
    border: 1px solid var(--c5);
    outline: none;
    border-radius: 5px;
    padding: 5px 10px;
    max-width: min-content;
    font-size: 16px;
    max-height: min-content;
}
input[type="submit"]:hover{
    background-color: var(--c4);
    border: 1px solid var(--c5);
    color: var(--c11);
    cursor: pointer;
}

table{
    width: 100%;
    border-collapse: collapse;
    margin: 0px;
    padding: 0px;
    /* Ensure tables don't overflow */
    table-layout: auto;
    word-wrap: break-word;
}
td, th{
    padding: 5px 10px;
    border: 1px solid var(--c3);
    text-align: center;
    /* Ensure long content wraps */
    word-break: break-word;
    max-width: 300px;
}
tr:nth-child(odd){
    background-color: var(--c2);
}

.main-panel{
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    width: 100%;
    max-width: 100%;
    border-top: 1px solid var(--c3);
    flex-shrink: 0; /* Prevent shrinking */
    overflow-x: hidden; /* Prevent horizontal overflow */
    box-sizing: border-box;
}
.bottom-panel{
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    border-top: 1px solid var(--c3);
    padding: 10px;
}
.bottom-panel input[type="submit"]{
    align-self: flex-end;
}

/* Message styling */
.message {
    flex: 2;
}

.message.error {
    display: block;
    color: orange;
}

.message.success {
    display: block;
    color: lime;
}

.message.info {
    display: block;
    color: var(--c9);
}

.message.warning {
    display: block;
    color: #ffa500;
    font-weight: bold;
}


/* Hue Slider Styling */
.hue-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: transparent;
    outline: none;
    cursor: pointer;
    position: relative;
    z-index: 3;
    margin: 0;
    padding: 0;
}

.hue-slider::-webkit-slider-track {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: transparent;
}

.hue-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--thumb-color, var(--c3));
    border: 3px solid var(--c3);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
}

.hue-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.hue-slider::-moz-range-track {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: transparent;
    border: none;
}

.hue-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--thumb-color, var(--c3));
    border: 3px solid var(--c3);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
}

.hue-slider {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right,
        hsl(0, 85%, 50%),
        hsl(30, 85%, 50%),
        hsl(60, 85%, 50%),
        hsl(90, 85%, 50%),
        hsl(120, 85%, 50%),
        hsl(150, 85%, 50%),
        hsl(180, 85%, 50%),
        hsl(210, 85%, 50%),
        hsl(240, 85%, 50%),
        hsl(270, 85%, 50%),
        hsl(300, 85%, 50%),
        hsl(330, 85%, 50%),
        hsl(360, 85%, 50%)
    );
    z-index: 1;
    transition: all 0.3s ease;
    opacity: 0.8;
}

/* Calendar specific styles */
.calendar-day {
    aspect-ratio: 1/1 !important;
    min-height: 60px;
    max-height: 120px;
}

.calendar-header-day {
    aspect-ratio: 1/1 !important;
    min-height: 40px;
    max-height: 60px;
}

#calendarContainer {
    max-width: 800px;
}

/* Server page specific styles */
/* Ensure tables don't cause horizontal overflow */
.main-panel table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

.main-panel table thead,
.main-panel table tbody,
.main-panel table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

/* Ensure table wrappers have proper overflow */
.main-panel > div[style*="overflow-x"] {
    max-width: 100%;
    overflow-x: auto;
}

/* Responsive layout */
@media (max-width: 768px) {
    #content {
        flex-direction: column;
        align-items: center;
    }

    .w-container {
        flex: 1 1 auto;
        width: 100%;
        max-width: 600px;
    }
}

@media (max-width: 480px) {
    #content {
        padding: 5px;
    }

    .w-container {
        min-width: 300px;
    }
}

/* Mobile responsive sidebar */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
        position: fixed;
        bottom: 20px;
        left: 20px;
        background-color: var(--c2);
        border: 1px solid var(--c3);
        border-radius: 50%;
        width: 50px;
        height: 50px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
        margin-right: 0;
        align-items: center;
        justify-content: center;
        font-size: 24px;
    }

    #sideBar {
        position: fixed;
        top: var(--top-bar-height, 60px); /* Dynamic top bar height */
        left: 0;
        height: calc(100vh - var(--top-bar-height, 60px)); /* Dynamic height calculation */
        width: 250px;
        max-width: 80vw;
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    }

    #sideBar.open {
        transform: translateX(0);
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        position: fixed;
        top: var(--top-bar-height, 60px); /* Dynamic top bar height */
        left: 0;
        width: 100%;
        height: calc(100vh - var(--top-bar-height, 60px)); /* Dynamic height calculation */
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* Calendar mobile adjustments */
    .calendar-day {
        min-height: 50px !important;
        max-height: 80px !important;
        font-size: 14px;
    }

    .calendar-header-day {
        min-height: 35px !important;
        max-height: 50px !important;
        font-size: 12px;
    }

    #calendarContainer {
        max-width: 100%;
    }

    #calendarGrid {
        gap: 2px !important;
        padding: 8px !important;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    #content{
        flex-direction: column;
        align-items: center;
        padding: 5px;
    }
    .dual{
        flex-direction: column;
    }

    .calendar-day {
        min-height: 40px !important;
        max-height: 60px !important;
        font-size: 12px;
        padding: 2px !important;
    }

    .calendar-header-day {
        min-height: 30px !important;
        max-height: 40px !important;
        font-size: 10px;
        padding: 4px !important;
    }

    #calendarGrid {
        gap: 1px !important;
        padding: 5px !important;
    }

    /* Mobile adjustments for server page */

    td, th {
        padding: 4px 6px;
        font-size: 12px;
        max-width: 150px;
    }

    /* Make server page tables more mobile-friendly */
    .main-panel table {
        font-size: 11px;
    }

    .main-panel h3 {
        font-size: 16px;
    }
}

/* Footer Styles */
.site-footer {
    width: 100%;
    padding: 20px 10px;
    margin-top: auto; /* Push footer to bottom */
    flex-shrink: 0; /* Prevent footer from shrinking */
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    color: var(--c7);
    font-size: 13px;
}

.footer-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-section p {
    margin: 0;
    color: var(--c7);
    font-size: 13px;
}

.footer-section a {
    color: var(--c8);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: var(--c10);
    text-decoration: underline;
}

.footer-divider {
    color: var(--c6);
}

/* Mobile footer adjustments */
@media (max-width: 600px) {
    .footer-content {
        flex-direction: column;
        gap: 8px;
    }
}