/* ==========================================================================
   🪟 JEREMOS - WINDOW MANAGER STYLES (jeremos-wm.css)
   Fenêtres, barre de titre, contrôles, barre d'outils, resize handles
   ========================================================================== */

/* ==========================================================================
   WINDOWS ENGINE
   ========================================================================== */
#win-windows-container {
    position: absolute;
    inset: 0;
    z-index: 30;
    pointer-events: none;
}

.win-window {
    position: absolute;
    display: flex;
    flex-direction: column;
    background: var(--win-surface);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border-radius: var(--win-radius);
    box-shadow: var(--win-shadow-window);
    border: 1px solid var(--win-glass-border);
    overflow: hidden;
    pointer-events: auto;
    transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 420px;
    min-height: 300px;
}

.win-window.active {
    box-shadow: var(--win-shadow-active);
    border-color: var(--win-glass-border-active);
}

.win-window.minimized {
    opacity: 0 !important;
    transform: scale(0.9) translateY(40px) !important;
    pointer-events: none !important;
}

.win-window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
}

/* Window Titlebar */
.win-titlebar {
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--win-glass-border);
    cursor: grab;
    user-select: none;
}

.win-window.active .win-titlebar {
    background: rgba(255, 255, 255, 0.06);
}

.win-titlebar:active {
    cursor: grabbing;
}

.win-titlebar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.win-titlebar-icon {
    font-size: 16px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.win-titlebar-icon img,
.win-titlebar-icon .win-icon-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 3px;
    display: block;
}

.win-titlebar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--win-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.win-titlebar-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.win-control-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--win-text-muted);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.win-control-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--win-text);
}

.win-control-btn.close:hover {
    background: #ef4444;
    color: white;
}

/* Window Address Bar & Secondary Controls */
.win-toolbar {
    height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid var(--win-glass-border);
}

.win-toolbar-btn {
    height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: var(--win-text-muted);
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.win-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.win-toolbar-btn.active {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(96, 165, 250, 0.5);
    color: #60a5fa;
}

.win-address-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

input.win-address-bar {
    width: 100%;
    height: 28px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0 32px 0 10px;
    font-size: 11px;
    color: #cbd5e1;
    font-family: inherit;
    outline: none;
    cursor: text;
    user-select: all;
    -webkit-user-select: all;
    transition: all 0.2s ease;
}

input.win-address-bar:focus {
    background: rgba(0, 0, 0, 0.55);
    border-color: rgba(96, 165, 250, 0.6);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
    color: #ffffff;
}

input.win-address-bar::selection {
    background: rgba(59, 130, 246, 0.5);
    color: #ffffff;
}

.win-address-copy-icon {
    position: absolute;
    right: 8px;
    color: var(--win-text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.15s ease;
    padding: 4px;
}

.win-address-copy-icon:hover {
    color: #60a5fa;
}

/* Window Content Body */
.win-body {
    flex: 1;
    position: relative;
    background: var(--win-surface-solid);
    overflow: hidden;
}

.win-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

.win-loader {
    position: absolute;
    inset: 0;
    background: var(--win-surface-solid);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.win-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--win-accent);
    border-radius: 50%;
    animation: winSpinner 0.8s linear infinite;
}

@keyframes winSpinner {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   PAGE BANNER TOAST (RECOMMANDATION NOUVEL ONGLET - 10 SECONDES)
   ========================================================================== */
.win-page-banner-toast {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 12px;
    padding: 7px 12px 7px 16px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(96, 165, 250, 0.45);
    border-radius: 9999px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5), 0 0 25px rgba(59, 130, 246, 0.3);
    color: #f8fafc;
    font-size: 12px;
    font-weight: 500;
    width: max-content;
    max-width: calc(100% - 24px);
    box-sizing: border-box;
    white-space: nowrap !important;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    animation: bannerToastSlideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.win-page-banner-toast.fade-out {
    opacity: 0 !important;
    transform: translate(-50%, -14px) scale(0.96) !important;
    pointer-events: none;
}

.win-page-banner-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.win-page-banner-icon {
    color: #38bdf8;
    font-size: 14px;
    flex-shrink: 0;
}

.win-page-banner-text {
    color: #e2e8f0;
    line-height: 1.3;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-shrink: 1;
}

.win-page-banner-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.45), rgba(99, 102, 241, 0.45));
    border: 1px solid rgba(147, 197, 253, 0.55);
    border-radius: 20px;
    color: #ffffff;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap !important;
    flex-shrink: 0;
}

.win-page-banner-link:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.75), rgba(99, 102, 241, 0.75));
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.55);
    transform: translateY(-1px);
    color: #ffffff;
}

.win-page-banner-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #94a3b8;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.win-page-banner-close:hover {
    background: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    transform: rotate(90deg);
}

@keyframes bannerToastSlideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

/* Resize Handles */
.win-resize-handle {
    position: absolute;
    z-index: 100;
}

.win-resize-handle.n  { top: -4px; left: 8px; right: 8px; height: 8px; cursor: ns-resize; }
.win-resize-handle.s  { bottom: -4px; left: 8px; right: 8px; height: 8px; cursor: ns-resize; }
.win-resize-handle.e  { right: -4px; top: 8px; bottom: 8px; width: 8px; cursor: ew-resize; }
.win-resize-handle.w  { left: -4px; top: 8px; bottom: 8px; width: 8px; cursor: ew-resize; }
.win-resize-handle.ne { top: -4px; right: -4px; width: 12px; height: 12px; cursor: nesw-resize; }
.win-resize-handle.nw { top: -4px; left: -4px; width: 12px; height: 12px; cursor: nwse-resize; }
.win-resize-handle.se { bottom: -4px; right: -4px; width: 12px; height: 12px; cursor: nwse-resize; }
.win-resize-handle.sw { bottom: -4px; left: -4px; width: 12px; height: 12px; cursor: nesw-resize; }



/* --- Windows Light Theme Overrides --- */
/* Windows in Light Theme */
body.theme-light .win-window {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.18);
}

body.theme-light .win-window.active {
    border-color: #3b82f6;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.22), 0 0 0 1px #3b82f6;
}

body.theme-light .win-titlebar {
    background: #f8fafc;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.theme-light .win-window.active .win-titlebar {
    background: #f1f5f9;
}

body.theme-light .win-titlebar-title {
    color: #0f172a;
    font-weight: 600;
}

body.theme-light .win-control-btn {
    color: #475569;
}

body.theme-light .win-control-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #0f172a;
}

body.theme-light .win-control-btn.close:hover {
    background: #ef4444;
    color: white;
}

body.theme-light .win-toolbar {
    background: #f1f5f9;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.theme-light .win-toolbar-btn {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: #334155;
}

body.theme-light .win-toolbar-btn:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: rgba(0, 0, 0, 0.2);
}

body.theme-light .win-toolbar-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #1d4ed8;
}

body.theme-light input.win-address-bar {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #0f172a;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.theme-light input.win-address-bar:focus {
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    color: #0f172a;
}

body.theme-light .win-address-copy-icon {
    color: #64748b;
}

body.theme-light .win-address-copy-icon:hover {
    color: #0f172a;
}

/* Page Banner Toast in Light Theme */
body.theme-light .win-page-banner-toast {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.35);
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.12), 0 0 20px rgba(99, 102, 241, 0.15);
    color: #0f172a;
}

body.theme-light .win-page-banner-text {
    color: #1e293b;
}

body.theme-light .win-page-banner-icon {
    color: #4f46e5;
}

body.theme-light .win-page-banner-link {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.9), rgba(99, 102, 241, 0.9));
    border-color: rgba(67, 56, 202, 0.4);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

body.theme-light .win-page-banner-link:hover {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    color: #ffffff;
}

body.theme-light .win-page-banner-close {
    background: rgba(0, 0, 0, 0.06);
    color: #64748b;
}

body.theme-light .win-page-banner-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}


