/* public/assets/css/style.css */
/* Style basique : login, bureau, fenêtres */

* {
    box-sizing: border-box;
    font-family: 'Inter', system-ui, sans-serif;
    text-decoration: none;
}

body,
html {
    margin: 0;
    padding: 0;
    font-family: system-ui, sans-serif;
    background: #111;
    color: #fff;
}

.hidden {
    display: none;
}

.cloud-body {
    background: #0f0f10;
    color: #fff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    transition: background-image 0.3s ease-in-out, opacity 0.4s ease;
}

/* Login screen */
#login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 360px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 32px 28px;
    color: #222;
    text-align: center;
}

.login-box .os-logo {
    width: 100px;
}

.login-box h1 {
    margin-top: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #111;
    margin-bottom: 12px;
}

.login-box h2 {
    font-size: 1rem;
    font-weight: 500;
    color: black;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    backdrop-filter: blur(20px);
    padding: 10px 20px;
}

/* Labels & champs */
.login-box label {
    font-size: 0.8rem;
    color: black;
    margin-top: 10px;
    display: block;
    text-align: left;
    font-weight: 500;
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.9rem;
    margin-top: 6px;
    box-sizing: border-box;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.login-box input:focus {
    outline: none;
    border-color: #0078ff;
    box-shadow: 0 0 0 3px rgba(0, 120, 255, 0.2);
}

#login-submit {
    width: 100%;
    padding: 10px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    background: #0078ff;
    color: #fff;
    font-weight: 600;
    margin-top: 8px;
}

.error-msg {
    color: #f55;
    font-size: .8rem;
    min-height: 1em;
    margin-top: 8px;
    text-align: center;
}

/* Desktop */
#desktop-screen {
    position: fixed;
    inset: 0;
    background: #000;
    overflow: hidden;
    color: #fff;
}

#desktop-wallpaper {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(1);
}

#desktop-icons {
    position: absolute;
    top: 0;
    left: 0;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.desktop-icon {
    width: 80px;
    text-align: center;
    color: white;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s ease;
    padding: 10px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    cursor: pointer;
    z-index: 2;
}

.desktop-icon:hover {
    background-color: rgba(0,0,0,0.05);
}

.desktop-icon-img svg {
    height: 30px;
    width: 30px;
    margin-bottom: 0px;
}

.desktop-icon-label {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Fenêtres */
#window-layer {
    position: relative;
    width: 100%;
    height: calc(100% - 60px);
}

.window {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    user-select: none;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.25s ease, transform 0.25s ease;
    will-change: transform, opacity;
    transform-origin: center center;
}

.window.active {
    opacity: 1;
    transform: scale(1);
}

.window.dragging {
    opacity: 0.9;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}

/* --- Animation de minimisation --- */
.window.minimizing {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.25s ease;
}

/* --- Animation de restauration --- */
.window.restoring {
    animation: restoreWindow 0.3s ease;
}

@keyframes restoreWindow {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.window-header {
    height: 36px;
    background: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    cursor: grab;
    font-weight: 600;
    margin: 5px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.window-header:active {
    cursor: grabbing;
}

.window-title {
    color: #222;
}

.window-actions button {
    border: none;
    width: 10px;
    height: 12px;
    margin-left: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    border-radius: 20px;
}

.btn-min {
    background: #fcbf49;
}

.btn-max {
    background: #4dabf7;
}

.btn-close {
    background: #ff5f57;
    color: #fff;
}

.window-resize {
    position: absolute;
}

.window-resize.top {
    top: -3px;
    left: 0;
    right: 0;
    height: 6px;
    cursor: n-resize;
}

.window-resize.bottom {
    bottom: -3px;
    left: 0;
    right: 0;
    height: 6px;
    cursor: s-resize;
}

.window-resize.left {
    top: 0;
    bottom: 0;
    left: -3px;
    width: 6px;
    cursor: w-resize;
}

.window-resize.right {
    top: 0;
    bottom: 0;
    right: -3px;
    width: 6px;
    cursor: e-resize;
}

.window-resize.top-left {
    top: -3px;
    left: -3px;
    width: 8px;
    height: 8px;
    cursor: nw-resize;
}

.window-resize.top-right {
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    cursor: ne-resize;
}

.window-resize.bottom-left {
    bottom: -3px;
    left: -3px;
    width: 8px;
    height: 8px;
    cursor: sw-resize;
}

.window-resize.bottom-right {
    bottom: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    cursor: se-resize;
}

.window-body {
    flex: 1;
    overflow: auto;
    padding: 5px;
    padding-top: 0px;
}

.window-loading {
    text-align: center;
    padding: 40px;
    font-size: 0.9rem;
    color: #555;
}

/* --- Aperçu de fenêtre --- */
.window-preview {
    position: fixed;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: translateY(10px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    z-index: 2000;
    cursor: pointer;
}

.window-preview.show {
    transform: translateY(0);
    opacity: 1;
}

.window-preview.fadeout {
    transform: translateY(10px);
    opacity: 0;
}

.window-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(0.5px) brightness(0.98);
    transition: filter 0.3s ease;
}

.window-preview:hover img {
    filter: brightness(1);
}

/* --- Taskbar --- */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;

    background: rgba(255, 255, 255, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.2);

    color: white;
    font-family: 'Inter', system-ui, sans-serif;
    z-index: 1000;
    transition: background 0.3s ease, opacity 0.3s ease;
}

#taskbar:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Gauche */
.taskbar-left .brand {
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    color: white;
}

/* Droite */
.taskbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Heure + date */
#taskbar-datetime {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
}

#taskbar-time {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.9;
}

#taskbar-date {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* --- Dock central de la taskbar --- */
.taskbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 6px 12px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Icônes */
.taskbar-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 10px;
    transition: background 0.2s ease, transform 0.15s ease;
}

.taskbar-icon:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.taskbar-icon img {
    width: 22px;
    height: 22px;
    display: block;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

.taskbar-icon:hover img {
    opacity: 1;
}

.taskbar-app {
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 0;
    position: relative;
    background: none;
    border: none;
}

.taskbar-app:hover {
    transform: translateY(-4px) scale(1.05);
}

.taskbar-app img {
    height: 100%;
    width: 100%;
    pointer-events: none;
}

@keyframes bounceInDock {
    0% {
        transform: scale(0.2) translateY(30px);
        opacity: 0;
    }

    60% {
        transform: scale(1.1) translateY(-4px);
        opacity: 1;
    }

    100% {
        transform: scale(1) translateY(0);
    }
}

.taskbar-app {
    animation: bounceInDock 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Icône utilisateur */
#user-menu-btn img {
    width: 30px;
    height: 30px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    background-color: white;
    padding: 5px;
    border-radius: 50px;
}

#user-menu-btn img:hover {
    opacity: 1;
}

/* --- Popup utilisateur glassmorphism --- */
#user-popup {
    position: absolute;
    bottom: 55px;
    right: 16px;
    min-width: 200px;

    /* Transparence légère, importante pour permettre le blur */
    background: rgba(255, 255, 255, 0.18);
    background-clip: padding-box;

    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);

    /* Le blur verre dépoli */
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);

    z-index: 1100;
    padding: 14px;

    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: translateY(0);
    opacity: 1;

    /* Important: le popup doit créer son propre contexte sans casser le backdrop-filter */
    will-change: backdrop-filter, transform, opacity;
}

#user-popup.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.user-popup-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

/* Partie infos utilisateur */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    padding: 4px;
    backdrop-filter: blur(5px);
}

#user-popup-name {
    font-weight: 600;
    color: white;
}

/* Actions */
.user-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.user-actions button {
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 10px;
    padding: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.user-actions button:hover {
    background: #0078ff;
    color: #fff;
}

/* Installer */
.install-body {
    background: #0f0f10;
    color: #fff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    transition: background-image 0.3s ease-in-out, opacity 0.4s ease;
}

/* effet fadeIn lors du changement */
.install-body.fade-transition {
    opacity: 0;
}

.install-wrapper {
    width: 360px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 32px 28px;
    color: #222;
    text-align: center;
}

.install-wrapper .os-logo {
    width: 100px;
}

/* Titres */
.install-wrapper h1 {
    margin-top: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #111;
    margin-bottom: 12px;
}

.install-wrapper h2 {
    font-size: 1rem;
    font-weight: 500;
    color: black;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    backdrop-filter: blur(20px);
    padding: 10px 20px;
}

/* Labels & champs */
.install-wrapper label {
    font-size: 0.8rem;
    color: black;
    margin-top: 10px;
    display: block;
    text-align: left;
    font-weight: 500;
}

.install-wrapper input[type="text"],
.install-wrapper input[type="password"],
.install-wrapper input[type="color"] {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.9rem;
    margin-top: 6px;
    box-sizing: border-box;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.install-wrapper input:focus {
    outline: none;
    border-color: #0078ff;
    box-shadow: 0 0 0 3px rgba(0, 120, 255, 0.2);
}

/* Bouton principal */
.install-wrapper button {
    width: 100%;
    margin-top: 22px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #0078ff, #00b0ff);
    color: #fff;
    padding: 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.install-wrapper button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 120, 255, 0.4);
}

/* Fond général de l’installation */

.install-error {
    background: #d11414;
    border: 1px solid #ea4c4c;
    color: #ffffff;
    border-radius: 10px;
    padding: 8px;
    font-size: .75rem;
    margin-bottom: 12px;
    margin-top: 20px;
}

/* --- Install step 2 enhancements --- */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.color-picker-wrapper input[type="color"] {
    border: none;
    background: transparent;
    width: 40px;
    height: 30px;
    cursor: pointer;
}

.wallpaper-section {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-btn {
    border: 2px solid #0078ff;
    color: #0078ff;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.upload-btn:hover {
    background: #338fff2b;
}

/* --- Couleur principale moderne --- */
.color-picker-modern {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.color-preview {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background-color: #0078ff;
    border: 2px solid white;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.color-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.8);
}

/* Masquer le vrai input color */
.color-picker-modern input[type="color"] {
    display: none;
}

.color-picker-modern span {
    font-family: monospace;
    font-size: 0.85rem;
    color: black;
}

/* --- Sélecteur de fond d’écran moderne --- */
.wallpaper-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.wallpaper-preview {
    position: relative;
    width: 100%;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wallpaper-preview:hover {
    transform: scale(1.02);
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.8);
}

.wallpaper-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.wallpaper-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    transition: opacity 0.25s ease;
}

.wallpaper-preview:hover .wallpaper-overlay {
    opacity: 1;
}

/* --- Loader installation --- */
.install-loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: opacity 0.3s ease;
}

.install-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-ring {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(0, 0, 0, 0.1);
    border-top-color: #0078ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.install-loader p {
    margin-top: 20px;
    color: #333;
    font-size: 0.95rem;
    font-weight: 500;
}