/* ============================================================
   TASKBAR
   Start button, running app buttons, system tray, clock
   ============================================================ */

#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--taskbar-height);
    background: var(--win95-bg);
    box-shadow:
        inset 0 1px var(--win95-white),
        inset 0 2px var(--win95-light);
    display: flex;
    align-items: center;
    padding: 2px 2px;
    gap: 2px;
    z-index: 5001;
    font-family: var(--win95-font);
    font-size: var(--win95-font-size);
}

/* ---- Start Button ---- */

#start-button {
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--win95-bg);
    border: none;
    box-shadow:
        inset -1px -1px var(--win95-black),
        inset 1px 1px var(--win95-white),
        inset -2px -2px var(--win95-gray),
        inset 2px 2px var(--win95-light);
    min-width: 54px;
    height: 22px;
    padding: 0 6px;
    font-family: var(--win95-font);
    font-size: var(--win95-font-size);
    font-weight: bold;
    cursor: default;
    outline: none;
    flex-shrink: 0;
}

#start-button:active,
#start-button.pressed {
    box-shadow:
        inset -1px -1px var(--win95-white),
        inset 1px 1px var(--win95-black),
        inset -2px -2px var(--win95-light),
        inset 2px 2px var(--win95-gray);
    padding: 1px 5px 0 7px;
}

/* Windows flag icon in Start button */
.start-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 14px;
    position: relative;
    overflow: hidden;
}

.start-flag img {
    display: block;
    width: 16px;
    height: 14px;
}

/* CSS fallback flag (only shown when image fails to load) */
.start-flag::before,
.start-flag::after {
    display: none;
}

.start-flag.css-fallback::before,
.start-flag.css-fallback::after {
    display: block;
}

/* 4-color Windows flag with perspective wave (CSS fallback) */
.start-flag.css-fallback::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 0;
    width: 16px;
    height: 12px;
    background:
        /* Top-left: Red pane */
        linear-gradient(to right, #ff0000, #dd0000) no-repeat 0 0 / 7px 5px,
        /* Top-right: Green pane */
        linear-gradient(to right, #00aa00, #008800) no-repeat 8px 0 / 7px 5px,
        /* Bottom-left: Blue pane */
        linear-gradient(to right, #0000ff, #0000cc) no-repeat 0 6px / 7px 5px,
        /* Bottom-right: Yellow pane */
        linear-gradient(to right, #ffcc00, #ddaa00) no-repeat 8px 6px / 7px 5px;
    transform: perspective(20px) rotateY(-8deg);
    transform-origin: left center;
}

/* Flag pole (CSS fallback) */
.start-flag.css-fallback::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 14px;
    background: #808080;
}

/* ---- Taskbar App Buttons Area ---- */

#taskbar-apps {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow: hidden;
    min-width: 0;
    height: 22px;
}

.taskbar-app-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--win95-bg);
    border: none;
    box-shadow:
        inset -1px -1px var(--win95-black),
        inset 1px 1px var(--win95-white),
        inset -2px -2px var(--win95-gray),
        inset 2px 2px var(--win95-light);
    height: 22px;
    min-width: 40px;
    max-width: 160px;
    padding: 0 6px;
    font-family: var(--win95-font);
    font-size: var(--win95-font-size);
    cursor: default;
    outline: none;
    overflow: hidden;
    flex-shrink: 1;
    flex-basis: 160px;
}

.taskbar-app-btn.active {
    box-shadow:
        inset -1px -1px var(--win95-white),
        inset 1px 1px var(--win95-black),
        inset -2px -2px var(--win95-light),
        inset 2px 2px var(--win95-gray);
    font-weight: bold;
    background:
        repeating-conic-gradient(var(--win95-bg) 0% 25%, var(--win95-white) 0% 50%)
        50% / 2px 2px;
}

.taskbar-app-btn .taskbar-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Clip container for CSS fallback icons in taskbar */
.taskbar-icon-clip {
    width: 16px;
    height: 16px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.taskbar-app-btn .taskbar-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 0;
}

/* ---- System Tray ---- */

#system-tray {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    height: 22px;
    box-shadow:
        inset -1px -1px var(--win95-white),
        inset 1px 1px var(--win95-gray);
    flex-shrink: 0;
}

#clock {
    font-family: var(--win95-font);
    font-size: var(--win95-font-size);
    white-space: nowrap;
}

/* Volume icon in system tray */
.tray-volume {
    width: 16px;
    height: 14px;
    position: relative;
    cursor: default;
}

.tray-volume::before {
    content: '';
    width: 4px;
    height: 6px;
    background: var(--win95-text);
    position: absolute;
    left: 2px;
    top: 4px;
}

.tray-volume::after {
    content: '';
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid var(--win95-text);
    position: absolute;
    left: 0;
    top: 1px;
    transform: scaleX(-1);
}
