:root {
    --system-font: "Verdana", sans-serif;

    /* Special */
    --taskbar-bg: #c79fd6;
    --taskbar-border: #d5bde6;
    --start-button-text: #441d57;
    --start-button: #d5bde6;
    --start-menu-bg: #d5bde6;
    --start-menu-text: #2a1136;
    --start-menu-hover: #b89fc7;
    --start-menu-hover-text: #ffffff;
    --header-text: #441d57;
    
    /* Base colors */
    --purple-darker: #2a1136;
    --purple-dark: #441d57;
    --purple-medium: #67378f; 
    --purple-main: #a267ac;
    --purple-light: #c79fd6;
    
    /* UI element colors */
    --bg-lightest: #f0d9ff;  /* Lightest background */
    --bg-light: #e6d4f2;     /* Light background */
    --bg-mid: #d5bde6;       /* Medium background, commonly used */
    --border-light: #b89fc7;  /* Light borders */
    --border-dark: #8b6b9c;   /* Darker borders */
    
    /* Accent colors */
    --accent-blue: #67c9dc;
    --accent-blue-light: #89d7e6;
    --accent-pink: #ff99cc;
    
    /* Current gradient */
    --bg-gradient: linear-gradient(135deg, var(--purple-main), var(--accent-blue), var(--accent-pink));

    /* Misc */
    --nav-button-disabled: #f0f0f0;
    --text-black: #000000;
    --text-muted: #666;
    --text-disabled: #999;
    --text-light: #ffffff;
    --warning-mid: #ff9999;
    --warning-light: #ffcccc;
    --warning-lighter: #FFDEDE;
    --warning-text: #cc0000;
    --ui-disabled-bg: #f0f0f0;
    --ui-disabled-border: #ccc;
    --bg-explorer-window: #ffffff;

    /* Window-specific gradients */
    --titlebar-gradient: linear-gradient(to right, var(--purple-main), var(--accent-blue));
    --button-gradient: linear-gradient(to bottom, var(--bg-light), var(--bg-mid));
    --button-hover-gradient: linear-gradient(to bottom, var(--bg-mid), var(--border-light));
    /* Other gradients */
    --bg-dark-transparent: rgba(139, 107, 156, 0.2);
    --bg-mid-transparent: rgba(213, 189, 230, 0.3);
    --bg-mid-selected: rgba(213, 189, 230, 0.5);
    --text-light-transparent: rgba(255, 255, 255, 0.4);
    --purple-medium-alpha: rgba(68, 29, 87, 0.2);
    --bg-gradient: linear-gradient(135deg, #a267ac, #67c9dc, #ff99cc);

    /* Shadows */
    --window-shadow: rgba(0, 0, 0, 0.3);
    --shadow-medium:rgba(0, 0, 0, 0.15);
    --shadow-light: rgba(0, 0, 0, 0.1);
}

/* Base styles and layout */
body {
    font-family: var(--system-font);
    margin: 0;
    overflow: hidden;
    background: var(--bg-gradient);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    height: 100vh;
    cursor: url('https://i.imgur.com/hDs99SG.png'), auto;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#desktop {
    width: 100%;
    height: 100%;
    position: relative;
}

#desktop-area {
    position: relative;
    width: 100%;
    height: calc(100% - 30px);
}

/* Taskbar styles */
#taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background-color: var(--taskbar-bg);
    border-top: 2px solid var(--taskbar-border);
    display: flex;
    align-items: center;
    padding: 0 4px;
    z-index: 100;
    box-shadow: 0px -2px 5px rgba(0, 0, 0, 0.4);
}

#startButton {
    display: flex;
    align-items: center;
    padding: 2px 8px;
    font-weight: bold;
    background-color: var(--start-button);
    color: var(--start-button-text);
    border: 2px outset var(--bg-lightest);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9em;
    height: 24px;
    /* Min-width based on content */
    min-width: max-content;
    /* Max-width to prevent extremely wide buttons */
    max-width: 120px;
    white-space: nowrap;
}

#startButton:hover {
    background-color: var(--bg-light);
}

#startButton:active {
    background-color: var(--border-light);
    border-style: inset;
}

#clock {
    margin-left: auto;
    font-weight: bold;
    padding: 2px 8px;
    color: var(--purple-dark);
    border: 1px solid var(--border-light);
    border-radius: 3px;
    font-size: 0.9em;
    height: 24px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

/* Start Menu styles */
/* Replace all the Start Menu styles in main.css with these */
#startMenu {
    position: absolute;
    bottom: 32px;
    left: 0;
    /* Width based on content */
    width: max-content;
    /* Min and max constraints */
    min-width: 180px;
    max-width: 250px;
    background-color: var(--bg-mid);
    border: 2px outset var(--bg-lightest);
    padding: 4px 0;
    z-index: 200;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    font-family: inherit;
    font-size: 0.9em;
}

.start-menu-item {
    position: relative;
}

.menu-label {
    padding: 6px 12px;
    color: var(--start-menu-text);
    cursor: default;
    font-weight: 500;
    /* Ensure text doesn't wrap */
    white-space: nowrap;
    /* Add ellipsis if text is too long */
    text-overflow: ellipsis;
    overflow: hidden;
}

.menu-label:hover,
#startMenu a:hover,
.shutdown-item:hover {
    background-color: var(--start-menu-hover);
    color: var(--start-menu-hover-text);
}

.submenu {
    display: none;
    position: absolute;
    left: 100%;
    /* Change from top: 0 to this: */
    bottom: 0;  /* This will make submenus open upward from the bottom */
    background-color: var(--start-menu-bg);
    border: 2px outset var(--bg-lightest);
    width: max-content;
    min-width: 160px;
    max-width: 220px;
    padding: 4px 0;
}

#startMenu a {
    display: block;
    padding: 6px 12px;
    color: var(--start-menu-text);
    text-decoration: none;
    white-space: nowrap;
    /* Add ellipsis if text is too long */
    text-overflow: ellipsis;
    overflow: hidden;
}

.start-menu-item:hover > .submenu {
    display: block;
}

.menu-separator {
    height: 1px;
    background-color: var(--border-light);
    margin: 4px 6px;
}

/* Add to main.css */
.power-option {
    display: block;
    padding: 6px 12px;
    color: var(--purple-dark);
    text-decoration: none;
    white-space: nowrap;
}

.power-option:hover {
    background-color: var(--border-light);
    color: var(--text-light);
}

/* Add styles for the shutdown screen */
#shutdown-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: var(--text-light);
    display: none;
    justify-content: center;
    align-items: center;
    font-family: var(--system-font);
    z-index: 100000; /* Ensure it's above everything */
    background-color: rgba(0, 0, 0, 0.95); /* Slightly transparent initially */
    transition: background-color 0.5s ease; /* Smooth transition to full black */
}


#shutdown-message {
    text-align: center;
    font-size: 1.5em;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    color: var(--start-menu-text);
    text-decoration: none;
    gap: 6px;
}

.menu-item:hover {
    background-color: var(--border-light);
    color: var(--start-menu-hover-text);
}

/* Taskbar programs */
.taskbar-programs {
    display: flex;
    gap: 4px;
    margin-left: 4px;
    height: 100%;
    flex-grow: 1;
    overflow: hidden;
    padding: 0 2px;
}

.taskbar-program {
    height: 24px;
    min-width: max-content;
    max-width: 200px;
    flex: 1;
    margin: 2px;
    padding: 0 8px;
    background-color: var(--taskbar-bg);
    border: 2px outset var(--bg-lightest);
    color: var(--start-button-text);
    display: flex;
    align-items: center;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9em;
}

.taskbar-program:hover {
    background-color: var(--bg-light);
}

.taskbar-program.active {
    background-color: var(--border-light);
    border-style: inset;
    color: var(--text-light);
}

.hidden {
    display: none !important;
}

/* Pinned taskbar items section */
.taskbar-pinned {
    display: flex;
    gap: 4px;
    margin-left: 10px;
    height: 100%;
    /* Add these properties for better browser support */
    position: relative;
    align-items: center;
    min-width: 36px; /* Ensure minimum width for the container */
}

.taskbar-pinned-item {
    height: 24px;
    width: 32px;
    margin: 2px;
    padding: 0 4px;
    background-color: var(--start-menu-bg);
    border: 2px outset var(--bg-lightest);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* Add these properties */
    position: relative;
    flex-shrink: 0; /* Prevent shrinking */
    box-sizing: border-box;
}

.taskbar-pinned-item:hover {
    background-color: var(--bg-light);
}

.taskbar-pinned-item.active {
    background-color: var(--border-light);
    border-style: inset;
}

.taskbar-pinned-item .file-icon {
    width: 16px;
    height: 16px;
}

/* Clock stuff */
.clock-context-menu {
    font-family: var(--system-font);
    background-color: var(--start-menu-bg);
    font-size: 0.9em;
}

.clock-context-menu .menu-item {
    padding: 6px 12px;
    background-color: var(--start-menu-bg);
    color: var(--start-button-text);
    cursor: pointer;
    white-space: nowrap;
}

.clock-context-menu .menu-item:hover {
    background-color: var(--border-light);
    color: var(--text-light);
}

.clock-context-menu .menu-separator {
    height: 1px;
    background-color: var(--border-light);
    margin: 4px 6px;
}

.program-window,
.window-content,
.settings-container,
.settings-panel,
.settings-group,
#taskbar,
#startMenu,
.start-menu-item {
    font-family: var(--system-font);
}

/* System tray */
.system-tray {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 0 8px;
    height: 100%;
}

.tray-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    cursor: pointer;
    color: var(--header-text);
}

.tray-icon:hover {
    color: var(--purple-darker);
}

/* Update the clock styling to work with system tray */
#clock {
    margin-left: 0;
    color: var(--start-menu-text) /* Remove auto margin since system-tray now handles spacing */
}

/* Battery */
.battery-popup {
    background-color: var(--bg-mid);
    border: 2px outset var(--bg-lightest);
    padding: 12px;
    border-radius: 4px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 200px;
}

.battery-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.big-battery-icon {
    transform: scale(1.5);
}

.battery-percentage {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--header-text);
}

.battery-state {
    color: var(--text-muted);
    font-size: 0.9em;
}

.time-remaining {
    color: var(--text-muted);
    font-size: 0.9em;
}

.charge-button {
    width: 100%;
    padding: 6px;
    background-color: var(--accent-blue);
    border: 2px outset var(--bg-lightest);
    color: var(--text-light);
    cursor: pointer;
    font-family: inherit;
}

.charge-button:hover {
    background-color: var(--accent-blue);
}

.charge-button:active {
    border-style: inset;
}

.battery-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--bg-mid);
    border: 2px outset var(--bg-lightest);
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    z-index: 1001;
}

.battery-warning.critical {
    background-color: var(--warning-light);
    border-color: var(--warning-mid);
}

.warning-content {
    text-align: center;
}

.warning-content h3 {
    margin: 0 0 10px 0;
    color: var(--purple-dark);
}

.warning-content p {
    margin: 0 0 15px 0;
    color: var(--text-muted);
}

.warning-content button {
    padding: 6px 20px;
    background-color: var(--accent-blue);
    border: 2px outset var(--bg-lightest);
    color: var(--text-light);
    cursor: pointer;
    font-family: inherit;
}

.warning-content button:hover {
    background-color: var(--accent-blue-light);
}

.warning-content button:active {
    border-style: inset;
}

