/* =========================================================
   THEME
========================================================= */

:root {
    --bg: #0f1117;
    --panel: #161b22;
    --panel-2: #1d2430;
    --border: #2d3642;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --hover: rgba(88,166,255,.12);
    --shadow: rgba(0,0,0,.35);
    --success: #3fb950;
    --danger: #f85149;
    --color-tg: #229ED9;
}

[data-theme="light"] {
    --bg: #f3f5f7;
    --panel: #ffffff;
    --panel-2: #f7f8fa;
    --border: #d8dee6;
    --text: #111827;
    --text-muted: #6b7280;
    --accent: #2563eb;
    --hover: rgba(37,99,235,.08);
    --shadow: rgba(0,0,0,.08);
    --success: #16a34a;
    --danger: #dc2626;
}

/* =========================================================
   BASE
========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, sans-serif;
    overflow: hidden;
}

/* =========================================================
   APP LAYOUT
========================================================= */

.app-shell {
    display: flex;
    width: 100%;
    height: 100dvh;
}

/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
    width: 240px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* TOP */

.sidebar-top {
    height: 50px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

    .sidebar-logo > img {
        width: 30px;
        height: 30px;
    }

/* NAV */

.sidebar-nav {
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.sidebar-group-title {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: .08em;
}

.sidebar-link {
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    transition: .15s ease;
}

    .sidebar-link:hover {
        background: var(--hover);
    }

    .sidebar-link.active {
        background: var(--color-tg);
        color: white;
    }

.sidebar-icon {
    width: 22px;
    display: flex;
    justify-content: center;
    font-size: 18px;
}

/* BOTTOM */

.sidebar-bottom {
    padding: 14px;
    border-top: 1px solid var(--border);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    margin-left: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .theme-toggle:hover {
        background: var(--hover);
    }


.user-card-main {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-2);
}

.user-info {
    flex: 1;
    min-width: 0;
    text-decoration: underline;
    color: var(--text);
}

.user-name {
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
    transition: opacity .2s;
}

    .user-name:hover {
        opacity: .8;
    }

    .user-name:active {
        opacity: .6;
    }
    .user-name:visited {
        color: inherit;
    }

.logout-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .15s;
}

    .logout-btn:hover {
        background: var(--danger);
        border-color: var(--danger);
        color: white;
    }

/* =========================================================
   MAIN
========================================================= */

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0; 
}

/* =========================================================
   TOPBAR
========================================================= */

.topbar {
    height: 50px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
    display: flex;
    align-items: center;
    padding: 0 24px;
    flex-shrink: 0;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
}

/* =========================================================
   CONTENT
========================================================= */

.content {
    flex: 1;
    overflow: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* =========================================================
   PAGE
========================================================= */

.page {
    width: 100%;
}

/* =========================================================
   PANEL
========================================================= */

.panel-block {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 4px 20px var(--shadow);
}


/* =========================================================
   SCROLLBAR
========================================================= */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-muted);
    }

/* =========================================================
   INPUTS
========================================================= */

input,
select,
textarea {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    outline: none;
    transition: .15s ease;
    font-size: 14px;
}

textarea {
    min-height: 120px;
    padding-top: 12px;
    resize: vertical;
}

    input:focus,
    select:focus,
    textarea:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(88,166,255,.15);
    }

/* =========================================================
   BUTTON
========================================================= */

button {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn {
    height: 44px;
    padding: 0 18px;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    transition: .15s ease;
}

    .btn:hover {
        opacity: .92;
        transform: translateY(-1px);
    }

/* =========================================================
   EMOJI
========================================================= */

img.emoji {
    width: 18px;
    height: 18px;
    vertical-align: -3px;
    margin-right: 0px;
}

.emoji-btn {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.emoji-btn-theme {
    width: 20px;
    height: 20px;
    vertical-align: -3px;
    object-fit: contain;
}

.emoji-inline {
    width: 16px;
    height: 16px;
    vertical-align: -3px;
    margin-right: 4px;
}

.emoji-big {
    width: 20px;
    height: 20px;
    vertical-align: -3px;
    margin-right: 0px;
}

.emoji-super-big {
    width: 40px;
    height: 40px;
    vertical-align: -8px;
    margin-right: 0;
}

/* =========================================================
   THEME TRANSITIONS
========================================================= */

html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, fill .18s ease, stroke .18s ease, box-shadow .18s ease !important;
}

/* =========================================================
   MOBILE MENU BUTTON
========================================================= */

.mobile-menu-btn {
    display: none;
    width: 38px;
    height: 38px;
    border: none;
    margin-right: 10px;
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* =========================================================
   SIDEBAR OVERLAY
========================================================= */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    opacity: 0;
    visibility: hidden;
    transition: .2s;
    z-index: 90;
}

/* =========================================================
   TABLET
========================================================= */



/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    .mobile-menu-btn {
        display: flex;
    }

    .topbar {
        padding: 0 16px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100dvh;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 100;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

        .sidebar.open {
            transform: translateX(0);
        }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity .2s;
        z-index: 90;
    }

        .sidebar-overlay.show {
            opacity: 1;
            visibility: visible;
        }

    .app-main {
        width: 100%;
    }
}

.sidebar-footer {
    margin-top: -10px;
    text-align: center;
}

    .sidebar-footer a {
        font-size: 10px;
        font-weight: 500;
        color: var(--text-muted);
        text-decoration: none;
        opacity: .5;
        transition: .15s ease;
    }

        .sidebar-footer a:hover {
            color: var(--accent);
            opacity: 0.6;
        }

