/*
 * APPS.CSS - Styles for the built-in programs' menu bars and dropdowns.
 *   NetCrawler browser  (js/apps/browser.js)
 *   Notes text editor   (js/apps/notes.js)
 * The calculator and clock only use inline styles plus the bevel helpers in base.css.
 */

/* ===== NetCrawler browser ===== */
.browser-menubar-wrapper { transition: transform 0.2s ease-in-out; }
.browser-container.autohide-active .browser-menubar-wrapper {
    position: absolute !important; top: 0; left: 0; right: 0;
    transform: translateY(-100%); box-shadow: 0px 4px 6px rgba(0,0,0,0.3);
}
.browser-container.autohide-active .browser-autohide-zone:hover + .browser-menubar-wrapper,
.browser-container.autohide-active .browser-menubar-wrapper:hover,
.browser-container.autohide-active .browser-menubar-wrapper:focus-within { transform: translateY(0); }
.browser-menu-item { position: relative; cursor: default; padding: 4px 8px; user-select: none; outline: none; }
.browser-dropdown {
    display: none !important; position: absolute; top: 100%; left: 0;
    background: var(--ui-face); border-top: 2px solid var(--ui-light); border-left: 2px solid var(--ui-light);
    border-bottom: 2px solid var(--ui-dark); border-right: 2px solid var(--ui-dark);
    min-width: 160px; z-index: 100005 !important; box-shadow: 2px 2px 5px rgba(0,0,0,0.5); 
    color: var(--ui-text); font-weight: normal; flex-direction: column; 
}
/* Only the focused menu is open; js/core/menubar.js moves focus as you point across the bar */
.browser-menu-item:focus-within .browser-dropdown { display: flex !important; }
.browser-menu-item:hover,
.browser-menu-item:focus-within { background: var(--ui-light); color: var(--ui-text); }
.browser-dropdown div { padding: 6px 10px; cursor: pointer; white-space: nowrap; display:flex; align-items:center; gap:8px; }
.browser-dropdown div:hover:not(.separator) { background: var(--title-grad-1); color: white; }
.browser-dropdown .separator { height: 1px; background: var(--ui-dark); margin: 2px 0; padding: 0; border-bottom: 1px solid var(--ui-light); pointer-events: none; }

/* ===== Notes ===== */
/* Menu focus behavior */
.notes-menu-item {
    position: relative; cursor: default; padding: 2px 6px; user-select: none; outline: none;
}
.notes-menu-item:hover, .notes-menu-item:focus-within {
    background: var(--ui-light); color: var(--ui-text);
}
.notes-dropdown {
    display: none; position: absolute; top: 100%; left: 0;
    background: var(--ui-face);
    border-top: 2px solid var(--ui-light); border-left: 2px solid var(--ui-light);
    border-bottom: 2px solid var(--ui-dark); border-right: 2px solid var(--ui-dark);
    min-width: 140px; z-index: 10000; box-shadow: 2px 2px 5px rgba(0,0,0,0.5); color: var(--ui-text);
}
.notes-menu-item:focus-within .notes-dropdown {
    display: block;
}
.notes-dropdown div {
    padding: 4px 10px; cursor: pointer; white-space: nowrap;
}
.notes-dropdown div:hover:not(.separator):not(.disabled) {
    background: var(--title-grad-1); color: white;
}
.notes-dropdown .separator {
    height: 1px; background: var(--ui-dark); margin: 2px 0; padding: 0;
    border-bottom: 1px solid var(--ui-light); pointer-events: none;
}
.notes-dropdown .disabled {
    color: rgba(128,128,128,0.8); cursor: default;
}
.notes-textarea::selection {
    background: var(--title-grad-1); color: white;
}

/* --- GAMES (desktop/js/apps/games.js) --- */
.games-folder { padding: 10px; }
.games-hint { margin: 0 0 10px; font-size: 12px; }
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.games-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: transparent; border: 1px dotted transparent; padding: 6px; cursor: pointer;
    color: inherit; font: inherit; font-size: 12px;
}
.games-item img { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border: 2px solid; border-color: var(--ui-dark) var(--ui-light) var(--ui-light) var(--ui-dark); }
.games-item:hover, .games-item:focus { border-color: var(--ui-text); outline: none; }
.games-item:focus span { background: var(--title-grad-1); color: var(--title-text); }
.game-window { position: absolute; inset: 0; background: #000; }
.game-window iframe { width: 100%; height: 100%; border: 0; display: block; }

/* --- NETCRAWLER TABS (js/apps/browser-tabs.js) --- */
.nc-tabs { display: flex; align-items: flex-end; gap: 2px; padding: 3px 4px 0; overflow-x: auto; scrollbar-width: thin; }
.browser-container.tabs-off .nc-tabs,
.browser-container.tabs-off .needs-tabs { display: none !important; }
.nc-tab {
    display: flex; align-items: center; gap: 4px; flex: 0 1 170px; min-width: 70px;
    padding: 3px 4px 3px 8px; font-size: 11px; cursor: default;
    background: var(--ui-face); color: var(--ui-text);
    border: 2px solid; border-bottom: 0; border-color: var(--ui-light) var(--ui-dark) transparent var(--ui-light);
    border-radius: 3px 3px 0 0; opacity: 0.8;
}
.nc-tab.active { opacity: 1; font-weight: bold; margin-bottom: -2px; padding-bottom: 5px; position: relative; z-index: 1; }
.nc-tab-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nc-tab-x, .nc-newtab {
    border: 1px solid var(--ui-dark); background: var(--ui-face); color: var(--ui-text);
    font: bold 10px/1 Tahoma, sans-serif; cursor: pointer; padding: 1px 4px;
}
.nc-newtab { margin: 0 0 3px 2px; padding: 2px 7px; font-size: 12px; }

/* NetCrawler toolbar icon buttons (refresh, home) */
/* Back / Forward: a bit chunkier than the other toolbar buttons, and greyed out when there's nowhere to go */
.nc-nav-btn { padding: 4px 11px; min-width: 32px; font-size: 15px; font-weight: 900; line-height: 1; color: var(--ui-text); cursor: pointer; }
.nc-nav-btn:disabled { opacity: 0.4; cursor: default; filter: grayscale(1); }
/* "You're back on the tab you started in" bubble under a tab (browser-tabs.js tabHint) */
.nc-tab-hint { position: fixed; z-index: 2147483000; max-width: 260px; padding: 6px 9px; font-size: 12px; line-height: 1.35;
    background: #ffffe1; color: #000; border: 1px solid #000; box-shadow: 2px 2px 0 rgba(0,0,0,0.35); cursor: pointer; transition: opacity .4s; }
.nc-tab-hint::before { content: ""; position: absolute; top: -7px; left: 14px; border: 6px solid transparent; border-top: 0; border-bottom-color: #000; }
.nc-tab-hint::after { content: ""; position: absolute; top: -5px; left: 15px; border: 5px solid transparent; border-top: 0; border-bottom-color: #ffffe1; }
.nc-tab-hint.fade { opacity: 0; }
.nc-icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 3px 7px; color: var(--ui-text); cursor: pointer; }
.nc-icon-btn svg { display: block; }

/* --- NETWORK window (desktop/js/apps/network.js) --- */
.net-window { display: flex; flex-direction: column; height: 100%; background: var(--ui-face); color: var(--ui-text); font-size: 12px; }
.net-address { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-bottom: 2px solid var(--ui-dark); }
.net-address > div { flex: 1; display: flex; align-items: center; gap: 5px; background: #fff; color: #000; border: 2px inset var(--ui-dark); padding: 1px 5px; }
.net-address img { width: 14px; height: 14px; }
.net-body { flex: 1; overflow-y: auto; background: #fff; color: #000; margin: 2px; border: 2px inset var(--ui-dark); }
.net-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; padding: 10px; }
.net-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #000; text-decoration: none; text-align: center; padding: 4px; border: 1px dotted transparent; }
.net-item:hover { border-color: #000; }
.net-item img { width: 32px; height: 32px; image-rendering: pixelated; }
.net-empty { display: flex; gap: 14px; padding: 16px; line-height: 1.5; }
.net-empty img { width: 48px; height: 48px; flex-shrink: 0; image-rendering: pixelated; }
.net-empty p { margin: 0 0 8px; }
.net-status { padding: 2px 6px; font-size: 11px; }

/* Favicon on each NetCrawler tab (browser-tabs.js) */
.nc-tab-icon { width: 14px; height: 14px; flex: 0 0 14px; object-fit: contain; image-rendering: pixelated; }

/* --- FOLDERS (desktop/js/apps/folders.js): Explorer-style Sample Courses / Games / Projects --- */
.fx { display: flex; flex-direction: column; height: 100%; background: var(--ui-face); color: var(--ui-text); font-size: 12px; }
.fx-bar { display: flex; gap: 6px; align-items: stretch; padding: 5px; border-bottom: 1px solid var(--ui-dark, #808080); }
.fx-web { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; cursor: pointer; font: inherit; font-weight: bold; color: var(--ui-text); white-space: nowrap; }
.fx-web img { width: 16px; height: 16px; }
.fx-path { flex: 1; min-width: 0; padding: 4px 6px; background: #fff; color: #000; font-family: 'Courier New', monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-hint { margin: 6px 8px 4px; }
.fx-grid { flex: 1; overflow: auto; margin: 0 6px; padding: 8px; background: #fff; color: #000;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px 6px; align-content: start; }
.fx-loading { grid-column: 1 / -1; color: #555; margin: 4px; }
.fx-item { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 5px 3px; border: 1px dotted transparent;
    background: none; cursor: pointer; font: inherit; color: #000; text-align: center; }
.fx-item:hover .fx-thumb { filter: brightness(1.08); }
.fx-item:focus-visible { outline: none; border-color: #000; }
.fx-item.sel .fx-name { background: var(--ui-select, #000080); color: #fff; }
.fx-item.sel .fx-thumb { outline: 2px solid var(--ui-select, #000080); }
.fx-thumb { position: relative; width: 104px; height: 66px; background: #222; border: 1px solid #808080; box-shadow: 2px 2px 0 rgba(0,0,0,0.25); }
.fx-thumb > img:first-child { width: 100%; height: 100%; object-fit: cover; display: block; }
.fx-badge { position: absolute; right: -6px; bottom: -6px; width: 26px; height: 26px; image-rendering: pixelated;
    background: #fff; border: 1px solid #808080; padding: 1px; }
.fx-name { padding: 1px 3px; line-height: 1.3; max-width: 112px; overflow-wrap: anywhere; }
.fx-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; margin: 5px 6px 6px; padding: 4px 6px;
    border: 1px solid; border-color: var(--ui-dark, #808080) #fff #fff var(--ui-dark, #808080); }
.fx-kind { color: #555; font-style: italic; }
.fx-acts { display: flex; gap: 4px; flex: none; }
.fx-acts button { padding: 3px 12px; cursor: pointer; font: inherit; font-weight: bold; color: var(--ui-text); }

/* --- MESSENGER (desktop/js/apps/messenger.js): "Messages from Joe", late-90s instant-messenger look --- */
#tray-msg { width: 20px; height: 20px; padding: 0; margin-right: 4px; border: 0; background: none; cursor: pointer; vertical-align: middle;
    animation: im-blink 0.8s steps(1) infinite; }
#tray-msg img { width: 16px; height: 16px; image-rendering: pixelated; display: block; margin: 0 auto; }
@keyframes im-blink { 50% { opacity: 0.1; } }
@media (prefers-reduced-motion: reduce) { #tray-msg { animation: none; outline: 2px solid #3fb85a; } }
.im-menu { position: fixed; z-index: 2147483000; display: flex; flex-direction: column; padding: 2px; min-width: 160px; background: #c0c0c0; }
.im-menu button { text-align: left; padding: 5px 12px; background: none; border: 0; font: 11px Tahoma, 'MS Sans Serif', sans-serif; cursor: pointer; color: #000; }
.im-menu button:hover { background: #000080; color: #fff; }
/* The message window keeps the classic grey dialog look whatever the desktop theme is */
.im { height: 100%; box-sizing: border-box; overflow: auto; padding: 8px 9px 6px; background: #d4d0c8; color: #000;
    font: 11px Tahoma, 'MS Sans Serif', Verdana, sans-serif; }
.im .bevel-in { background: #fff; border: 2px solid; border-color: #808080 #fff #fff #808080; box-shadow: inset 1px 1px 0 #404040; }
.im .bevel-out { background: #d4d0c8; border: 2px solid; border-color: #fff #404040 #404040 #fff; box-shadow: inset -1px -1px 0 #808080; }
.im-view { display: flex; flex-direction: column; gap: 6px; }
.im-view[hidden] { display: none; }
.im-who { display: flex; gap: 8px; align-items: flex-start; padding: 6px; border: 1px solid; border-color: #808080 #fff #fff #808080; }
.im-pic { width: 42px; height: 42px; image-rendering: pixelated; border: 2px solid; border-color: #808080 #fff #fff #808080; background: #dfe6f3; flex: none; }
.im-fields { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.im-f { display: flex; align-items: center; gap: 4px; flex: 1 1 100%; }
.im-f.short { flex: 1 1 40%; }
.im-f span { white-space: nowrap; }
.im-f input { flex: 1; min-width: 0; font: inherit; padding: 2px 4px; color: #000; }
.im-status { display: flex; align-items: center; gap: 3px; color: #006400; font-weight: bold; white-space: nowrap; }
.im-status i { width: 9px; height: 9px; border-radius: 50%; background: #2bd14a; border: 1px solid #0b6b1e; box-shadow: inset -1px -1px 0 #139a31; }
.im-when { display: flex; gap: 8px; }
.im-body { min-height: 110px; padding: 6px 8px; font-size: 12px; line-height: 1.45; color: #000; }
.im-body p { margin: 0 0 8px; }
.im-link { background: none; border: 0; padding: 0; font: inherit; color: #0000ee; text-decoration: underline; cursor: pointer; }
.im-btns { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.im-btns button { min-width: 70px; padding: 4px 8px; font: inherit; color: #000; cursor: pointer; }
.im-btns button:active { border-color: #404040 #fff #fff #404040; box-shadow: none; }
.im-off { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.im-quote { color: #555; font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-text { min-height: 110px; resize: vertical; font: 12px Tahoma, Verdana, sans-serif; padding: 5px; color: #000; }
.im-count { text-align: right; color: #555; }
.im-status-line { margin: 4px 0 0; min-height: 1.2em; font-style: italic; }
.im, .im input, .im textarea, .im button, .im-menu button { font-family: Tahoma, "MS Sans Serif", Verdana, sans-serif !important; }
