* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100%;
    overflow-x: auto;
    overflow-y: auto;
    user-select: none;
}

/* Bureau */
.desktop {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    position: relative;
    padding: 20px;
    padding-bottom: 72px;
    box-sizing: border-box;
    transition: opacity 0.15s ease;
}

.desktop.taskbar-peek {
    opacity: 0.12;
}

/* Grille simple : pas de flex column+wrap (souvent capricieux selon navigateur / hauteur) */
.desktop-icons {
    display: grid;
    grid-template-columns: repeat(auto-fill, 96px);
    gap: 14px 12px;
    justify-content: start;
    align-content: start;
    width: 100%;
    max-width: 1200px;
    position: relative;
    z-index: 1;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 90px;
    flex-shrink: 0;
}

.desktop-icon:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.desktop-icon:active {
    background-color: rgba(255, 255, 255, 0.3);
}

.icon-image {
    width: 48px;
    height: 48px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.icon-image svg {
    width: 100%;
    height: 100%;
}

.icon-label {
    color: white;
    font-size: 12px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    word-wrap: break-word;
}

/* Barre des tâches (Windows 11) */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background-color: rgba(30, 30, 30, 0.92);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px 0 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
    z-index: 1000;
}

.start-button {
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    border-radius: 4px;
    flex-shrink: 0;
}

.start-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.start-button.active {
    background-color: rgba(255, 255, 255, 0.15);
}

.windows-logo {
    width: 20px;
    height: 20px;
    color: #60cdff;
}

/* Champ Rechercher */
.taskbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 32px;
    padding: 0 14px 0 12px;
    margin-left: 2px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 18px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    cursor: pointer;
    flex: 0 1 220px;
    max-width: 280px;
    min-width: 100px;
    transition: background 0.2s, border-color 0.2s;
}

.taskbar-search:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.14);
}

.taskbar-search:focus-visible {
    outline: 2px solid #0078d4;
    outline-offset: 1px;
}

.taskbar-search-icon {
    width: 18px;
    height: 18px;
    opacity: 0.9;
    flex-shrink: 0;
}

.taskbar-search-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Applications épinglées (centre de la barre) */
.taskbar-pins {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    margin-left: 6px;
    padding: 0 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.taskbar-pins::-webkit-scrollbar {
    display: none;
}

.taskbar-pin {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #fff;
    text-decoration: none;
    position: relative;
    transition: background-color 0.2s;
}

.taskbar-pin:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.taskbar-pin.active::before {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 3px;
    background-color: #60cdff;
    border-radius: 2px;
}

.taskbar-pin svg {
    width: 22px;
    height: 22px;
}

.system-tray {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 0 4px 0 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    margin-left: 4px;
}

.tray-icons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tray-icons svg {
    width: 17px;
    height: 17px;
    color: white;
    cursor: default;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.tray-icons svg:hover {
    opacity: 1;
}

.tray-chevron {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.tray-chevron:hover {
    background: rgba(255, 255, 255, 0.1);
}

.clock {
    color: white;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    padding: 6px 10px;
    cursor: default;
    border-radius: 4px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.clock:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Bouton « Afficher le bureau » (bord droit) */
.show-desktop-btn {
    width: 8px;
    align-self: stretch;
    min-height: 48px;
    margin: 0 0 0 2px;
    padding: 0;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.1s;
}

.show-desktop-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Recherche outils (volant au-dessus de la barre des tâches) */
.search-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.search-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.search-flyout {
    position: fixed;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    max-height: min(70vh, 480px);
    width: min(100vw - 16px, 420px);
    padding: 14px 14px 10px;
    background: rgba(36, 36, 36, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.search-flyout.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
}

.search-flyout-title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.search-flyout-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    margin-bottom: 10px;
}

.search-flyout-field-icon {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.65);
    flex-shrink: 0;
}

.search-flyout-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.search-flyout-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.search-flyout-results {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.search-flyout-results::-webkit-scrollbar {
    width: 8px;
}

.search-flyout-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.search-result-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 10px 12px;
    margin: 2px 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:hover,
.search-result-item.is-active {
    background: rgba(255, 255, 255, 0.1);
}

.search-result-item .search-result-label {
    font-weight: 600;
}

.search-result-item .search-result-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    word-break: break-all;
}

.search-flyout-empty {
    display: none;
    margin: 8px 4px 4px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
}

.search-flyout-empty.is-visible {
    display: block;
}

/* Menu Démarrer */
.start-menu {
    position: fixed;
    bottom: 56px;
    left: 8px;
    width: 600px;
    height: 650px;
    background-color: rgba(32, 32, 32, 0.95);
    backdrop-filter: blur(40px);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 999;
    animation: slideUp 0.2s ease-out;
}

.start-menu.show {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.start-menu-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-avatar svg {
    width: 24px;
    height: 24px;
}

.user-name {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.start-menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.start-menu-content::-webkit-scrollbar {
    width: 8px;
}

.start-menu-content::-webkit-scrollbar-track {
    background: transparent;
}

.start-menu-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.start-menu-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.pinned-apps,
.all-apps {
    margin-bottom: 30px;
}

.pinned-apps h3,
.all-apps h3 {
    color: white;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    opacity: 0.8;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.app-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
}

.app-tile:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

.app-tile:active {
    transform: scale(0.98);
}

.app-icon {
    width: 40px;
    height: 40px;
    color: white;
}

.app-icon svg {
    width: 100%;
    height: 100%;
}

.app-tile span {
    color: white;
    font-size: 11px;
    text-align: center;
}

.app-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.app-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.app-item svg {
    width: 20px;
    height: 20px;
    color: white;
}

.app-item span {
    color: white;
    font-size: 13px;
}

.start-menu-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
}

.power-button {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.power-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.power-button svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .start-menu {
        width: calc(100vw - 16px);
        height: calc(100vh - 64px);
        left: 8px;
        right: 8px;
    }

    .app-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .taskbar-search-text {
        display: none;
    }

    .taskbar-search {
        flex: 0 0 40px;
        max-width: 40px;
        min-width: 40px;
        padding: 0;
        justify-content: center;
    }
}
