/* ==========================================================================
   KryptonOS - Modern Wayland / Libadwaita Desktop Environment & Taskbar
   ========================================================================== */

#desktop-environment {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #080a14 url("../assets/wallpapers/krypton_aurora.svg") no-repeat center center / cover;
    font-family: var(--font-sans);
    user-select: none;
    transition: background 0.3s ease;
}

/* Wallpaper Canvas Overlay */
#wallpaper-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 46px);
    z-index: 1;
    pointer-events: none;
    transform: translateZ(0);
    contain: strict;
}

/* Drag and Drop Wallpaper Overlay Indicator */
.desktop-drop-indicator {
    position: absolute;
    inset: 16px;
    border: 2px dashed var(--accent-primary);
    border-radius: 16px;
    background: rgba(0, 229, 255, 0.08);
    backdrop-filter: blur(12px);
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-family: var(--font-sans);
    gap: 12px;
    pointer-events: none;
    animation: pulseBorder 1.5s infinite ease-in-out;
}

.desktop-drop-indicator.active {
    display: flex;
}

.desktop-drop-indicator .drop-icon {
    font-size: 48px;
}

.desktop-drop-indicator .drop-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-primary);
    letter-spacing: 0.5px;
}

.desktop-drop-indicator .drop-sub {
    font-size: 14px;
    color: #94a3b8;
}

@keyframes pulseBorder {
    0%, 100% { border-color: rgba(0, 229, 255, 0.4); }
    50% { border-color: rgba(0, 229, 255, 0.9); }
}

/* Modern Desktop Grid */
.desktop-grid {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.desktop-icon {
    width: 86px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    cursor: pointer;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.desktop-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    transform: translateY(-2px);
}

.desktop-icon.selected {
    background: rgba(0, 229, 255, 0.18);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

.icon-image {
    font-size: 38px;
    line-height: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
    transition: transform 0.18s ease;
}

.desktop-icon:hover .icon-image {
    transform: scale(1.08);
}

.icon-label {
    font-size: 12px;
    font-weight: 500;
    color: #f8fafc;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 2px 6px rgba(0, 0, 0, 0.6);
    padding: 2px 4px;
    font-family: var(--font-sans);
    letter-spacing: 0.2px;
    line-height: 1.2;
    word-break: break-word;
}

/* ==========================================================================
   Modern Taskbar / Panel (Wayland / Plasma / GNOME Style)
   ========================================================================== */
.taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 46px;
    z-index: 9999;
    background: rgba(13, 16, 28, 0.82);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    box-sizing: border-box;
}

/* Modern App Launcher / Start Button */
.start-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 8px;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.start-button:hover {
    background: rgba(0, 229, 255, 0.22);
    border-color: var(--accent-primary);
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.35);
    transform: translateY(-1px);
}

.start-button:active {
    transform: translateY(1px) scale(0.98);
}

.start-button .logo-icon {
    font-size: 16px;
    color: var(--accent-primary);
}

.taskbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 4px;
}

/* Running Taskbar Items Container */
.taskbar-windows,
#taskbar-windows,
#taskbar-apps {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 4px;
    height: 100%;
}

.taskbar-windows::-webkit-scrollbar,
#taskbar-windows::-webkit-scrollbar,
#taskbar-apps::-webkit-scrollbar {
    display: none;
}

/* Modern Taskbar App Ribbon / Button */
.taskbar-btn,
.taskbar-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 7px;
    color: #ffffff !important;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 190px;
    min-width: 90px;
    position: relative;
    user-select: none;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.taskbar-btn:hover,
.taskbar-item:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.taskbar-btn:active,
.taskbar-item:active {
    transform: translateY(1px) scale(0.98);
}

/* Active / Focused Window Highlight */
.taskbar-btn.active,
.taskbar-item.active {
    background: linear-gradient(180deg, rgba(0, 229, 255, 0.24) 0%, rgba(0, 229, 255, 0.12) 100%) !important;
    border-color: #00e5ff !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.taskbar-btn.active::after,
.taskbar-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10px;
    right: 10px;
    height: 3px;
    background: #00e5ff;
    border-radius: 3px 3px 0 0;
    box-shadow: 0 0 8px #00e5ff, 0 0 3px #ffffff;
}

.taskbar-btn .btn-icon,
.taskbar-btn span:first-child,
.taskbar-item .icon {
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
}

.taskbar-btn .btn-title,
.taskbar-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff !important;
    font-size: 12px;
    line-height: 1.2;
}

.taskbar-btn.active .btn-title,
.taskbar-item.active .taskbar-item-title {
    color: #ffffff !important;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.6);
}

/* Modern System Tray */
.system-tray {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px;
}

.adblock-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-family: var(--font-sans);
    transition: all 0.15s ease;
}

.adblock-badge.on {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.adblock-badge.off {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.tray-icon-btn {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tray-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* Modern Date & Clock Pill */
.clock-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: #f8fafc;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.clock-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.4);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.clock-time {
    color: #ffffff;
    font-weight: 700;
}

.clock-date {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 500;
}

/* Linux TTY1 Fullscreen Console Mode */
.tty-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    color: #00ffaa;
    font-family: 'Fira Code', monospace;
    font-size: 15px;
    padding: 28px;
    box-sizing: border-box;
    z-index: 999999;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.tty-screen.hidden {
    display: none !important;
}

.tty-output-line {
    margin-bottom: 4px;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.35;
}

.tty-output-error { color: #ff5555; }
.tty-output-success { color: #55ff55; }
.tty-output-warning { color: #ffff55; }
.tty-output-cyan { color: #00e5ff; }

/* ==========================================================================
   Windows 98 / Retro 90s OS Styling (Krypton Alpha Live USB & Base Mode)
   ========================================================================== */
body.theme-win98 #desktop-environment {
    background: #008080 !important;
    font-family: 'Tahoma', 'MS Sans Serif', 'Segoe UI', sans-serif !important;
}

body.theme-win98 #wallpaper-canvas {
    display: none !important;
}

body.theme-win98 .desktop-grid {
    padding: 16px;
    gap: 20px;
}

body.theme-win98 .desktop-icon {
    width: 74px;
    padding: 6px 4px;
    border-radius: 0;
    border: 1px solid transparent;
}

body.theme-win98 .desktop-icon:hover {
    background: rgba(0, 0, 128, 0.4);
}

body.theme-win98 .desktop-icon.selected {
    background: #000080 !important;
    border: 1px dotted #ffff80 !important;
}

body.theme-win98 .desktop-icon .icon-label {
    color: #ffffff !important;
    font-family: 'Tahoma', 'MS Sans Serif', sans-serif !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    text-shadow: 1px 1px 1px #000 !important;
    background: rgba(0, 0, 0, 0.35);
    padding: 1px 3px;
    border-radius: 2px;
}

body.theme-win98 #taskbar {
    background: #c0c0c0 !important;
    height: 32px !important;
    border-top: 2px solid #ffffff !important;
    border-left: 2px solid #ffffff !important;
    border-right: 2px solid #808080 !important;
    border-bottom: 2px solid #808080 !important;
    padding: 2px 4px !important;
    backdrop-filter: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

body.theme-win98 .start-button {
    background: #c0c0c0 !important;
    border-top: 2px solid #ffffff !important;
    border-left: 2px solid #ffffff !important;
    border-right: 2px solid #404040 !important;
    border-bottom: 2px solid #404040 !important;
    color: #000000 !important;
    font-family: 'Tahoma', 'Segoe UI', sans-serif !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    border-radius: 0 !important;
    height: 24px !important;
    padding: 0 8px !important;
    gap: 5px !important;
    box-shadow: none !important;
}

body.theme-win98 .start-button:active {
    border-top: 2px solid #404040 !important;
    border-left: 2px solid #404040 !important;
    border-right: 2px solid #ffffff !important;
    border-bottom: 2px solid #ffffff !important;
    background: #b0b0b0 !important;
}

body.theme-win98 .taskbar-btn {
    background: #c0c0c0 !important;
    border-top: 2px solid #ffffff !important;
    border-left: 2px solid #ffffff !important;
    border-right: 2px solid #404040 !important;
    border-bottom: 2px solid #404040 !important;
    border-radius: 0 !important;
    color: #000000 !important;
    font-family: 'Tahoma', 'Segoe UI', sans-serif !important;
    font-size: 11px !important;
    height: 24px !important;
    font-weight: 500 !important;
    padding: 0 8px !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
}

body.theme-win98 .taskbar-btn.active {
    background: #dfdfdf !important;
    border-top: 2px solid #404040 !important;
    border-left: 2px solid #404040 !important;
    border-right: 2px solid #ffffff !important;
    border-bottom: 2px solid #ffffff !important;
    font-weight: 700 !important;
}

body.theme-win98 .system-tray {
    border-top: 1px solid #808080 !important;
    border-left: 1px solid #808080 !important;
    border-right: 1px solid #ffffff !important;
    border-bottom: 1px solid #ffffff !important;
    background: #c0c0c0 !important;
    color: #000000 !important;
    height: 24px !important;
    padding: 0 6px !important;
    border-radius: 0 !important;
    gap: 6px !important;
}

body.theme-win98 .clock-pill {
    background: transparent !important;
    color: #000000 !important;
    border: none !important;
    padding: 0 !important;
    font-size: 11px !important;
    font-family: 'Tahoma', sans-serif !important;
    box-shadow: none !important;
}

body.theme-win98 .clock-time, body.theme-win98 .clock-date {
    color: #000000 !important;
    font-weight: 500 !important;
}
.tty-output-muted { color: #888888; }

/* ==========================================================================
   Applications Launcher / Start Menu (Modern & Win98 Styles)
   ========================================================================== */
.start-menu {
    position: absolute;
    bottom: 54px;
    left: 12px;
    width: 380px;
    max-height: 520px;
    background: rgba(13, 17, 30, 0.94);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 20px rgba(0, 229, 255, 0.15);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #f8fafc;
    font-family: var(--font-sans);
    animation: startMenuPop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1);
    box-sizing: border-box;
}

.start-menu.hidden {
    display: none !important;
}

@keyframes startMenuPop {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.start-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.start-menu-header .user-avatar {
    font-size: 28px;
    width: 44px;
    height: 44px;
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.start-menu-header .user-info .user-name {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

.start-menu-header .user-info .user-status {
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.start-menu-header .status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.start-menu-search {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.start-menu-search input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.start-menu-search input:focus {
    border-color: #00e5ff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
}

.start-menu-body {
    padding: 14px 16px;
    flex: 1;
    overflow-y: auto;
    max-height: 260px;
}

.start-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    margin-bottom: 10px;
}

.start-app-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.start-app-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.15s ease;
}

.start-app-item:hover {
    background: rgba(0, 229, 255, 0.14);
    border-color: rgba(0, 229, 255, 0.35);
    transform: translateX(2px);
}

.start-app-icon {
    font-size: 22px;
}

.start-app-label {
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.start-menu-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.35);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    gap: 8px;
}

.start-btn-action {
    flex: 1;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.start-btn-action:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.start-btn-action.danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #fca5a5;
}

/* --------------------------------------------------------------------------
   Windows 98 Theme Start Menu Overrides
   -------------------------------------------------------------------------- */
body.theme-win98 .start-menu {
    bottom: 34px !important;
    left: 2px !important;
    width: 250px !important;
    background: #c0c0c0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-top: 2px solid #ffffff !important;
    border-left: 2px solid #ffffff !important;
    border-right: 2px solid #404040 !important;
    border-bottom: 2px solid #404040 !important;
    border-radius: 0 !important;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.5) !important;
    animation: none !important;
    font-family: 'Tahoma', 'MS Sans Serif', sans-serif !important;
    padding: 3px !important;
}

body.theme-win98 .start-menu-header {
    background: linear-gradient(90deg, #000080, #1084d0) !important;
    border: none !important;
    padding: 8px 10px !important;
    border-radius: 0 !important;
}

body.theme-win98 .start-menu-header .user-avatar {
    background: transparent !important;
    border: none !important;
    font-size: 20px !important;
    width: auto !important;
    height: auto !important;
}

body.theme-win98 .start-menu-header .user-info .user-name {
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: bold !important;
}

body.theme-win98 .start-menu-header .user-info .user-status {
    color: #ffff80 !important;
    font-size: 10px !important;
}

body.theme-win98 .start-menu-search {
    display: none !important;
}

body.theme-win98 .start-menu-body {
    padding: 6px 4px !important;
    max-height: none !important;
}

body.theme-win98 .start-section-title {
    display: none !important;
}

body.theme-win98 .start-app-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}

body.theme-win98 .start-app-item {
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 0 !important;
    padding: 6px 10px !important;
    gap: 8px !important;
}

body.theme-win98 .start-app-item:hover {
    background: #000080 !important;
    color: #ffffff !important;
    transform: none !important;
}

body.theme-win98 .start-app-item:hover .start-app-label {
    color: #ffffff !important;
}

body.theme-win98 .start-app-label {
    color: #000000 !important;
    font-size: 12px !important;
    font-weight: normal !important;
}

body.theme-win98 .start-menu-footer {
    background: #c0c0c0 !important;
    border-top: 1px solid #808080 !important;
    padding: 6px 4px !important;
    flex-direction: column !important;
    gap: 3px !important;
}

body.theme-win98 .start-btn-action {
    width: 100% !important;
    background: #c0c0c0 !important;
    border-top: 1px solid #fff !important;
    border-left: 1px solid #fff !important;
    border-right: 1px solid #404040 !important;
    border-bottom: 1px solid #404040 !important;
    border-radius: 0 !important;
    color: #000000 !important;
    text-align: left !important;
    padding: 4px 8px !important;
}

body.theme-win98 .start-btn-action:hover {
    background: #000080 !important;
    color: #ffffff !important;
}
