/* =============================================
   WINDOW MANAGER STYLES
   Подключается в user_base.html после theme.css
   ============================================= */

/* ---- Taskbar ---- */
.wm-taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: var(--phoenix-emphasis-bg);
    border-top: 1px solid var(--phoenix-border-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    z-index: 10000;
    font-family: 'Nunito Sans', sans-serif;
    backdrop-filter: blur(8px);
}

.wm-taskbar-inner {
    display: flex;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
}

.wm-taskbar-inner::-webkit-scrollbar {
    height: 3px;
}

.wm-taskbar-inner::-webkit-scrollbar-thumb {
    background: var(--phoenix-border-color);
    border-radius: 2px;
}

.wm-taskbar-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 4px;
    background: var(--phoenix-card-bg);
    border: 1px solid var(--phoenix-border-color);
    cursor: pointer;
    white-space: nowrap;
    font-size: 12px;
    color: var(--phoenix-body-color);
    transition: background 0.15s, box-shadow 0.15s;
    max-width: 200px;
}

.wm-taskbar-item:hover {
    background: var(--phoenix-primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.wm-taskbar-title {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.wm-taskbar-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.wm-taskbar-count {
    font-size: 11px;
    color: var(--phoenix-body-color);
    opacity: 0.6;
    margin-left: 8px;
    flex-shrink: 0;
}

/* ---- Dock Preview Overlay ---- */
.wm-dock-preview {
    position: fixed;
    background: var(--phoenix-primary);
    opacity: 0.12;
    border: 2px dashed var(--phoenix-primary);
    border-radius: 8px;
    z-index: 9999;
    pointer-events: none;
    transition: all 0.15s ease;
}

/* ---- WinBox Phoenix Theme Overrides ---- */
.wb-phoenix-theme {
    border-radius: 8px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08) !important;
    overflow: hidden;
    border: 1px solid var(--phoenix-border-color) !important;
    background: var(--phoenix-card-bg) !important;
}

.wb-phoenix-theme .wb-header {
    background: var(--phoenix-emphasis-bg) !important;
    color: var(--phoenix-body-color) !important;
    border-bottom: 1px solid var(--phoenix-border-color);
    font-family: 'Nunito Sans', sans-serif !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    height: 30px !important;
    line-height: 30px !important;
}

.wb-phoenix-theme .wb-title {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: var(--phoenix-body-color);
}

.wb-phoenix-theme .wb-body {
    background: var(--phoenix-card-bg) !important;
    color: var(--phoenix-body-color) !important;
    padding: 4px !important;
    overflow: auto !important;
}

.wb-phoenix-theme .wb-control {
    gap: 2px;
    display: flex;
    align-items: center;
    padding-right: 4px;
}
.wb-phoenix-theme .wb-control span {
    color: var(--phoenix-body-color);
    opacity: 0.7;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
}
.wb-phoenix-theme .wb-control span:hover {
    opacity: 1;
    background: rgba(var(--phoenix-body-color-rgb, 0, 0, 0), 0.1);
}

.wb-phoenix-theme .wb-n,
.wb-phoenix-theme .wb-s,
.wb-phoenix-theme .wb-w,
.wb-phoenix-theme .wb-e,
.wb-phoenix-theme .wb-nw,
.wb-phoenix-theme .wb-ne,
.wb-phoenix-theme .wb-sw,
.wb-phoenix-theme .wb-se {
}

/* Compact mode — remove large Bootstrap padding inside windows */
.wb-phoenix-theme .wb-body .card-body {
    padding: 4px !important;
}
.wb-phoenix-theme .wb-body .bg-body-emphasis {
    padding: 4px !important;
}
.wb-phoenix-theme .wb-body .p-4 {
    padding: 4px !important;
}
.wb-phoenix-theme .wb-body .p-md-5 {
    padding: 4px !important;
}

/* ---- Static mode — hide WM UI ---- */
body.wm-static-mode .wm-taskbar {
    display: none !important;
}

body.wm-static-mode .wm-dock-preview {
    display: none !important;
}

/* ---- Windowed mode — body padding for taskbar ---- */
body.wm-windowed-mode {
    padding-bottom: 48px;
}

/* ---- Responsive — mobile: force static ---- */
@media (max-width: 768px) {
    .wm-taskbar {
        display: none !important;
    }

    .wm-dock-preview {
        display: none !important;
    }

    body.wm-windowed-mode [data-wm-section] {
        position: static !important;
        width: 100% !important;
        height: auto !important;
    }

    #wm-toggle-btn {
        display: none !important;
    }
}

/* ---- Window appear animation ---- */
.wb-phoenix-theme {
    animation: wmWindowAppear 0.2s ease-out;
}

@keyframes wmWindowAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---- Focus ring for active window ---- */
.wb-phoenix-theme.focus {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
    border-color: var(--phoenix-primary) !important;
}

/* ---- Dark theme ---- */
[data-theme="dark"] .wb-phoenix-theme {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .wb-phoenix-theme.focus {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .wm-taskbar {
    background: rgba(15, 23, 42, 0.9);
    border-top-color: #1e293b;
}

[data-theme="dark"] .wm-taskbar-item {
    background: #0f172a;
    border-color: #1e293b;
    color: #e2e8f0;
}

[data-theme="dark"] .wm-taskbar-item:hover {
    background: var(--phoenix-primary);
    color: #ffffff;
}

[data-theme="dark"] .wm-dock-preview {
    opacity: 0.18;
}

/* ---- Modal z-index above windows ---- */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1054 !important;
}

/* ---- Container-content override for windowed mode ---- */
body.wm-windowed-mode .container-content {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ---- Force full width for sections inside WinBox windows ---- */
.wb-body [data-wm-section] {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ---- Virtual Desktop: scrollable workspace ---- */
body.wm-windowed-mode .winbox {
    position: absolute !important;
}

body.wm-windowed-mode #spa-content-block {
    position: relative;
    min-height: 100%;
}

/* Hide vertical navbar shell in windowed mode (content is in a window) */
body.wm-windowed-mode .navbar-vertical {
    display: none !important;
}

/* Compact shares list in window — trading terminal density */
.wb-phoenix-theme .wb-body #shares-list-section,
.wb-phoenix-theme .wb-body .navbar-vertical-content {
    padding: 2px !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .navbar-nav {
    padding-left: 0 !important;
    gap: 0 !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .nav-item,
.wb-phoenix-theme .wb-body #shares-list-section .nav-item-wrapper {
    padding: 2px 4px !important;
    margin: 0 !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .nav-item-wrapper.user-pt-2 {
    padding-top: 2px !important;
    padding-bottom: 0 !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .nav-link {
    padding: 2px 4px !important;
    margin: 0 !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .nav-link-icon {
    margin: 0 !important;
    padding: 0 !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .parent-wrapper.label-1 {
    margin-left: 2px !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .hover-actions {
    margin-left: -24px !important;
    margin-top: -3px !important;
}
/* Smaller share icons */
.wb-phoenix-theme .wb-body #shares-list-section .avatar.avatar-m {
    width: 24px !important;
    height: 24px !important;
    flex: 0 0 24px !important;
    margin: 0 2px !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .avatar.avatar-m img {
    width: 24px !important;
    height: 24px !important;
}
/* Smaller ticker text */
.wb-phoenix-theme .wb-body #shares-list-section .fs-shares {
    font-size: 0.65rem !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .fw-bold {
    font-size: 0.7rem !important;
}
/* Compact price row */
.wb-phoenix-theme .wb-body #shares-list-section .row-cols-5 {
    gap: 0 !important;
    margin: 0 !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .row-cols-5 > .col {
    padding: 0 2px !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .price {
    font-size: 0.65rem !important;
}
/* Tiny badges */
.wb-phoenix-theme .wb-body #shares-list-section .badge.badge-shares {
    font-size: 0.55rem !important;
    padding: 0 3px !important;
    line-height: 1.3 !important;
}
/* Company name smaller */
.wb-phoenix-theme .wb-body #shares-list-section .fw-semibold {
    font-size: 0.6rem !important;
}
/* Reduce spacing between items */
.wb-phoenix-theme .wb-body #shares-list-section .row.fs-9 {
    margin-bottom: 1px !important;
}
.wb-phoenix-theme .wb-body #shares-list-section .d-flex.flex-row {
    gap: 2px !important;
}
/* Tighter label wrapper */
.wb-phoenix-theme .wb-body #shares-list-section .parent-wrapper.label-10 {
    min-width: 30px !important;
}
/* Hide some spacing elements */
.wb-phoenix-theme .wb-body #shares-list-section .col:empty {
    display: none !important;
}

/* Static mode — chart height before WinBox applies its own */
.echart-portfolio-chart {
    height: 300px;
    width: 100%;
}

/* Compact echarts inside windows */
.wb-phoenix-theme .wb-body .echart-portfolio-chart {
    min-height: 150px !important;
    max-height: 220px !important;
    height: 180px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}
.echart-portfolio-chart-large {
    height: 280px;
    width: 100%;
}

.wb-phoenix-theme .wb-body .echart-portfolio-chart-large {
    min-height: 150px !important;
    max-height: 220px !important;
    height: 180px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}
/* Also target the chart wrapper row to reduce space */
.wb-phoenix-theme .wb-body .echart-portfolio-chart > div,
.wb-phoenix-theme .wb-body .echart-portfolio-chart-large > div {
    width: 100% !important;
}

/* ---- Window Snap Guides ---- */
.wm-snap-guides {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10001;
    overflow: hidden;
}

.wm-snap-guide {
    position: absolute;
    pointer-events: none;
}

.wm-snap-guide--vertical {
    width: 1px;
}

.wm-snap-guide--horizontal {
    height: 1px;
}

.wm-snap-guide--visible {
    background: var(--phoenix-primary, #2c7be5);
    opacity: 0.6;
}

/* pf-positions: Fill window body so grids stretch with window */
.wb-phoenix-theme .wb-body #pf-positions-section {
    height: 100% !important;
    overflow: hidden !important;
}

.wb-phoenix-theme .wb-body #pf-positions-section > div {
    height: 100% !important;
}

.wb-phoenix-theme .wb-body #pf-positions-section .tab-content {
    overflow: hidden !important;
}

.wb-phoenix-theme .wb-body #pf-positions-section .tab-pane {
    height: 100%;
}

.wb-phoenix-theme .wb-body #pf-positions-section #grid,
.wb-phoenix-theme .wb-body #pf-positions-section #bonds {
    height: 100% !important;
}

/* pf-funds: Fill window body so grid stretches with window */
.wb-phoenix-theme .wb-body #pf-funds-section {
    height: 100% !important;
    overflow: hidden !important;
}

.wb-phoenix-theme .wb-body #pf-funds-section > div {
    height: 100% !important;
}

.wb-phoenix-theme .wb-body #pf-funds-section #table_funds {
    height: 100% !important;
}

