/* Taskbar */
#taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: var(--taskbar-bg);
    border-top: 1px solid var(--border-color);
    color: var(--icon-color);
}

.taskbar-left, .taskbar-right {
    display: flex;
    height: 100%;
    align-items: center;
}

.taskbar-icon {
    width: 48px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
    line-height: 1;
}

.taskbar-icon:hover {
    background: var(--hover-bg);
}

.win-icon:hover {
    background: var(--win-blue);
    color: white; /* Win logo always white on blue hover */
}

.taskbar-search {
    background: var(--input-bg);
    color: var(--text-color);
    height: 32px;
    width: 200px;
    padding: 0 10px;
    font-size: 0.9rem;
    margin-left: 5px;
    margin-right: 5px;
    border: 1px solid #ccc;
    font-family: var(--font-stack);
    outline: none;
    transition: background 0.2s, border-color 0.2s;
}

.taskbar-search:focus {
    background: var(--window-bg);
    border-color: var(--win-blue);
}

/* Dynamic Apps in Taskbar */
#taskbar-apps {
    display: flex;
    height: 100%;
    margin-left: 5px;
}

.taskbar-app-entry {
    width: 48px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 2px solid transparent;
}

.taskbar-app-entry:hover {
    background: var(--hover-bg);
}

.taskbar-app-entry.active-app {
    background: var(--active-bg);
    border-bottom: 2px solid var(--win-blue);
}

/* Hide search on small screens */
@media (max-width: 600px) {
    .taskbar-search {
        display: none;
    }
}

.system-tray {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-right: 15px;
    height: 100%;
}

.tray-icon {
    width: 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 10px;
    transition: background 0.2s;
}

.tray-icon:hover {
    background: var(--hover-bg);
}

/* Unified Tray Group */
.tray-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    padding: 0 10px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.tray-group:hover {
    background: var(--hover-bg);
}

.tray-group:active, .tray-group.active {
    background: var(--active-bg);
}

.tray-icon-small {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.taskbar-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: default;
    padding: 0 10px;
    height: 100%;
}

.taskbar-time:hover {
    background: var(--hover-bg);
}

/* Start Menu */
#start-menu {
    position: absolute;
    bottom: 48px;
    left: 0;
    width: 600px;
    max-width: 90vw;
    height: 500px;
    max-height: 70vh;
    display: flex;
    z-index: 999;
    transition: transform 0.2s ease-out, opacity 0.2s;
    transform-origin: bottom left;
}

#start-menu.hidden {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
}

.start-sidebar {
    width: 48px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Align to bottom like Win10 */
    padding-bottom: 10px;
    gap: 5px;
}

.sidebar-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
}

.sidebar-btn:hover {
    background: var(--hover-bg);
}

.power-menu-wrapper {
    position: relative;
}

.power-menu {
    position: absolute;
    bottom: 48px;
    left: 0;
    width: 200px;
    background: var(--ctx-menu-bg);
    border: 1px solid var(--ctx-menu-border);
    display: flex;
    flex-direction: column;
    padding: 5px 0;
    box-shadow: 4px 0 10px rgba(0,0,0,0.3);
    z-index: 1001;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(0);
}

.power-menu.hidden {
    transform: translateY(10px);
}

.power-item {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
}

.power-item:hover {
    background: var(--hover-bg);
}

.pm-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.start-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    border: none;
}

.tile-group-title {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: #ccc;
    border: none;
    outline: none;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 4px;
}

.tile {
    width: 100px;
    height: 100px;
    background: var(--win-blue);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white !important; /* Always white text on colored tiles */
    cursor: pointer;
    position: relative;
    border: 1px solid transparent;
}

.tile:hover {
    border: 2px solid rgba(255,255,255,0.5);
    filter: brightness(1.1);
}

.tile span {
    font-size: 2rem;
}

.tile-label {
    position: absolute;
    bottom: 5px;
    left: 5px;
    font-size: 0.8rem;
}

.tile.dark-blue { background: #004578; }
.tile.sky-blue { background: #00ADEF; }