@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&display=swap');

/* ---------- Tokens ---------- */
:root {
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.65);
    --border: rgba(255, 255, 255, 0.15);
    --hover-glass: rgba(255, 255, 255, 0.18);
}

/* ---------- Base (same reset as before) ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Nunito Sans", sans-serif;
}

/* Global colours kept as they were, the header relies on them */
a {
    text-decoration: none;
    color: white;
}

div,
p,
span,
button {
    color: white;
}

/* Inside the app, colours are inherited so hover states can change them */
main {
    color: var(--text);
}

main a,
main div,
main p,
main span,
main button {
    color: inherit;
}

button {
    font: inherit;
}

:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* ---------- Page frame: header + main fill exactly one screen ----------
   The header sits above <main>, so main can't be 100vh tall (that pushed the
   profile bar below the fold). Instead the parent of <main> becomes a column:
   the header keeps its natural height, main takes whatever is left. */
html {
    height: 100%;
    background: #111;
}

html body {
    height: 100%;
    overflow: hidden;
}

@supports (height: 100dvh) {
    html body {
        height: 100dvh;
    }
}

:has(> main) {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

:has(> main) > header {
    flex-shrink: 0;
}

:has(> main) > main {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
}

/* ---------- Background video ---------- */
#bgvid {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(15px);
    transform: scale(1.08); /* hides the soft edges the blur creates */
    z-index: -1;
}

/* ---------- App shell ---------- */
main {
    display: flex;
    width: 100%;
    height: 100vh;   /* fallback if :has() isn't supported */
    height: 100dvh;
    overflow: hidden;
}

/* ---------- Server rail (not used on this page, kept for later) ---------- */
aside {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(6px, 1.2vh, 10px);
    padding: 12px;
    background-color: rgba(228, 229, 233, 0.1);
    overflow-y: auto;
    scrollbar-width: none;
}

aside::-webkit-scrollbar {
    display: none;
}

aside .icon i:hover {
    color: white;
    background-color: #22a559;
    border-radius: 15px;
}

aside img:hover {
    border-radius: 15px;
}

hr {
    width: 50%;
    border-radius: 30px;
    border: 1px solid #cdced3;
}

/* ---------- Sidebar (#s) ----------
   Column: search + page link keep their height, the project list takes what is
   left (and is the only part that can scroll), the profile bar is always last. */
main .sidebar-chat {
    flex: 0 0 19%;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    background-color: rgba(242, 243, 245, 0.2);
    overflow-x: hidden;
    overflow-y: auto; /* only used if script.js ever sets display:block on #s */
}

main .sidebar-chat .top-nav {
    flex-shrink: 0;
    width: 100%;
    padding: clamp(4px, 0.9vh, 7px) 7px;
    border-bottom: 2px solid var(--border);
}

main .sidebar-chat .top-nav input {
    width: 100%;
    padding: clamp(5px, 0.8vh, 7px);
    border-radius: 5px;
    background-color: #e4e5e9;
    color: #060606;
    font: inherit;
    border: none;
    outline: none;
}

main .sidebar-chat .top-nav input:focus-visible {
    outline: 2px solid #22a559;
}

main .sidebar-chat .list {
    flex-shrink: 0;
    padding: clamp(3px, 0.8vh, 7px) 7px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

main .sidebar-chat .list-item {
    position: relative;
    width: 100%;
    padding: clamp(6px, 1.1vh, 10px) 12px;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 15px;
    background-color: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 5px;
    transition: all .1s ease-in-out;
}

main .sidebar-chat .list-item svg path {
    fill: currentColor;
}

main .sidebar-chat .list-item:hover,
main .sidebar-chat .list-item.active {
    background-color: #d8d9dd;
    color: #060606;
}

main .sidebar-chat .list .list-item:nth-child(3) {
    background-image: url("./Assets/bg-img list.png");
    background-position: right;
    background-size: cover;
}

main .sidebar-chat .list .list-item:nth-child(3):hover {
    backdrop-filter: grayscale(1);
}

main .sidebar-chat .list .list-item .new,
main .sidebar-chat .list .list-item .buy {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    border-radius: 30px;
    color: white;
    font-size: 12px;
    font-weight: 800;
}

main .sidebar-chat .list .list-item .new {
    background-color: #d9363b;
    padding: 1px 6px;
}

main .sidebar-chat .list .list-item .buy {
    background-image: linear-gradient(to right, hsl(269 52.7% 52.7%), hsl(325 31.7% 51.8%));
    padding: 1px 5px;
}

/* The links only cover their text; this stretches them over the whole row,
   which makes projects much easier to tap on a phone. */
main .sidebar-chat .list-item a::after,
main .sidebar-chat .dm .friends .f-li a::after {
    content: "";
    position: absolute;
    inset: 0;
}

/* Projects */
main .sidebar-chat .dm {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: clamp(2px, 1vh, 10px);
}

main .sidebar-chat .dm h1 {
    flex-shrink: 0;
    padding: clamp(4px, 1vh, 10px) 15px 5px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text);
    cursor: pointer;
}

main .sidebar-chat .dm h1:hover {
    color: var(--text-muted);
}

main .sidebar-chat .dm .friends {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 7px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto; /* only kicks in on a very short screen, the profile stays put */
    scrollbar-width: none;
}

main .sidebar-chat .dm .friends::-webkit-scrollbar {
    display: none;
}

main .sidebar-chat .dm .friends .f-li {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 15px;
    padding: clamp(2px, 0.6vh, 5px) 8px;
    cursor: pointer;
    border-radius: 5px;
}

main .sidebar-chat .dm .friends .f-li p {
    color: var(--text);
    font-weight: 500;
    font-size: 16px;
}

main .sidebar-chat .dm .friends .f-li:hover {
    background-color: rgba(216, 217, 221, 0.1);
}

main .sidebar-chat .dm .friends .f-li:hover > .img-wrapper::after {
    background-color: rgba(216, 217, 221, 0.1);
    box-shadow: 0 0 0 3px rgba(216, 217, 221, 0.1);
}

main .sidebar-chat .dm .friends .f-li .img-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: clamp(24px, 4vh, 30px);
    height: clamp(24px, 4vh, 30px);
}

main .sidebar-chat .dm .friends .f-li .img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

main .sidebar-chat .dm .friends .f-li .img-wrapper::after {
    content: "";
    position: absolute;
    bottom: 1px;
    right: -1px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: rgba(242, 243, 245, 0.1);
    border: 3px solid #868990;
    box-shadow: 0 0 0 3px rgba(242, 243, 245, 0.1);
}

main .sidebar-chat .dm .friends .f-li i {
    display: none;
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text);
}

main .sidebar-chat .dm .friends .f-li:hover > i {
    display: block;
}

/* Profile bar: last item of the column, so it is always on screen */
main .sidebar-chat .profile {
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
    padding: 10px 10px max(10px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(236, 237, 239, 0.1);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

main .sidebar-chat .profile .img-wrapper {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
}

main .sidebar-chat .profile .img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

main .sidebar-chat .profile .img-wrapper::after {
    content: "";
    position: absolute;
    bottom: 1px;
    right: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #24a55a;
    box-shadow: 0 0 0 3px rgb(236, 237, 239);
}

main .sidebar-chat .profile .left {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

main .sidebar-chat .profile .left .txt {
    min-width: 0;
    display: flex;
    align-items: start;
    justify-content: center;
    flex-direction: column;
    line-height: 16px;
}

main .sidebar-chat .profile .left .txt p {
    font-weight: 700;
    font-size: 14px;
}

main .sidebar-chat .profile .left .txt span {
    font-weight: 300;
    font-size: 12px;
}

main .sidebar-chat .profile .right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

main .sidebar-chat .profile .right i {
    cursor: pointer;
    color: var(--text-muted);
}

main .sidebar-chat .profile .right i:hover {
    color: var(--text);
}

main .sidebar-chat .profile .right i.mute {
    color: #d9373c;
    transition: all 0s;
    animation: spring .2s;
    transform: translateX(3px);
}

main .sidebar-chat .profile .right i.fa-headphones.mute {
    animation: tilt .2s;
    transform: translateX(0);
}

main .sidebar-chat .profile .right i.fa-gear {
    transition: all .5s ease-in-out;
    transform: rotate(0deg);
}

main .sidebar-chat .profile .right i.fa-gear:hover {
    transform: rotate(180deg);
}

@keyframes spring {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(2px); }
    50%  { transform: translateX(-2px); }
    100% { transform: translateX(3px); }
}

@keyframes tilt {
    0%   { transform: translateY(0); }
    25%  { transform: translateY(2px); }
    50%  { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

/* ---------- Content area (#r) ---------- */
main .rightside-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

main .rightside-area nav {
    flex-shrink: 0;
    width: 100%;
    padding: 11px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--border);
}

main .rightside-area nav .left-side {
    min-width: 0;
    display: flex;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
}

main .rightside-area nav .left-side::-webkit-scrollbar {
    display: none;
}

main .rightside-area nav .one {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100px;
    font-weight: 600;
    font-size: 16px;
    border-right: 1px solid var(--border);
}

main .rightside-area nav .one svg path {
    fill: var(--text-muted);
}

main .rightside-area nav .buttons {
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 15px;
}

main .rightside-area nav .buttons button {
    background-color: transparent;
    outline: none;
    border: none;
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 15px;
    font-weight: 400;
    white-space: nowrap;
    cursor: pointer;
}

/* :hover first so .active keeps its weight while hovered */
main .rightside-area nav .buttons button:hover {
    background-color: var(--hover-glass);
    font-weight: 500;
}

main .rightside-area nav .buttons button.active {
    background-color: var(--hover-glass);
    font-weight: 600;
}

main .rightside-area nav .buttons button:nth-last-child(1) {
    background-color: #247f46;
    color: rgb(255, 255, 255);
    font-weight: 600;
}

main .rightside-area nav .buttons button:focus-visible {
    outline: 2px solid #ffffff;
}

main .rightside-area nav .icons-end {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

main .rightside-area nav .icons-end i {
    font-size: 22px;
    color: var(--text-muted);
}

main .rightside-area nav .icons-end i:nth-child(1) {
    padding-right: 15px;
    border-right: 1px solid var(--border);
}

/* Optional back button for phones (not in the HTML yet, hidden unless you add it) */
.mobile-back {
    display: none;
}

main .rightside-area .bottom {
    flex: 1;
    min-height: 0;
    display: flex;
}

main .rightside-area .bottom .left {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-content: safe center; /* long text starts at the top instead of being cut off */
    flex-direction: column;
    gap: 50px;
    padding: 20px 24px;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(233, 233, 234, 0.1);
}

/* script.js hides the picture and the message with visibility:hidden, which still
   reserves their space. This removes that empty space while a project is shown. */
#frierenpic[style*="visibility: hidden"],
#msg[style*="visibility: hidden"] {
    display: none;
}

main .rightside-area .bottom .right {
    flex: 0 0 35%;
    min-width: 240px;
    padding: 20px 15px;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.1);
}

main .rightside-area .bottom .right h1 {
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 900;
}

main .rightside-area .bottom .right .sec {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex-direction: column;
}

main .rightside-area .bottom .right .sec h2 {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

main .rightside-area .bottom .right .sec p {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- Loader ---------- */
.loader-home {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background-color: rgb(59, 59, 59);
}

.loader-home i {
    margin-bottom: 30px;
    font-size: 60px;
    color: var(--text);
    animation: spindis .75s linear infinite;
}

.loader-home h1 {
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text);
}

.rest-of-words {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    color: var(--text-muted);
    text-align: center;
}

.button-style {
    margin-right: 5px;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
    background-color: rgba(234, 235, 237, 0.1);
}

@keyframes spindis {
    to { transform: rotate(360deg); }
}

/* ---------- Breakpoints ----------
   script.js decides phone vs desktop with window.innerWidth < 750 and switches
   #s / #r with inline styles. The two media queries below match that exactly. */

/* Desktop: sidebar and content are always both visible (even if a phone-sized
   window opened a project and was then resized). */
@media (min-width: 750px) {
    main .sidebar-chat,
    main .rightside-area {
        display: flex !important;
    }
}

/* Phone: the project list first, content only once openToggle() has shown #r */
@media (max-width: 749.98px) {
    main .sidebar-chat {
        flex: 1 1 100%;
        min-width: 0;
    }

    main .rightside-area {
        display: none; /* openToggle() overrides this with an inline display:flex */
    }

    main .rightside-area nav {
        padding: 6px 10px;
    }

    .mobile-back {
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin-right: 10px;
        padding: 8px 12px;
        border: none;
        border-radius: 5px;
        background-color: var(--hover-glass);
        font-weight: 700;
        cursor: pointer;
    }

    main .rightside-area .bottom {
        flex-direction: column;
        overflow-y: auto;
    }

    main .rightside-area .bottom .left {
        flex: 1 0 auto;
        justify-content: flex-start;
        padding: 24px 16px;
        gap: 24px;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    main .rightside-area .bottom .right {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        overflow: visible;
    }

    /* Bigger tap targets in the project list */
    main .sidebar-chat .dm .friends {
        padding: 0 10px 10px;
        gap: 4px;
    }

    main .sidebar-chat .dm .friends .f-li {
        padding: 10px 12px;
    }

    main .sidebar-chat .dm .friends .f-li .img-wrapper {
        width: 40px;
        height: 40px;
    }

    main .sidebar-chat .dm .friends .f-li p {
        font-size: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .loader-home i {
        animation-duration: 3s;
    }

    main .sidebar-chat .profile .right i.mute,
    main .sidebar-chat .profile .right i.fa-headphones.mute {
        animation: none;
    }
}