* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1A91CD;
    --secondary-color: #7db9e8;
    --taskbar-color: rgba(0, 0, 0, 0.90);
    --window-header-color: #333;
    --button-color: #3b3b3b;
    --button-hover-color: #4b4b4b;
    --accent-color: #1A91CD;
}

body {
    background-color: var(--primary-color);
    background: linear-gradient(to bottom, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

/* Boot Screen */
#boot-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    background: black;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    z-index: 1000;
}

#boot-logo {
    font-size: 48px;
    margin-bottom: 20px;
}

#boot-progress {
    width: 300px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
}

#boot-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary-color);
    transition: width 2s;
}

/* Desktop */
#desktop {
    width: 100%;
    height: 100%;
    position: relative;
    display: none;
}

/* Taskbar */
#taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background-color: rgba(36, 36, 36, 0.7); /* Semi-transparent dark base */
    backdrop-filter: blur(15px); /* Blur effect for glass appearance */
    -webkit-backdrop-filter: blur(15px); /* For Safari support */
    display: flex;
    align-items: center;
    justify-content: center; /* Center icons like Windows 11 */
    z-index: 900;
    border-top: 1px solid rgba(255, 255, 255, 0.05); /* Subtle highlight at top */
    box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.05); /* Subtle shadow */
  }
  
  /* Style for taskbar icons to match Windows 11 centered look */
  .taskbar-icons {
    display: flex;
    gap: 8px; /* Space between icons */
    align-items: center;
  }
  
  /* Icon style for the centered taskbar icons */
  .taskbar-icon {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
  }
  
  .taskbar-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
  
  /* Active application indicator */
  .taskbar-icon.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    width: 4px;
    height: 4px;
    background-color: #0078d7; /* Windows blue */
    border-radius: 50%;
  }

#start-menu-button {
    background: transparent !important; /* Override any existing background */
    height: 28px !important; /* 75% of original 60px height */
    width: auto;
    cursor: pointer;
    margin-right: 10px;
    padding-left: 12px;
    color: white;
}

#start-menu-button:hover {
    background-color: var(--button-hover-color);
}

#taskbar-items {
    display: flex;
    align-items: center;
    height: 100%;
    overflow-x: auto;
    flex-grow: 1;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

#taskbar-items::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.taskbar-item {
    padding: 5px 10px;
    margin: 0 3px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    height: 30px;
    display: flex;
    align-items: center;
    cursor: pointer;
    white-space: nowrap;
}

.taskbar-item:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.taskbar-item img {
    height: 20px;
    margin-right: 5px;
}

#clock {
    margin-left: auto;
    margin-right: 15px;
    color: white;
    white-space: nowrap;
}

/* Start Menu - Windows 11 Glass Style - Left Aligned with Vertical Scroll Only */
#start-menu {
    position: absolute;
    bottom: 40px; /* Position just above taskbar */
    left: 10px; /* Explicitly left-aligned */
    transform: none; /* Remove any centering transform */
    width: 350px; /* Fixed width as specified */
    background-color: rgba(36, 36, 36, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    padding: 20px;
    z-index: 1000;
    display: none;
    max-height: 80vh;
    overflow-y: auto; /* Only vertical scrolling */
    overflow-x: hidden; /* Explicitly prevent horizontal scrolling */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    border: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  #start-menu::-webkit-scrollbar {
    width: 8px;
  }
  
  #start-menu::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 8px;
  }
  
  #start-menu::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
  }
  
  /* Grid Container - Modified to prevent horizontal scrolling */
  .start-menu-items-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns as requested */
    gap: 12px;
    width: 100%; /* Constrain to parent width */
    max-width: 100%; /* Ensure it doesn't exceed container width */
  }
  
  /* Individual Start Menu Item Styling */
  .start-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    transition: background-color 0.2s ease;
    /* Remove any transformations that might cause overflow */
    width: 100%; /* Constrain to grid cell */
  }
  
  .start-menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    /* Remove scale transform to prevent overflow */
  }
  
  .start-menu-item img {
    height: 36px;
    width: 36px;
    margin-bottom: 8px;
    object-fit: contain;
  }
  
  .start-menu-item span {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    color: white;
  }
  
  /* Search Bar */
  .start-search {
    margin-bottom: 16px;
    width: 100%;
  }
  
  .start-search input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border-radius: 24px;
    border: none;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    outline: none;
  }
  
  .start-search::before {
    content: "🔍";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
  }

/* Mobile Specific Start Menu Styles */
@media (max-width: 768px) {
    #start-menu {
        position: fixed;
        bottom: 50px; /* Align with mobile taskbar */
        left: 0;
        width: 100%;
        height: calc(100% - 50px);
        max-height: none;
        border-radius: 0; /* Remove border radius on mobile */
        padding: 20px;
    }
    
    .start-menu-items-container {
        grid-template-columns: repeat(4, 1fr); /* 4 columns on mobile */
        gap: 20px;
        padding-bottom: 20px; /* Add padding at bottom for better scrolling */
    }
    
    .start-menu-item img {
        height: 48px;
        width: 48px;
    }
    
    .start-menu-item span {
        font-size: 11px;
    }
}

/* App Windows - updated with glassy effect and rounded corners */
.app-window {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    min-height: 200px;
    resize: none; /* Changed from 'both' to prevent default resize UI */
    border: none;
    outline: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Adjust border radius when maximized */
.app-window.maximized {
    border-radius: 0;
    width: 100% !important;
    height: calc(100% - 40px) !important; /* Account for taskbar */
    top: 0 !important;
    left: 0 !important;
}

/* Window Titlebar - glassy effect */
.window-titlebar {
    background-color: rgba(60, 60, 60, 0.7);
    color: white;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    border-radius: 12px 12px 0 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.maximized .window-titlebar {
    border-radius: 0;
}

.window-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

/* Improved window control buttons with WCAG contrast */
.window-controls {
    display: flex;
    gap: 8px;
}

.window-controls button {
    background: transparent;
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s;
}

.window-controls .minimize-button {
    background-color: rgba(255, 255, 255, 0.2);
}

.window-controls .maximize-button {
    background-color: rgba(255, 255, 255, 0.2);
}

.window-controls .close-button {
    background-color: rgba(220, 53, 69, 0.8);
}

.window-controls .minimize-button:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.window-controls .maximize-button:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.window-controls .close-button:hover {
    background-color: rgba(220, 53, 69, 1);
}

/* Fix for window content to maintain rounded corners at bottom */
.window-content {
    flex-grow: 1;
    display: flex;
    position: relative;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.maximized .window-content {
    border-radius: 0;
}

/* Iframe border radius fix */
.window-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0 0 12px 12px;
}

.maximized .window-iframe {
    border-radius: 0;
}

/* Resize handles */
.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: transparent; /* Changed to transparent to hide handles */
    z-index: 950;
}

.resize-handle.top-left {
    top: 0;
    left: 0;
    cursor: nw-resize;
    display: none; /* Hide corner resize handles */
}

.resize-handle.top-right {
    top: 0;
    right: 0;
    cursor: ne-resize;
    display: none; /* Hide corner resize handles */
}

.resize-handle.bottom-left {
    bottom: 0;
    left: 0;
    cursor: sw-resize;
    display: none; /* Hide corner resize handles */
}

.resize-handle.bottom-right {
    bottom: 0;
    right: 0;
    cursor: se-resize;
    display: none; /* Hide corner resize handles */
}

.resize-handle.right {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    cursor: e-resize;
    height: 100%;
    width: 5px;
}

.resize-handle.left {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    cursor: w-resize;
    height: 100%;
    width: 5px;
}

.resize-handle.top {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    cursor: n-resize;
    width: 100%;
    height: 5px;
}

.resize-handle.bottom {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    cursor: s-resize;
    width: 100%;
    height: 5px;
}

/* Desktop Icons */
.desktop-icons {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    cursor: pointer;
}

.desktop-icon img {
    width: 48px;
    height: 48px;
    margin-bottom: 5px;
}

.desktop-icon span {
    font-size: 12px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Mobile Specific Styles */
#mobile-taskbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: var(--taskbar-color);
    z-index: 950;
}

#mobile-app-drawer {
    display: none;
    position: fixed;
    bottom: 50px;
    left: 0;
    width: 100%;
    height: 100px;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 950;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#mobile-app-drawer::-webkit-scrollbar {
    display: none;
}

.mobile-app-icon {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    cursor: pointer;
}

.mobile-app-icon img {
    width: 40px;
    height: 40px;
    margin-bottom: 5px;
}

.mobile-app-icon span {
    font-size: 10px;
    color: white;
}

#mobile-taskbar-buttons {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
}

.mobile-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    flex-grow: 1;
    text-align: center;
    padding: 5px 0;
    cursor: pointer;
}

.mobile-button i {
    font-size: 20px;
    margin-bottom: 2px;
}

.mobile-button span {
    font-size: 10px;
}

#mobile-multitasking {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 50px);
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 950;
    overflow-y: auto;
    padding: 20px;
}

.mobile-task-card {
    background-color: #333;
    border-radius: 10px;
    margin-bottom: 15px;
    overflow: hidden;
    position: relative;
}

.mobile-task-header {
    background-color: #444;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-task-title {
    color: white;
    font-weight: bold;
}

.mobile-task-close {
    color: white;
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

.mobile-task-preview {
    height: 120px;
    background-color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

/* Media queries for responsive design */
@media (max-width: 768px) {
    .desktop-icons {
        display: none;
    }
    
    #taskbar {
        display: none;
    }
    
    #start-menu {
        display: none;
    }
    
    #mobile-taskbar {
        display: block;
    }
    
    .app-window {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: calc(100% - 50px) !important;
        border-radius: 0;
        resize: none;
    }
    
    .resize-handle {
        display: none;
    }
    
    .window-controls .minimize-button {
        display: none;
    }
}