:root {
    --glass-bg: rgba(18, 20, 32, 0.55);
    --glass-bg-strong: rgba(14, 16, 26, 0.7);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-blur: 20px;
    --accent: #3d3fa8;
    --accent-hover: #4d50c9;
    --text-light: #f2f2f6;
    --text-muted: #a8aabd;
    --radius: 1rem;
}

html, body {
    min-height: 100%;
}

body {
    background-color: #10111c;
    color: var(--text-light);
    position: relative;
}

.bg-blobs {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 145, 60, 0.55), transparent 40%),
        radial-gradient(circle at 82% 12%, rgba(60, 190, 255, 0.5), transparent 45%),
        radial-gradient(circle at 78% 78%, rgba(190, 60, 255, 0.45), transparent 45%),
        radial-gradient(circle at 18% 82%, rgba(60, 110, 255, 0.5), transparent 45%),
        #10111c;
    filter: blur(70px);
}

a {
    color: #9fa4ff;
}
a:hover {
    color: #c2c5ff;
}

/* Bootstrap's default .text-muted / .form-text assume a light background
   and render almost invisibly on this dark theme. Override globally. */
.text-muted,
.form-text {
    color: var(--text-muted) !important;
}

/* Bootstrap's default dropdown menu is light-themed; match the glass look */
.dropdown-menu {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
}
.dropdown-item {
    color: var(--text-light);
}
.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
}
.dropdown-item.text-danger:hover,
.dropdown-item.text-danger:focus {
    background: rgba(220, 53, 69, 0.15);
}
.dropdown-divider {
    border-color: var(--glass-border);
}

/* Bootstrap's default pagination is also light-themed */
.page-link {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
    color: var(--text-light);
}
.page-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--glass-border);
    color: var(--text-light);
}
.page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.page-item.disabled .page-link {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--glass-border);
    color: var(--text-muted);
}

/* Glass surface, used by cards, panels, sidebar, topbar */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

/* ---------- Auth pages (login/register/forgot/reset) ---------- */
.brand-header {
    color: var(--text-light);
}
.brand-header .brand-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 0.5rem;
}
.brand-header .brand-word {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.35rem;
    text-transform: uppercase;
}
.brand-header .brand-suffix {
    font-size: 0.75rem;
    letter-spacing: 0.3rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.15rem;
}

.auth-card {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
}

.form-control-glass,
.form-select-glass {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-light);
    border-radius: 2rem;
    padding: 0.65rem 1.1rem;
}
.form-control-glass:focus,
.form-select-glass:focus {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--accent-hover);
    color: var(--text-light);
    box-shadow: 0 0 0 0.2rem rgba(93, 96, 201, 0.25);
}
.form-control-glass::placeholder {
    color: var(--text-muted);
}
textarea.form-control-glass {
    border-radius: 1rem;
}
select.form-select-glass {
    border-radius: 0.75rem;
}

.btn-accent {
    background: var(--accent);
    border: none;
    color: #fff;
    border-radius: 2rem;
    padding: 0.65rem 1.1rem;
    font-weight: 500;
}
.btn-accent:hover {
    background: var(--accent-hover);
    color: #fff;
}

/* ---------- App shell (sidebar + topbar) ---------- */
.app-shell {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
}

.app-sidebar-col {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 1rem;
}

.app-sidebar {
    width: 100%;
    padding: 1rem 0.75rem;
}
.app-sidebar-extra {
    font-size: 0.85rem;
}
.app-sidebar-extra .form-label {
    margin-bottom: 0.2rem;
}
.app-sidebar .sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem 1rem;
}
.app-sidebar .nav-link {
    color: var(--text-muted);
    padding: 0.6rem 0.75rem;
    border-radius: 0.6rem;
    font-size: 0.85rem;
    letter-spacing: 0.03rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.2rem;
}
.app-sidebar .nav-link i {
    font-size: 1rem;
}
.app-sidebar .nav-link:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.05);
}
.app-sidebar .nav-link.active {
    color: #fff;
    background: rgba(93, 96, 201, 0.35);
}

.app-main {
    flex: 1;
    min-width: 0;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    /* backdrop-filter creates a new stacking context; without an explicit
       z-index here, the app-content panel below (later in DOM order) paints
       over this element's dropdown menu instead of the menu appearing on top. */
    position: relative;
    z-index: 20;
}
.app-topbar .topbar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.app-topbar .topbar-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.app-topbar .topbar-welcome {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1;
}
.app-topbar .topbar-name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
}
.app-topbar .topbar-search {
    flex: 1;
}
.app-topbar .topbar-logo {
    font-weight: 600;
    letter-spacing: 0.2rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.app-content {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Status tabs (My Store) */
.status-tabs {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
}
.status-tabs a {
    color: var(--text-muted);
    text-decoration: none;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid transparent;
}
.status-tabs a.active {
    color: #fff;
    border-bottom-color: var(--accent-hover);
}

.item-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    overflow: hidden;
}
.item-card .item-thumb {
    height: 110px;
    background-size: cover;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.05);
}
.item-status {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03rem;
}
.item-status-published { color: #3ddc97; }
.item-status-draft { color: #f2c94c; }
.item-status-sold { color: #8a8dbf; }

/* Settings tabs */
.settings-tabs {
    display: flex;
    gap: 1.75rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}
.settings-tabs .tab-link {
    color: var(--text-muted);
    text-decoration: none;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid transparent;
}
.settings-tabs .tab-link.active {
    color: #fff;
    border-bottom-color: var(--accent-hover);
}
.settings-tabs .tab-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.placeholder-page {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

/* Messages */
.messages-layout {
    display: flex;
    gap: 1.25rem;
    min-height: 480px;
}
.conversation-list {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid var(--glass-border);
    padding-right: 1rem;
    max-height: 600px;
    overflow-y: auto;
}
.conversation-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.6rem;
    border-radius: 0.6rem;
    text-decoration: none;
    color: var(--text-light);
    margin-bottom: 0.2rem;
}
.conversation-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.conversation-item.active {
    background: rgba(93, 96, 201, 0.3);
}
.conversation-avatar,
.conversation-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.conversation-info {
    min-width: 0;
    flex: 1;
}
.conversation-name {
    font-weight: 600;
    font-size: 0.85rem;
}
.conversation-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.conversation-preview {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.thread-header {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 0.75rem;
}
.thread-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 420px;
    padding-right: 0.25rem;
}
.thread-bubble {
    max-width: 70%;
    padding: 0.5rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.85rem;
}
.thread-bubble-theirs {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 0.25rem;
}
.thread-bubble-mine {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}
.thread-bubble-time {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-top: 0.2rem;
    text-align: right;
}
.thread-composer {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

@media (max-width: 767px) {
    .app-shell {
        flex-direction: column;
    }
    .app-sidebar-col {
        width: 100%;
        position: static;
    }
    .app-topbar {
        flex-wrap: wrap;
    }
    .app-topbar .topbar-logo {
        order: 3;
        width: 100%;
        text-align: center;
    }
    .messages-layout {
        flex-direction: column;
    }
    .conversation-list {
        width: 100%;
        border-right: none;
        max-height: none;
    }
}
