/* ============================================================
   sabre Explorer + Notepad — Windows 98 styling for sabreOS
   Colors follow the site: #eaeaea window grey, purple-blue
   selection (#3a2eaa) matching the active title bars.
   ============================================================ */

/* ---- Host window: explorer fills the window edge to edge ---- */
.explorer-window .window-content,
.notepad-window .window-content {
  margin: 2px 1px 1px;
  display: flex;
  flex-direction: column;
}
.content-box.ex-host,
.content-box.np-host {
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.app-window.explorer-window { min-width: 0; }

/* ---- Shell ---- */
.ex, .np, .ex-menu, .ex-dialog {
  font-family: "w95f", Tahoma, Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: #000;
  text-shadow: none;
  line-height: 1.2;
}
.ex {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: #eaeaea;
}
.ex button, .np button, .ex-menu button, .ex-dialog button {
  font: inherit;
  letter-spacing: inherit;
  color: #000;
  cursor: pointer;
}
.ex img { image-rendering: pixelated; }
.ex .ex-thumb img:not(.ex-thumb-ico) { image-rendering: auto; }

/* ---- Menu bar ---- */
.ex-menubar {
  display: flex;
  flex: 0 0 auto;
  padding: 1px 2px;
  border-bottom: 1px solid #808080;
  box-shadow: 0 1px #fff;
  margin-bottom: 1px;
}
.ex-mb-item {
  background: none;
  border: none;
  padding: 2px 7px;
  line-height: 14px;
}
.ex-mb-item u { text-decoration: underline; }
.ex-mb-item:hover { box-shadow: inset -1px -1px #808080, inset 1px 1px #fff; }
.ex-mb-item.open { box-shadow: inset 1px 1px #808080, inset -1px -1px #fff; }
.ex-mb-item:focus-visible { outline: 1px dotted #000; outline-offset: -3px; }

/* ---- Toolbar ---- */
.ex-toolbar {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 1px;
  padding: 2px 3px;
  border-bottom: 1px solid #808080;
  box-shadow: 0 1px #fff;
  margin-bottom: 1px;
  overflow: hidden;
}
.ex-tb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 48px;
  padding: 2px 5px 1px;
  background: none;
  border: none;
  position: relative;
}
.ex-tb img { width: 20px; height: 20px; }
.ex-tb span { font-size: 11px; line-height: 12px; white-space: nowrap; }
.ex-tb-drop { position: absolute; right: 2px; top: 8px; font-style: normal; font-size: 8px; }
.ex-tb:hover:not(:disabled) { box-shadow: inset -1px -1px #808080, inset 1px 1px #fff; }
.ex-tb:active:not(:disabled),
.ex-tb.on { box-shadow: inset 1px 1px #808080, inset -1px -1px #fff; background: #f4f4f4; }
.ex-tb:disabled { cursor: default; }
.ex-tb:disabled img { filter: grayscale(1) opacity(0.45); }
.ex-tb:disabled span { color: #808080; text-shadow: 1px 1px #fff; }
.ex-tb:focus-visible { outline: 1px dotted #000; outline-offset: -3px; }
.ex-tb-sep {
  width: 2px;
  margin: 3px 3px;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
}

/* ---- Address bar ---- */
.ex-address {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 2px 3px 3px;
  border-bottom: 1px solid #808080;
  box-shadow: 0 1px #fff;
  margin-bottom: 2px;
}
.ex-addr-label { color: #444; padding: 0 2px; }
.ex-addr-box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 22px;
  background: #fff;
  box-shadow: inset -1px -1px #fff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  padding: 2px 2px 2px 4px;
}
.ex-addr-ico { width: 16px; height: 16px; flex: 0 0 auto; margin-right: 4px; }
.ex-addr-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 0;
  color: #000;
  letter-spacing: 0.5px;
}
.ex-addr-input::selection { background: #3a2eaa; color: #fff; }
.ex-addr-drop, .ex-go, .ex-btn, .ex-th {
  background: #eaeaea;
  border: none;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
}
.ex-addr-drop { width: 16px; height: 18px; padding: 0; font-size: 9px; line-height: 18px; }
.ex-go { height: 22px; padding: 0 10px; }
.ex-addr-drop:active, .ex-go:active, .ex-btn:active, .ex-th:active {
  box-shadow: inset 1px 1px #0a0a0a, inset -1px -1px #fff, inset 2px 2px #808080, inset -2px -2px #dfdfdf;
}
.ex-go:focus-visible, .ex-btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

/* ---- Body: optional pane + file view ---- */
.ex-body {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 3px;
}
.ex-pane {
  flex: 0 0 186px;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: inset -1px -1px #fff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  padding: 2px;
  min-height: 0;
  overflow: hidden;
}
.ex-pane[hidden] { display: none; }
.ex-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 auto;
  padding: 2px 3px 3px 5px;
  background: #eaeaea;
  border-bottom: 1px solid #808080;
}
.ex-pane-x {
  width: 16px; height: 14px; padding: 0;
  border: none;
  background: #eaeaea url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAHCAYAAAA1WQxeAAAALklEQVR42mNkYGD4zwABjAyo4D865z82PiMuHVhMxGoSAxMOE/4T0oniBry+AAB8vRD4vxB3oAAAAABJRU5ErkJggg==") no-repeat 4px 3px;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
}
.ex-pane-x:active { box-shadow: inset 1px 1px #0a0a0a, inset -1px -1px #fff, inset 2px 2px #808080, inset -2px -2px #dfdfdf; }

.ex-tree { overflow: auto; flex: 1; padding: 4px 2px; }
.ex-tree-line { display: flex; align-items: center; height: 19px; white-space: nowrap; }
.ex-tree-tog {
  width: 11px; height: 11px; flex: 0 0 11px;
  padding: 0; margin-right: 3px;
  background: #fff; border: 1px solid #808080;
  font-size: 10px; line-height: 8px; text-align: center;
}
.ex-tree-sp { width: 14px; flex: 0 0 14px; }
.ex-tree-row {
  display: flex; align-items: center; gap: 4px;
  background: none; border: none; padding: 1px 3px 1px 1px;
}
.ex-tree-row img { width: 16px; height: 16px; }
.ex-tree-row.cur span { background: #3a2eaa; color: #fff; outline: 1px dotted #fff; outline-offset: -1px; padding: 0 2px; margin: 0 -2px; }
.ex-tree-row:focus-visible span { outline: 1px dotted #000; }

.ex-search { padding: 8px 8px 10px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.ex-search label { display: flex; flex-direction: column; gap: 3px; }
.ex-field {
  height: 22px;
  padding: 2px 4px;
  border: none;
  outline: none;
  background: #fff;
  color: #000;
  letter-spacing: 0.5px;
  box-shadow: inset -1px -1px #fff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
select.ex-field {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='18'%3E%3Crect width='16' height='18' fill='%23eaeaea'/%3E%3Cpath d='M0 0h16v18H0z' fill='none' stroke='%23808080'/%3E%3Cpath d='M4 7h7l-3.5 4z'/%3E%3C/svg%3E") no-repeat right 2px center;
  padding-right: 22px;
}
.ex-search-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ex-btn { min-width: 74px; height: 23px; padding: 0 8px; }
.ex-hint { margin: 2px 0 0; font-size: 11px; color: #555; line-height: 1.35; }

/* ---- File view ---- */
.ex-view {
  flex: 1;
  min-width: 0;
  overflow: auto;
  background: #fff;
  box-shadow: inset -1px -1px #fff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  padding: 2px;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}
.ex-view.ex-flash { opacity: 0.3; }
.ex-empty { padding: 14px 12px; color: #555; }

.ex-items { display: flex; flex-wrap: wrap; align-content: flex-start; padding: 4px; }
.ex-item { cursor: default; }
.ex-label { overflow-wrap: anywhere; }

/* Large icons */
.ex-v-icons .ex-item {
  width: 84px;
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 2px 6px;
  text-align: center;
}
.ex-v-icons .ex-ico { display: inline-block; line-height: 0; margin-bottom: 4px; }
.ex-v-icons .ex-ico img { width: 32px; height: 32px; }
.ex-v-icons .ex-label { padding: 0 2px; max-width: 80px; }

/* Thumbnails */
.ex-v-thumbnails .ex-items { gap: 6px; padding: 8px; }
.ex-v-thumbnails .ex-item {
  width: 108px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.ex-thumb {
  width: 104px; height: 104px;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border: 1px solid #c8c8c8;
  box-shadow: 1px 1px 0 #808080;
  margin-bottom: 4px;
  overflow: hidden;
}
.ex-thumb img { max-width: 100px; max-height: 100px; width: auto; height: auto; display: block; }
.ex-thumb .ex-thumb-ico { width: 32px; height: 32px; }
.ex-v-thumbnails .ex-label {
  padding: 0 2px; max-width: 104px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* List */
.ex-v-list .ex-items { flex-direction: column; flex-wrap: wrap; height: 100%; align-content: flex-start; padding: 3px; overflow: visible; }
.ex-v-list .ex-item { display: flex; align-items: center; gap: 4px; height: 19px; min-width: 170px; max-width: 220px; padding-right: 10px; }
.ex-v-list .ex-ico img { width: 16px; height: 16px; display: block; }
.ex-v-list .ex-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }

/* Details */
.ex-v-details { padding: 0 2px 2px; }
.ex-table { border-collapse: collapse; width: 100%; min-width: 600px; table-layout: fixed; }
.ex-table.has-folder { min-width: 740px; }
.ex-table thead th { position: sticky; top: 0; padding: 0; background: #eaeaea; z-index: 1; font-weight: normal; }
.ex-th { width: 100%; height: 19px; text-align: left; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-arrow { font-size: 8px; color: #555; }
.ex-table td { padding: 1px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 19px; }
.ex-c-name { width: auto; min-width: 150px; }
.ex-c-folder { width: 128px; }
.ex-c-size { width: 70px; text-align: right; }
th.ex-c-size .ex-th { text-align: right; }
.ex-c-type { width: 116px; }
.ex-c-date { width: 128px; }
.ex-drow { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; }
.ex-drow img { width: 16px; height: 16px; flex: 0 0 16px; }
.ex-drow .ex-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }

/* Selection — Win98 blue tint on icons, highlighted labels */
.ex-item.sel .ex-label { background: #3a2eaa; color: #fff; }
.ex-item.sel .ex-ico, .ex-item.sel .ex-drow img { background: #3a2eaa; }
.ex-item.sel .ex-ico img, .ex-item.sel .ex-drow img { opacity: 0.6; }
.ex-item.sel .ex-thumb { border: 2px solid #3a2eaa; box-shadow: none; }
.ex-view:focus .ex-item.focus .ex-label { outline: 1px dotted #000; outline-offset: -1px; }
.ex-view:focus .ex-item.focus.sel .ex-label { outline-color: #fff; }

/* ---- Status bar ---- */
.ex-status {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
  margin-top: 2px;
  height: 20px;
}
.ex-status > span {
  display: flex; align-items: center; gap: 4px;
  padding: 0 5px;
  box-shadow: inset 1px 1px #808080, inset -1px -1px #fff;
  white-space: nowrap; overflow: hidden;
  font-size: 11px;
}
.ex-s1 { flex: 1; min-width: 0; }
.ex-s2 { flex: 0 0 88px; }
.ex-s3 { flex: 0 0 118px; }
.ex-s3 img { width: 16px; height: 16px; }
.ex-nostatus .ex-status { display: none; }

/* ---- Narrow windows / phones ---- */
.ex-narrow .ex-tb { min-width: 36px; padding: 3px 4px; }
.ex-narrow .ex-tb span { display: none; }
.ex-narrow .ex-tb-drop { top: auto; bottom: 2px; }
.ex-narrow .ex-addr-label { display: none; }
.ex-narrow .ex-pane {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: min(240px, 86%);
  z-index: 3;
  box-shadow: inset -1px -1px #fff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a, 3px 0 8px rgba(0,0,0,0.25);
}
.ex-narrow .ex-s3 { display: none; }
.ex-narrow .ex-v-thumbnails .ex-items { gap: 4px; padding: 6px; justify-content: space-around; }
.ex-narrow .ex-v-thumbnails .ex-item { width: 92px; }
.ex-narrow .ex-thumb { width: 88px; height: 88px; }
.ex-narrow .ex-thumb img { max-width: 84px; max-height: 84px; }
.ex-tiny .ex-go { display: none; }
.ex-tiny .ex-menubar .ex-mb-item { padding: 2px 5px; }

@media (hover: none) {
  .ex-v-icons .ex-item, .ex-v-list .ex-item, .ex-table td { cursor: pointer; }
  .ex-tree-line { height: 26px; }
  .ex-menu-item { padding-top: 6px; padding-bottom: 6px; }
}

/* ---- Popup menus ---- */
.ex-menu {
  position: fixed;
  z-index: 99990;
  min-width: 150px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2px;
  background: #eaeaea;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px #808080, inset 2px 2px #fff, 2px 2px 4px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}
.ex-menu-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  text-align: left;
  background: none;
  border: none;
  padding: 3px 12px 3px 2px;
  white-space: nowrap;
  outline: none;
}
.ex-menu-item.bold .ex-mlabel { font-weight: bold; }
.ex-mark { text-align: center; font-size: 10px; }
.ex-mkey { padding-left: 22px; }
.ex-menu-item:hover:not(.disabled),
.ex-menu-item:focus:not(.disabled) { background: #3a2eaa; color: #fff; }
.ex-menu-item.disabled { color: #808080; text-shadow: 1px 1px #fff; cursor: default; }
.ex-menu-sep { height: 0; margin: 3px 1px; border-top: 1px solid #808080; border-bottom: 1px solid #fff; }
.ex-addr-menu .ex-menu-item { grid-template-columns: 0 1fr auto; }
.ex-addr-menu .ex-mark { display: none; }

/* ---- Dialogs ---- */
.ex-dialog-shade { position: fixed; inset: 0; z-index: 99995; }
.ex-dialog {
  position: fixed;
  min-width: 260px;
  max-width: min(380px, calc(100vw - 16px));
  padding: 3px;
  background: #eaeaea;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px #808080, inset 2px 2px #fff, 3px 3px 10px rgba(0,0,0,0.35);
}
.ex-dialog.flash .ex-dialog-title { background: linear-gradient(90deg, #808080, #b5b5b5); }
.ex-dialog-title {
  display: flex; justify-content: space-between; align-items: center;
  height: 18px; padding: 0 2px 0 5px;
  background: linear-gradient(90deg, #3a2eaa, #3ca0ff);
  color: #fff; font-weight: bold;
}
.ex-dialog-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-dialog-x {
  width: 16px; height: 14px; padding: 0; border: none;
  background: #c0c0c0 url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAHCAYAAAA1WQxeAAAALklEQVR42mNkYGD4zwABjAyo4D865z82PiMuHVhMxGoSAxMOE/4T0oniBry+AAB8vRD4vxB3oAAAAABJRU5ErkJggg==") no-repeat 4px 3px;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
}
.ex-dialog-body { padding: 12px 12px 8px; }
.ex-dialog-btns { display: flex; justify-content: center; gap: 6px; padding: 4px 0 8px; }
.ex-msg { display: flex; gap: 12px; align-items: flex-start; }
.ex-msg p { margin: 4px 0 0; line-height: 1.4; }
.ex-msg-ico {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: bold; font-size: 16px; border: 1px solid #000;
}
.ex-msg-ico.err { background: #c62828; }
.ex-msg-ico.info { background: #3a2eaa; font-family: Georgia, serif; font-size: 20px; font-style: italic; }
.ex-props-head { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; }
.ex-props-head img { width: 32px; height: 32px; image-rendering: pixelated; }
.ex-props-head span { overflow-wrap: anywhere; }
.ex-props-rule { border-top: 1px solid #808080; border-bottom: 1px solid #fff; margin-bottom: 8px; }
.ex-props { border-collapse: collapse; }
.ex-props th { text-align: left; font-weight: normal; padding: 3px 14px 3px 0; vertical-align: top; white-space: nowrap; }
.ex-props td { padding: 3px 0; overflow-wrap: anywhere; }

/* ---- Notepad ---- */
.np { display: flex; flex-direction: column; flex: 1; min-height: 0; height: 100%; background: #eaeaea; }
.np-text {
  flex: 1;
  min-height: 0;
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  margin: 0;
  padding: 6px 8px;
  background: #fff;
  color: #000;
  box-shadow: inset -1px -1px #fff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  font-family: "w95f", "Courier New", monospace;
  letter-spacing: 0.5px;
  line-height: 1.5;
  overflow: auto;
  overflow-wrap: break-word;
  border-radius: 0;
  -webkit-appearance: none;
}
.np-text.sz-s { font-size: 12px; }
.np-text.sz-m { font-size: 14px; }
.np-text.sz-l { font-size: 17px; }
.np-text::selection { background: #3a2eaa; color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .ex-view.ex-flash { opacity: 1; }
}
