
:root {
    --bg-base: #0b0f19;
    --bg-topbar: rgba(21, 29, 48, 0.90);
    --primary-orange: #cbd5e1;
    --primary-orange-hover: #e2e8f0;
    --on-primary: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-light: #334155;
    --variant-bg: #0d1424;
    --radius-md: 12px;
    --radius-sm: 8px;
    --sidebar-width: 72px;
    --sidebar-expanded: 240px;
    --header-height: 72px;
    --separator: rgba(255, 255, 255, 0.35);
}

[data-theme="light"] {
    --bg-base: #f8fafc;
    --bg-topbar: rgba(255, 255, 255, 0.92);
    --primary-orange: #475569;
    --primary-orange-hover: #334155;
    --on-primary: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-light: #e2e8f0;
    --variant-bg: #f1f5f9;
    --separator: rgba(15, 23, 42, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    padding-top: var(--header-height);
}

/* LEFT SIDEBAR */

.left-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    height: calc(100vh - var(--header-height));
    width: var(--sidebar-width);
    background: var(--bg-topbar);
    backdrop-filter: blur(14px);
    border-right: 1px solid var(--border-light);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    transition: width 0.25s ease;
    overflow: hidden;
}

.left-sidebar:hover {
    width: var(--sidebar-expanded);
}

/* Logo */

.sidebar-logo-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
    padding: 0 8px;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 10px;
}

.sidebar-separator {
    width: 70%;
    height: 2px;
    background: var(--separator);
    margin-top: 12px;
    border-radius: 2px;
    opacity: 0.85;
}

/* Sidebar navigation */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 0 12px;
    align-items: center;
}

.sidebar-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
}

.sidebar-section-title {
    width: 100%;
    color: var(--text-muted);
    font-family: Outfit, sans-serif;
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    transition: text-align 0.25s ease;
}

/* Home button */

.sidebar-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: transparent;
    color: var(--text-main);
    border: none;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    transition:
        width 0.25s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.sidebar-btn {
    background: transparent;
    color: var(--text-main);
}

/* Dark mode: white active button */
[data-theme="dark"] .sidebar-btn.active {
    background: #ffffff;
    color: #0b0f19;
}

/* Light mode: grey active button */
[data-theme="light"] .sidebar-btn.active {
    background: #e2e8f0;
    color: #0f172a;
}

/* Hover over inactive buttons */
.sidebar-btn:not(.active):hover {
    background: var(--border-light);
    color: var(--text-main);
}

.sidebar-btn-icon {
    width: 21px;
    height: 21px;
    min-width: 21px;
    flex-shrink: 0;
}

.sidebar-btn-text {
    display: none;
    font-size: 0.88rem;
    font-weight: 800;
}

/* Expanded sidebar */

.left-sidebar:hover .sidebar-section {
    align-items: stretch;
}

.left-sidebar:hover .sidebar-section-title {
    text-align: left;
    padding-left: 4px;
}

.left-sidebar:hover .sidebar-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 0 14px;
}

.left-sidebar:hover .sidebar-btn-icon {
    margin-left: 0;
}

.left-sidebar:hover .sidebar-btn-text {
    display: inline;
}

/* TOPBAR */

.topbar {
    background: var(--bg-topbar);
    backdrop-filter: blur(14px);
    border-bottom: 2px solid rgba(148, 163, 184, .3);
    padding: 14px 20px 14px 4%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1000;
    gap: 16px;
}

.brand-container {
    display: flex;
    align-items: center;
}

.brand {
    font-family: Outfit, sans-serif;
    font-size: 1.4rem;
    font-weight: 900;
    text-decoration: none;
    color: var(--text-main);
    text-transform: uppercase;
}

.brand span {
    color: var(--primary-orange);
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-left: auto;
    margin-right: 0;
}

.admin-btn,
.theme-toggle {
    background: var(--primary-orange);
    color: var(--on-primary);
    border: none;
    font-weight: 800;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
}

.admin-btn {
    padding: 10px 18px;
    gap: 8px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.theme-toggle {
    width: 40px;
    height: 40px;
}

.admin-btn:hover,
.theme-toggle:hover {
    background: var(--primary-orange-hover);
    transform: translateY(-1px);
}

.discord-link {
    background: #5865f2;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .2s;
}

.discord-link:hover {
    background: #4752c4;
    transform: translateY(-1px);
}

.theme-icon,
.discord-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* GLOBAL TRADE CHAT */

.trade-chat {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: 320px;
    height: calc(100vh - var(--header-height));
    background: var(--bg-topbar);
    backdrop-filter: blur(14px);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 998;
}

.chat-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header h3 {
    font-family: Outfit, sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
}

.chat-status {
    font-size: 0.7rem;
    font-weight: 700;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    padding: 3px 8px;
    border-radius: 999px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    background: var(--variant-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.chat-message.system {
    background: transparent;
    border: none;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    padding: 4px;
}

.chat-user {
    display: block;
    font-weight: 800;
    color: var(--primary-orange);
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.chat-text {
    color: var(--text-main);
    word-break: break-word;
}

.chat-input-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    background: var(--variant-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
}

.chat-input:focus {
    border-color: var(--primary-orange);
}

.chat-send {
    background: var(--primary-orange);
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius-md);
    padding: 0 16px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.15s;
}

.chat-send:hover {
    background: var(--primary-orange-hover);
}

/* MODALS */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 15, 25, .85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-topbar);
    border: 1px solid var(--border-light);
    border-radius: 18px;
    padding: 28px;
    width: 100%;
    max-width: 420px;
    color: var(--text-main);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-title {
    font-family: Outfit, sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-orange);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
}

.form-group {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-control {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--variant-bg);
    color: var(--text-main);
}

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-orange);
    color: var(--on-primary);
}

.btn-secondary {
    background: var(--variant-bg);
    color: var(--text-main);
    border: 1px solid var(--border-light);
}

.error-text {
    color: #ef4444;
    font-size: 0.82rem;
    display: none;
    margin-top: 6px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* RESPONSIVE */

@media (max-width: 900px) {
    .trade-chat {
        display: none;
    }
}
