/* Visually hide text for screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* XP Toast Notification */
.xp-toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, hsl(262, 60%, 55%), hsl(262, 60%, 45%));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 8px 24px rgba(139, 71, 235, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    z-index: 10000;
    animation: slideInRight 0.4s ease, fadeOutRight 0.4s ease 2.6s forwards;
}

.xp-toast i {
    font-size: 1.5rem;
    color: #ffffff; /* Use white for toast icons (star) */
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .xp-toast {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        font-size: 0.95rem;
    }
}

/* Base Styles */
:root {
    --bg-app: hsl(216, 18%, 16%);
    --bg-sidebar: hsl(216, 20%, 12%);
    --bg-sidebar-hover: hsl(216, 15%, 20%);

    --color-text-primary: hsl(0, 0%, 100%);
    --color-text-secondary: hsl(216, 10%, 70%);

    --color-accent: hsl(265, 80%, 60%);
    --color-accent-hover: hsl(265, 80%, 50%);

    --color-btn-gray: hsl(216, 15%, 25%);
    --color-btn-gray-hover: hsl(216, 15%, 35%);

    --sidebar-width: 8rem;
    --sidebar-width-collapsed: 5rem;

    --board-max-size: 160000px;
    
    --border-color: hsl(216, 15%, 20%);

    --bg-card: hsl(216, 15%, 20%);
    --bg-card-header: hsl(216, 15%, 15%);
    --bg-card-border: hsl(216, 15%, 25%);
    --bg-hover: hsl(216, 15%, 25%);
    --bg-secondary: hsl(216, 15%, 25%);
    --bg-input: hsl(216, 15%, 10%);
}

body.light-mode {
    --bg-app: hsl(0, 0%, 98%);
    --bg-sidebar: hsl(0, 0%, 95%);
    --bg-sidebar-hover: hsl(0, 0%, 88%);

    --color-text-primary: hsl(0, 0%, 5%);
    --color-text-secondary: hsl(0, 0%, 35%);

    --color-btn-gray: hsl(0, 0%, 92%);
    --color-btn-gray-hover: hsl(0, 0%, 85%);
    
    --border-color: hsl(0, 0%, 82%);

    --bg-card: hsl(0, 0%, 100%);
    --bg-card-header: hsl(0, 0%, 97%);
    --bg-card-border: hsl(0, 0%, 88%);
    --bg-hover: hsl(0, 0%, 93%);
    --bg-secondary: hsl(0, 0%, 92%);
    --bg-input: hsl(0, 0%, 97%);
}

html {
    height: 100%;
    /* Ensure html takes full height */

    scrollbar-width: none;
    /* For Firefox */
    -ms-overflow-style: none;
    /* For Internet Explorer and Edge */
    overflow-x: hidden;
}

html::-webkit-scrollbar {
    display: none;
    /* For Chrome, Safari, and Opera */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--color-text-primary);
    min-height: 100vh;

    scrollbar-width: none;
    /* For Firefox */
    -ms-overflow-style: none;
    /* For Internet Explorer and Edge */
    overflow-x: hidden;
}

body::-webkit-scrollbar {
    display: none;
    /* For Chrome, Safari, and Opera */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1rem;
    padding: 1rem 0.5rem;
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    height: 100vh;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--color-text-primary);
    padding: 0.25rem;
}

.logo-img {
    display: block;
    height: 2rem;
    width: auto;
}

.logo-text {
    display: none;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item a,
.nav-item button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--color-text-secondary);
    padding: 0.75rem 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    gap: 0.25rem;
}

.nav-item button {
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
}

.nav-item a:hover,
.nav-item button:hover {
    background-color: var(--bg-sidebar-hover);
    color: var(--color-text-primary);
}

.nav-item.active a,
.nav-item.active button {
    color: var(--color-text-primary);
    background-color: var(--bg-sidebar-hover);
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-item.disabled .disabled-link {
    display: block;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    gap: 0.25rem;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    padding: 0 0.5rem;
}

.sidebar-footer-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0.4rem 0.4rem 0.75rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    border-radius: 0.25rem;
    transition: color 0.2s ease;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.sidebar-footer-link:hover {
    color: var(--color-text-primary);
}

.sidebar-footer-link i {
    font-size: 0.8rem;
}

.sidebar-bottom {
    display: none; /* Hidden by default to prevent flash */
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn {
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background-color 0.2s;
    width: 100%;
    text-decoration: none;
    display: block;
    text-align: center;
}

.btn-signup {
    background-color: var(--color-accent);
    color: white;
}

.btn-signup:hover {
    background-color: var(--color-accent-hover);
}

.btn-login {
    background-color: var(--color-btn-gray);
    color: var(--color-text-secondary);
}

.btn-login:hover {
    background-color: var(--color-btn-gray-hover);
    color: white;
}

.main-content {
    flex: 1;
    min-height: 100vh;
    padding-left: calc(var(--sidebar-width) + 0.5rem);
    display: block;
    overflow: hidden;
}

.dashboard-grid {
    width: 100%;
    height: 100%;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4.25rem;
    padding: 0.35rem 0.75rem;
    background-color: var(--bg-sidebar);
    border-top: 1px solid hsl(216, 15%, 20%);
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    z-index: 95;
}

.bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: 0.7rem;
    padding: 0.35rem 0.25rem;
    border-radius: 0.75rem;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.bottom-nav__item i {
    font-size: 1.1rem;
}

.bottom-nav__item span {
    line-height: 1;
}

.bottom-nav__item:hover {
    background-color: var(--bg-sidebar-hover);
    color: var(--color-text-primary);
}

.bottom-nav__item--active {
    color: var(--color-accent);
}

.bottom-nav__item--active i {
    color: var(--color-accent);
}

/* Profile button: make it stand out */
.bottom-nav__item--profile {
    position: relative;
    transform: translateY(-0.4rem);
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    padding-inline: 0.75rem;
}

.bottom-nav__item--profile span {
    font-weight: 600;
}

.bottom-nav__profile-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
}

.bottom-nav__avatar {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    border: 2px solid #ffffff;
    overflow: hidden;
    background-color: var(--bg-app);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35);
}

.bottom-nav__avatar i {
    color: white;
    font-size: 1.2rem;
    display: block; /* Show icon by default */
    position: absolute;
    top: 40%;
    left: 50.5%;
    transform: translate(-50%, -50%);
}

.bottom-nav__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none; /* Hide image by default */
}

body.is-loading .bottom-nav__avatar {
    background-color: hsl(216, 15%, 25%);
    animation: skeleton-shimmer 1.5s linear infinite;
    background-image: linear-gradient(to right, 
        hsl(216, 15%, 25%) 0%, 
        hsl(216, 15%, 30%) 20%, 
        hsl(216, 15%, 25%) 40%, 
        hsl(216, 15%, 25%) 100%);
    background-repeat: no-repeat;
    background-size: 800px 104px;
}

body.is-loading .bottom-nav__avatar > * {
    visibility: hidden;
}

@media (min-width: 1024px) {
    :root {
        --sidebar-width: 10rem;
    }

    .logo-text {
        display: block;
    }

    .logo {
        justify-content: flex-start;
        padding-left: .7rem;
    }

    .nav-item a {
        flex-direction: row;
        justify-content: flex-start;
        padding-left: 1rem;
        font-size: 1rem;
    }

    .nav-item i {
        width: 1.5rem;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        padding-bottom: 4.75rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .bottom-nav {
        display: flex;
    }

    .app-container {
        min-height: 100vh;
        padding-bottom: 0;
        overflow-x: hidden;
    }
}