/*=============== GOOGLE FONTS ===============*/
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&display=swap");

/*=============== VARIABLES CSS ===============*/
:root {
    --header-height: 3.5rem;

    /*========== Sidebar widths ==========*/
    --sidebar-width-full: 260px;   /* expanded / desktop default */
    --sidebar-width-rail: 76px;    /* icon-only rail */

    /*========== Colors ==========*/
    --white-color: hsl(210, 32%, 99%);
    --text-color: hsl(210, 4%, 55%);
    --dark-color-light: hsla(210, 4%, 4%, .1);
    --white-color-light: hsla(210, 4%, 99%, .1);
    --gradient-x: linear-gradient(90deg,
    hsla(0, 0%, 0%, 0),
    hsl(210, 4%, 64%),
    hsla(0, 0%, 0%, 0));
    --gradient-y: linear-gradient(0,
    hsla(0, 0%, 0%, 0),
    hsl(210, 4%, 64%),
    hsla(0, 0%, 0%, 0));

    /*========== Font and typography ==========*/
    --body-font: "Montserrat", sans-serif;
    --normal-font-size: .938rem;
    --small-font-size: .813rem;

    /*========== Font weight ==========*/
    --font-medium: 500;
    --font-semi-bold: 600;

    /*========== z index ==========*/
    --z-tooltip: 10;
    --z-fixed: 100;
}

@media screen and (min-width: 1024px) {
    :root {
        --normal-font-size: 1rem;
        --small-font-size: .875rem;
    }
}

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

body {
    font-family: var(--body-font);
    font-size: var(--normal-font-size);
    color: var(--text-color);
    min-height: 100vh;
}

a { text-decoration: none; }

img { display: block; max-width: 100%; height: auto; }

/*=============== LAYOUT ===============*/
.container { margin-inline: 1.5rem; }
.main { padding-top: 1.5rem; color: var(--white-color); transition: padding-left .4s ease; }
.main h1 { font-weight: var(--font-semi-bold); }

.bg-image {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: -1;
}

/*=============== HEADER ===============*/
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--dark-color-light);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: var(--z-fixed);
}

.header::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--gradient-x);
}

.header__container {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header__toggle {
    font-size: 1.25rem;
    color: var(--white-color);
    cursor: pointer;
}

.header__logo {
    display: flex;
    align-items: center;
    column-gap: 0rem;
    color: var(--white-color);
    font-weight: var(--font-semi-bold);
    letter-spacing: .5px;
}
.header__logo i { font-size: 1.35rem; }

/*=============== SIDEBAR (mobile-first base = phone drawer) ===============*/
/*
   Tiering:
   - < 576px  (phone):        off-canvas drawer, hidden until toggled open (full width)
   - 576–1023px (split-screen/tablet): ALWAYS visible as an icon-only rail;
                               toggle expands it to the full labeled sidebar as an overlay
   - >= 1024px (desktop):     ALWAYS visible full width by default;
                               toggle collapses it down to the icon rail (pushes content)

   NOTE: rows use flexbox (not grid) so the icon can be truly centered when the
   label collapses, and labels collapse via max-width (which animates smoothly)
   rather than width: auto <-> 0 (which does not animate reliably).
*/

.sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 240px;
    height: 100%;
    padding: 1.5rem 1rem;
    background: #0b1017;
    border-right: 1px solid #1d2938;
    z-index: var(--z-fixed);
    transition: left .4s ease, width .4s ease, padding .35s ease, box-shadow .4s ease;
    display: flex;
    flex-direction: column;
}

.sidebar::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    width: 1px;
    height: 100%;
    background: #1d2938;
}

.sidebar__container {
    display: flex;
    flex-direction: column;
    row-gap: 0.5rem;
    padding-bottom: 1rem;
    height: 100%;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.sidebar__logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: .875rem;
    column-gap: .5rem;
    color: var(--white-color);
    transition: padding-left .35s ease;
}

.sidebar__logo-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar__logo .header__toggle {
    font-size: 1.25rem;
    cursor: pointer;
}

.sidebar__logo i { font-size: 1.5rem; }
.sidebar__logo-text {
    font-weight: var(--font-semi-bold);
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    max-width: 160px;
    opacity: 1;
    transition: opacity .2s ease, max-width .35s ease;
}

.sidebar__content {
    position: relative;
    overflow: auto;
    padding-top: 1.5rem;
}

.sidebar__content::-webkit-scrollbar { display: none; }

.sidebar__content::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: #1d2938;
}

.sidebar__list {
    display: flex;
    flex-direction: column;
    row-gap: 0rem;
}

/* ---------- LINK ROW (flexbox, not grid) ---------- */
.sidebar__link {
    position: relative;
    color: var(--text-color);

    display: flex;
    align-items: center;
    justify-content: flex-start;

    width: 100%;
    min-height: 2.8rem;

    padding: .6rem 1.5rem;
    border-radius: .7rem;

    column-gap: 1.25rem;

    transition:
        background .3s,
        padding .35s ease,
        column-gap .35s ease;
}

.sidebar__link-floating {
    display: none;
    position: absolute;
    left: 50%;
    bottom: -0.05rem;
    transform: translateX(-50%);

    width: max-content;
    margin: 0;
    padding: .25rem .5rem;

    font-size: 10px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;

    color: var(--white-color);
    background: rgba(0, 0, 0, .85);
    border-radius: .25rem;

    opacity: 0;
    pointer-events: none;
    z-index: 2;
    transition: opacity .25s;
}

.sidebar__link i {
    color: var(--white-color);
    fill: #ffffff;
    font-size: 1.25rem;
    width: 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar__link-name {
    font-weight: var(--font-medium);
    white-space: nowrap;
    overflow: hidden;
    max-width: 160px;
    opacity: 1;
    transition: opacity .2s ease, max-width .35s ease;
}

.sidebar__link:hover {
    background-color: #182130;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--white-color);
}

.sidebar__title { position: relative; transition: opacity .4s; }
.sidebar__title span {
    display: block;
    position: relative;
    margin-block: 1rem 0.5rem;
    text-align: center;
    color: var(--white-color);
    font-size: var(--normal-font-size);
    overflow: hidden;
    max-width: 200px;
    opacity: 1;
    transition: opacity .3s ease, max-width .35s ease;
}

.sidebar__title span::before,
.sidebar__title span::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
}

.sidebar__title span::before {
    background: linear-gradient(90deg,
    hsla(0, 0%, 0%, 0),
    hsl(210, 4%, 64%));
    left: 0;
}

.sidebar__title span::after {
    background: linear-gradient(90deg,
    hsl(210, 4%, 64%),
    hsla(0, 0%, 0%, 0));
    right: 0;
}

.sidebar__title::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--gradient-x);
    opacity: 0;
    transition: opacity .4s;
}

.sidebar__perfil {
    width: 45px;
    height: 45px;
    min-width: 45px;
    border-radius: 50%;
    border: 2px solid var(--white-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4c5563, #2a2f38);
    color: var(--white-color);
    font-weight: var(--font-semi-bold);
    font-size: .95rem;
    flex-shrink: 0;
    overflow: hidden;
}

/* ---------- ACCOUNT ROW (flexbox, same collapse pattern as links) ---------- */
.sidebar__account {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    column-gap: 1rem;
    margin-top: auto;
    flex-shrink: 0;
    padding-left: 1.5rem;
    transition: column-gap .35s ease, padding-left .35s ease;
}

.sidebar__names {
    overflow: hidden;
    white-space: nowrap;
    max-width: 160px;
    opacity: 1;
    transition: opacity .2s ease, max-width .35s ease;
}

.sidebar__name {
    font-size: var(--normal-font-size);
    color: var(--white-color);
    margin-bottom: .25rem;
}

.sidebar__email {
    font-size: var(--small-font-size);
    font-weight: var(--font-medium);
}

.sidebar__account i {
    color: var(--white-color);
    font-size: 1.5rem;
    margin-left: auto;
    cursor: pointer;
    flex-shrink: 0;
    max-width: 1.5rem;
    overflow: hidden;
    opacity: 1;
    transition: opacity .2s ease, max-width .35s ease, margin .35s ease;
}

/* Active link */
.active-link {
    background-color: #182130;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.active-link span, .active-link i { color: #28d0bf; }

/*=============== PHONE (< 576px): off-canvas drawer ===============*/
.sidebar { left: -100%; width: 240px; }
.main { padding-left: 0; }

/* Toggled open on phone = full drawer slides in */
.show-sidebar { left: 0; }

@media screen and (max-width: 340px) {
    .sidebar { width: 88vw; padding-inline: 1rem; }
    .sidebar__account { flex-direction: column; row-gap: .5rem; text-align: center; }
    .sidebar__account i { margin: 0; }
}

/*=============== SPLIT-SCREEN / TABLET (576px – 1023px): always-visible icon rail ===============*/
@media screen and (min-width: 576px) {
    .sidebar {
        left: 0;
        width: var(--sidebar-width-rail);
        padding: 1.5rem .75rem;
        box-shadow: none;
    }

    .main { padding-left: var(--sidebar-width-rail); }

    .sidebar__logo { padding-left: .875rem; }
    .sidebar__logo-text { max-width: 0; opacity: 0; }

    /* collapse labels/text down to icon-only by default */
    .sidebar__link-name,
    .sidebar__names,
    .sidebar__title span {
        max-width: 0;
        opacity: 0;
    }
    .sidebar__title::after { opacity: 1; }

    .sidebar__link { column-gap: 0; padding-left: .875rem; padding-right: .875rem; }

    .sidebar__account { column-gap: 0; padding-left: 0.12rem; }
    .sidebar__account i { max-width: 0; opacity: 0; margin-left: 0; pointer-events: none; }

    /* tooltip on hover while collapsed */
    .sidebar__link-floating { display: block; }
    .sidebar__link:hover .sidebar__link-floating { opacity: 1; }

    /* toggled = expand into a floating overlay panel with full labels */
    .show-sidebar {
        width: var(--sidebar-width-full);
        padding: 1.5rem 1rem;
        box-shadow: 8px 0 24px rgba(0, 0, 0, .35);
    }
    .show-sidebar .sidebar__logo { padding-left: .875rem; }
    .show-sidebar .sidebar__logo-text { max-width: 160px; opacity: 1; }
    .show-sidebar .sidebar__link-name,
    .show-sidebar .sidebar__names,
    .show-sidebar .sidebar__title span {
        max-width: 200px;
        opacity: 1;
    }
    .show-sidebar .sidebar__title::after { opacity: 0; }
    .show-sidebar .sidebar__link { column-gap: 1.25rem; padding-left: 1.5rem; padding-right: 1.5rem; }
    .show-sidebar .sidebar__account { column-gap: .5rem; padding-left: 1.5rem; }
    .show-sidebar .sidebar__account i { max-width: 1.5rem; opacity: 1; margin-left: auto; pointer-events: auto; }
    .show-sidebar .sidebar__link-floating { opacity: 0 !important; }

    /* main stays docked to the rail width even when the panel expands over it */
    .main-pd { padding-left: var(--sidebar-width-rail); }
}

/*=============== DESKTOP (>= 1024px): full sidebar by default ===============*/
@media screen and (min-width: 1024px) {
    .header__container { height: calc(var(--header-height) + 1.5rem); }
    .header__toggle { font-size: 1.5rem; }

    .sidebar {
        width: var(--sidebar-width-full);
        padding: 1.5rem 1rem;
        box-shadow: none;
    }
    .main { padding-left: var(--sidebar-width-full); }

    .sidebar__logo { padding-left: .875rem; }
    .sidebar__logo-text { max-width: 160px; opacity: 1; }

    /* full labels shown by default on desktop */
    .sidebar__link-name,
    .sidebar__names,
    .sidebar__title span {
        max-width: 200px;
        opacity: 1;
    }
    .sidebar__title::after { opacity: 0; }
    .sidebar__link { column-gap: 1.25rem; padding-left: 1.5rem; padding-right: 1.5rem; }
    .sidebar__account { column-gap: 1rem; padding-left: 1.5rem; }
    .sidebar__account i { max-width: 1.5rem; opacity: 1; margin-left: auto; }
    .sidebar__link-floating { opacity: 0 !important; }

    /* toggled on desktop = collapse down to icon rail, pushes content */
    .show-sidebar {
        width: var(--sidebar-width-rail);
        padding: 1.5rem .75rem;
        box-shadow: none;
    }
    .show-sidebar .sidebar__logo { padding-left: .875rem; }
    .show-sidebar .sidebar__logo-text { max-width: 0; opacity: 0; }
    .show-sidebar .sidebar__link-name,
    .show-sidebar .sidebar__names,
    .show-sidebar .sidebar__title span {
        max-width: 0;
        opacity: 0;
    }
    .show-sidebar .sidebar__title::after { opacity: 1; }
    .show-sidebar .sidebar__link { column-gap: 0; padding-left: .875rem; padding-right: .875rem; }
    .show-sidebar .sidebar__account { column-gap: 0; padding-left: 0.4rem; }
    .show-sidebar .sidebar__account i { max-width: 0; opacity: 0; margin-left: 0; pointer-events: none; }
    .show-sidebar .sidebar__link-floating { display: block; }
    .show-sidebar .sidebar__link:hover .sidebar__link-floating { opacity: 1 !important; }

    .main-pd { padding-left: var(--sidebar-width-rail); }
}

.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    font-size: 1.25rem;
    color: var(--white-color);
    cursor: pointer;
    z-index: calc(var(--z-fixed) + 1);
}
