/* Custom Premium ImGui Design System */

:root {
    --bg-main: #07080a;
    --bg-sidebar: #07080a;
    --bg-card: #0b0c0f;
    --border-color: rgba(255, 255, 255, 0.035);
    --border-hover: rgba(56, 189, 248, 0.2);
    --accent: #38bdf8;          /* Bright Sky Blue from screenshots */
    --accent-glow: rgba(56, 189, 248, 0.15);
    --text-main: #d1d5db;       /* Muted off-white */
    --text-muted: #6b7280;      /* Muted gray */
    --text-active: #ffffff;
    --card-title-color: rgba(255, 255, 255, 0.25);
    --font-primary: 'Segoe UI', -apple-system, BlinkMacSystemFont, Tahoma, Verdana, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    background-color: #121318; /* Dark background behind the menu container */
    font-family: var(--font-primary);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Soft ambient background glow */
    background-image: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.03) 0%, transparent 60%);
}

/* Scrollbar Styling for Scrollable Panels */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Menu Window Container */
.menu-container {
    width: 780px;
    height: 480px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(56, 189, 248, 0.015);
    position: relative;
    font-size: 12px;
    letter-spacing: 0;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

/* Top Header Bar */
.menu-header {
    height: 36px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: move;
    position: relative;
    z-index: 1;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.header-logo {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 0 6px var(--accent));
    transform: translateY(2px);
    transition: filter 0.15s ease;
}

.header-logo path {
    transition: fill 0.15s ease;
}

/* Main Content Wrapper */
.menu-content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Sidebar Styling */
.sidebar {
    width: 190px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-top: 15px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding-right: 2px;
}

/* Nav Categories */
.nav-category {
    display: flex;
    flex-direction: column;
    position: relative;
}

.category-header {
    display: flex;
    align-items: center;
    height: 28px;
    position: relative;
    padding-left: 14px;
    cursor: pointer;
}

.category-header:hover .category-title {
    color: var(--accent);
}

.category-indicator {
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background-color: var(--accent);
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 0 6px var(--accent);
}

/* If any sub-category inside is active, light up the category indicator line */
.nav-category:focus-within .category-indicator,
.nav-category.active-branch .category-indicator {
    opacity: 1;
}

.category-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-active);
    letter-spacing: 0.02em;
    transition: color 0.15s ease;
}

/* Sub-categories List (Collapsible Accordion) */
.sub-category-list {
    list-style: none;
    padding-left: 20px;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, margin 0.25s ease;
}

/* Expanded state when category branch is active */
.nav-category.active-branch .sub-category-list {
    max-height: 120px; /* High enough to fit 3 sub-category items */
    opacity: 1;
    margin-top: 4px;
    margin-bottom: 4px;
}

.sub-category-item {
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    position: relative;
}

.sub-category-item:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.015);
}

/* Subcategory active bullet/indicator dot */
.sub-category-item.active {
    color: var(--text-active);
    font-weight: 500;
}

.sub-category-item::before {
    content: '';
    position: absolute;
    left: -2px;
    width: 4px;
    height: 4px;
    background-color: var(--accent);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
    box-shadow: 0 0 6px var(--accent);
}

.sub-category-item.active::before {
    opacity: 1;
    transform: scale(1);
}

/* Profile Footer in Sidebar */
.sidebar-profile {
    height: 60px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    background-color: rgba(0, 0, 0, 0.15);
    margin-top: auto;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #07080a;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-icon {
    width: 18px;
    height: 18px;
}

.profile-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.username {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-active);
    line-height: 1.2;
}

.subscription {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.2;
    margin-top: 1px;
}

/* Main Panel Layout */
.main-panel {
    flex: 1;
    background-color: transparent;
    padding: 16px;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

/* Tab Content Visibility */
.tab-content {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    height: 100%;
}

.tab-content.active {
    display: grid;
}

/* Cards (Standard containers) */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    max-height: 100%;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.05);
}

/* Single card centered layout (e.g. Settings -> General) */
.card.single-card {
    grid-column: span 2;
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
    align-self: start;
}

/* Scrollable card for longer forms (Visuals Settings) */
.card.scrollable-card {
    overflow-y: auto;
    padding-right: 10px;
}

.card-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--card-title-color);
    text-align: center;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    text-transform: uppercase;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.card-body.btn-spacing {
    gap: 10px;
}

/* Control Row Layout (Checkbox, Binds, Dropdowns) */
.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 24px;
}

.control-row > span {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
}

/* Custom Checkbox Widget */
.checkbox-container {
    display: block;
    position: relative;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: rgba(255, 255, 255, 0.25);
    background-color: rgba(255, 255, 255, 0.03);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Keybind Button Widget */
.keybind-btn {
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-main);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    min-width: 54px;
    text-align: center;
    transition: all 0.15s ease;
}

.keybind-btn:hover {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-active);
}

.keybind-btn.listening {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.2);
    animation: pulseGlow 1.2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Slider Row Widget (Stacked Label and input range) */
.slider-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 2px 0;
}

.slider-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
}

.slider-val {
    color: var(--text-muted);
    font-size: 12px;
}

/* Range Input Styling */
.range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    position: relative;
    margin: 4px 0;
}

/* CSS fill logic relies on a gradient updating in JavaScript */
.range-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: transparent;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 10px;
    width: 14px;
    border-radius: 5px;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
    transition: background-color 0.1s, transform 0.1s;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.08);
}

.range-slider::-moz-range-track {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.035);
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.range-slider::-moz-range-progress {
    background-color: var(--accent);
    height: 10px;
    border-radius: 5px 0 0 5px;
}

.range-slider::-moz-range-thumb {
    height: 10px;
    width: 14px;
    border: none;
    border-radius: 5px;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
}

/* Custom Dropdown Selector Widget */
.custom-select-wrapper {
    position: relative;
    width: 110px;
    font-size: 12px;
}

.custom-select-trigger {
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s ease;
    font-weight: 500;
}

.custom-select-trigger:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Small blue indicator dot or caret suffix inside the trigger */
.custom-select-trigger::after {
    content: "•";
    color: var(--accent);
    font-size: 14px;
    font-weight: bold;
    margin-left: 6px;
    text-shadow: 0 0 4px var(--accent);
    transition: transform 0.2s ease;
}

.custom-select-wrapper.open .custom-select-trigger::after {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideDown 0.15s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-select-wrapper.open .custom-select-options {
    display: flex;
}

.custom-select-options .option {
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.1s ease;
}

.custom-select-options .option:hover {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-active);
}

.custom-select-options .option.selected {
    color: var(--accent);
    background-color: rgba(56, 189, 248, 0.04);
}

/* Color Picker Container */
.color-picker-wrapper {
    position: relative;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.color-preview {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: border-color 0.15s, transform 0.15s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.color-picker-wrapper:hover .color-preview {
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* Invisible overlaying input type="color" */
.color-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    padding: 0;
    border: none;
}

/* Configuration Slots List (Settings -> Config) */
.config-list-box {
    border: 1px solid rgba(255, 255, 255, 0.06);
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    height: 95px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.config-item {
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: all 0.1s ease;
}

.config-item:hover {
    background-color: rgba(255, 255, 255, 0.015);
    color: var(--text-main);
}

.config-item.active {
    color: var(--accent);
    background-color: rgba(56, 189, 248, 0.04);
    font-weight: 500;
}

/* Text Input for configs */
.text-input {
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-active);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    flex: 1;
    min-width: 0;
    transition: border-color 0.15s;
}

.text-input:focus {
    border-color: var(--accent);
}

/* Action Buttons (Unload, Export, Load, etc) */
.action-btn {
    width: 100%;
    background-color: var(--accent);
    color: #000000;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    margin-top: 4px;
}

.action-btn:hover {
    opacity: 0.9;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.action-btn.outline-btn {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-main);
}

.action-btn.outline-btn:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--text-active);
    box-shadow: none;
}

.action-btn.danger-btn {
    background-color: rgba(239, 68, 68, 0.8);
    color: #ffffff;
}

.action-btn.danger-btn:hover {
    background-color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.action-btn.unload-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    margin-top: auto;
}

.action-btn.unload-btn:hover {
    background-color: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.35);
}

/* Config row with create button input combo */
.create-cfg-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.action-btn.plus-btn {
    width: 60px;
    margin-top: 0;
}

.cfg-action-buttons {
    display: flex;
    gap: 6px;
}

.cfg-action-buttons .action-btn {
    flex: 1;
    margin-top: 0;
}

.active-config-name {
    color: var(--accent);
    font-weight: 600;
}

/* Notifications styles */
.notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

.notification {
    background-color: var(--bg-card);
    border-left: 3px solid var(--accent);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    color: var(--text-active);
    padding: 10px 14px;
    border-radius: 0 4px 4px 0;
    font-size: 12px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    animation: slideInNotify 0.25s ease-out forwards;
    min-width: 200px;
}

@keyframes slideInNotify {
    from { transform: translateX(110%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification.fade-out {
    animation: fadeOutNotify 0.25s ease-in forwards;
}

@keyframes fadeOutNotify {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(110%); opacity: 0; }
}

/* Background Particles Canvas */
#particles-canvas-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    background-color: #030405;
}

/* In-menu Particles Canvas */
#particles-canvas-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* Text Input for Friends */
.text-input {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    color: var(--text-active);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s ease;
}

.text-input:focus {
    border-color: var(--accent);
}

/* Black Square/Box for Friends List */
.friends-list-box {
    background-color: #030405; /* Deep black square */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    height: 180px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Individual Friend Item */
.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 6px 10px;
    border-radius: 4px;
    color: var(--text-main);
    font-size: 12px;
    animation: fadeInFriend 0.2s ease-out;
}

@keyframes fadeInFriend {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.friend-name {
    font-weight: 500;
}

.remove-friend-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 2px 4px;
    transition: color 0.15s ease;
}

.remove-friend-btn:hover {
    color: #ef4444;
}

/* Empty list text styling */
.empty-friends-msg {
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
    margin-top: 75px;
}
