/* ============================================================
   GUI Chrome — Shared Windows 3.x / Classic Mac window styles
   Used by base.html for the desktop + window frame layout.
   ============================================================ */

/* --- Font Definitions (bitmap pixel fonts) --- */

@font-face {
  font-family: 'Header-Reg';
  src: url('../fonts/sysfont.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Header-Bold';
  src: url('../fonts/sysfont.woff') format('woff');
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: 'Body-Reg';
  src: url('../fonts/Web437_Cordata_PPC-21.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Body-Bold';
  src: url('../fonts/Web437_Cordata_PPC-400.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

/* Bitmap fonts are single-weight; remap bold to the bold font file */
.font-bold, b, strong {
  font-family: 'Body-Bold', monospace !important;
  font-weight: normal !important;
}

/* Retro text field */
.gui-field {
  position: relative;
  border: 1px solid #000;
  background: #fff;
  box-sizing: border-box;
  height: 20px;
}

.gui-input {
  display: block;
  width: 100%;
  height: 20px;
  border: none;
  outline: none;
  padding: 0 4px;
  margin: 0;
  font-family: 'Body-Reg', monospace !important;
  font-size: 12px !important;
  line-height: 20px !important;
  background: transparent;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
}

.gui-input:focus {
  line-height: 20px !important;
  padding: 0 4px !important;
}

/* Mirror layer — Chrome blocks custom fonts on :-webkit-autofill text */
.gui-field-mirror {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  padding: 0 4px;
  font-family: 'Body-Reg', monospace !important;
  font-size: 12px !important;
  line-height: 20px !important;
  pointer-events: none;
  overflow: hidden;
  white-space: nowrap;
  color: #000;
  background: transparent;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  box-sizing: border-box;
  z-index: 1;
}

.gui-field.show-mirror .gui-field-mirror {
  display: block;
}

.gui-field.show-mirror .gui-input {
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  caret-color: #000;
}

/* Hidden input that receives browser autofill; value is copied to .gui-input */
.gui-input-autofill-helper {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: none;
  padding: 0;
  margin: 0;
  pointer-events: none;
  z-index: -1;
}

.gui-input:-webkit-autofill,
.gui-input:-webkit-autofill:hover,
.gui-input:-webkit-autofill:focus,
.gui-input:-webkit-autofill:active,
.gui-input:autofill {
  animation: gui-autofill-fix 1ms;
  -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
  box-shadow: 0 0 0 1000px #fff inset !important;
  transition: background-color 99999s ease-in-out 0s;
}

@keyframes gui-autofill-fix {
  from { opacity: 1; }
  to   { opacity: 1; }
}

/* --- Global Layout Lock --- */

html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100%;
}

* {
  box-sizing: border-box;
}

/* Override base.html <main> to allow full-screen desktop */
main.gui-main {
  padding: 0 !important;
  margin: 0 !important;
  flex-grow: 1;
}

main.gui-main > div {
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* --- Desktop Background --- */

#desktop-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;

  background-image: url('../img/bitmapPanelSmall.png');
  background-repeat: repeat;
  image-rendering: pixelated;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5in;
  padding-top: calc(0.5in + 22px); /* Account for menu bar height */
  margin: 0;
}

/* --- Menu Bar (Classic Mac / Windows 3.x top bar) --- */

.menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background-color: #ffffff;
  border-bottom: 1px solid #000000;
  font-family: 'Header-Reg', monospace;
  font-size: 14px;
  user-select: none;
  z-index: 10000;
}

.menu-item {
  position: relative;
  cursor: pointer;
}

.menu-item:hover {
  background-color: #000080;
  color: white;
}

.menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #ffffff;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  min-width: 150px;
  z-index: 50;
  padding: 2px;
  color: black;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
}

.menu-item:hover .menu-dropdown {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 4px 12px;
  text-decoration: none;
  color: black;
  white-space: nowrap;
}

.dropdown-item:hover {
  background-color: #000080;
  color: white;
}

.dropdown-separator {
  border-top: 1px solid #808080;
  margin: 1px 0;
}

/* Right-aligned menu items (username, etc.) */
.menu-spacer {
  flex: 1;
}

/* --- Window Frame --- */

.window-frame {
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  border-top: none;
  border-left: none;
  border-right: 1px solid #000000;
  border-bottom: 1px solid #000000;
  box-shadow: 2px 2px 0 #000000;
  display: flex;
  flex-direction: column;
}

/* --- Title Bar (blue gradient) --- */

.title-bar {
  background: linear-gradient(90deg, #000080, #1084d0);
  padding: 3px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  font-family: 'Header-Bold', sans-serif;
  font-weight: normal;
  font-size: 14px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* --- Window Toolbar (optional, below title bar) --- */

.window-toolbar {
  padding: 4px;
  border-bottom: 1px solid #808080;
  display: flex;
  gap: 8px;
  align-items: center;
  background-color: #ffffff;
  flex-shrink: 0;
}

/* Retro toolbar button */
.toolbar-btn {
  height: 18px;
  padding: 0 8px;
  background-color: #c0c0c0;
  border: 1px solid #000;
  box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 #808080;
  font-family: 'Header-Reg', monospace;
  font-size: 12px;
  line-height: 16px;
  color: #000;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.toolbar-btn:hover {
  background-color: #d0d0d0;
}

.toolbar-btn:active {
  box-shadow: inset -1px -1px 0 #fff, inset 1px 1px 0 #808080;
  background-color: #a0a0a0;
}

/* --- Window Content Area --- */

.window-content {
  background-color: #ffffff;
  padding: 0;
  flex-grow: 1;
  border: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Scrollable variant for pages with overflow content */
.window-content-scroll {
  background-color: #ffffff;
  padding: 16px;
  flex-grow: 1;
  border: none;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* --- Status Bar (bottom of window) --- */

.status-bar {
  border-top: 1px solid #dfdfdf;
  padding: 2px 6px;
  font-size: 12px;
  font-family: 'Body-Reg', monospace;
  display: flex;
  gap: 16px;
  color: #404040;
  flex-shrink: 0;
}

/* --- Retro Scrollbar (for window-content-scroll) --- */

.window-content-scroll::-webkit-scrollbar {
  width: 18px;
  height: 18px;
  background: #c0c0c0;
}

.window-content-scroll::-webkit-scrollbar-track {
  background-color: #c0c0c0;
  border-left: 1px solid #000000;
  background-image: radial-gradient(#000 1px, transparent 1px);
  background-size: 6px 6px;
}

.window-content-scroll::-webkit-scrollbar-corner {
  background-color: #c0c0c0;
  border: 1px solid #000000;
}

.window-content-scroll::-webkit-scrollbar-thumb {
  background-color: #c0c0c0;
  border: 1px solid #000;
  background-image: radial-gradient(#000 0.5px, transparent 0.5px);
  background-size: 2px 2px;
  min-height: 20px;
  box-shadow: none;
}

.window-content-scroll::-webkit-scrollbar-button {
  display: block;
  height: 18px;
  width: 18px;
  background-color: #c0c0c0;
  border: 1px solid #000000;
}

.window-content-scroll::-webkit-scrollbar-button:vertical:start:decrement {
  border-bottom: 1px solid #000;
  background-image:
    url("data:image/svg+xml;charset=utf-8,%3Csvg width='12' height='12' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 2 L2 8 L10 8 Z' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E"),
    radial-gradient(#000 0.5px, transparent 0.5px);
  background-position: center, 0 0;
  background-repeat: no-repeat, repeat;
  background-size: auto, 4px 4px;
  display: block;
}

.window-content-scroll::-webkit-scrollbar-button:vertical:end:increment {
  border-top: 1px solid #000;
  background-image:
    url("data:image/svg+xml;charset=utf-8,%3Csvg width='12' height='12' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 10 L2 4 L10 4 Z' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E"),
    radial-gradient(#000 0.5px, transparent 0.5px);
  background-position: center, 0 0;
  background-repeat: no-repeat, repeat;
  background-size: auto, 4px 4px;
  display: block;
}

.window-content-scroll::-webkit-scrollbar-button:vertical:start:increment,
.window-content-scroll::-webkit-scrollbar-button:vertical:end:decrement {
  display: none;
}

/* --- Retro Dialog (modal window on desktop) --- */

.retro-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.retro-dialog {
  background-color: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  box-shadow: 4px 4px 0 #000000;
  min-width: 300px;
  max-width: 90vw;
}

.retro-dialog .title-bar {
  padding: 2px 4px;
  font-size: 12px;
}

.retro-dialog-body {
  padding: 12px;
  background-color: #c0c0c0;
  font-family: 'Body-Reg', monospace;
  font-size: 14px;
}

.retro-dialog-footer {
  padding: 8px 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Retro dialog button */
.retro-btn {
  height: 22px;
  padding: 0 16px;
  background-color: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #404040 #404040 #dfdfdf;
  font-family: 'Header-Reg', monospace;
  font-size: 12px;
  line-height: 18px;
  color: #000;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.retro-btn:hover {
  background-color: #d0d0d0;
}

.retro-btn:active {
  border-color: #404040 #dfdfdf #dfdfdf #404040;
  background-color: #a0a0a0;
}

.retro-btn-primary {
  border: 3px solid;
  border-color: #000 #000 #000 #000;
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080;
}

/* --- Group Box (retro fieldset) --- */

.group-box {
  border: 1px solid #808080;
  box-shadow: 1px 1px 0 #dfdfdf;
  padding: 12px;
  margin-bottom: 12px;
  position: relative;
}

.group-box-label {
  position: absolute;
  top: -8px;
  left: 8px;
  background-color: #ffffff;
  padding: 0 4px;
  font-family: 'Header-Reg', monospace;
  font-size: 12px;
  color: #000;
}

/* --- Messages (inside window content) --- */

.gui-message {
  padding: 6px 8px;
  margin: 4px 4px 0;
  border: 1px solid #000;
  background-color: #ffffcc;
  font-family: 'Body-Reg', monospace;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gui-message-icon {
  font-weight: bold;
  font-size: 14px;
}

/* --- Retro Listbox (classic Mac file-list style) --- */

.retro-listbox {
  border: 2px solid #000;
  background-color: #ffffff;
  overflow-y: scroll;
  overflow-x: hidden;
  user-select: none;
}

.retro-listbox-item {
  padding: 1px 6px;
  font-family: 'Header-Reg', monospace;
  font-size: 12px;
  line-height: 16px;
  color: #000;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.retro-listbox-item.selected {
  background-color: #000;
  color: #fff;
}

.retro-listbox.disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Retro scrollbar for listbox — matches timesheet spreadsheet scrollbar */
.retro-listbox::-webkit-scrollbar {
  width: 18px;
  height: 18px;
  background: #c0c0c0;
}

.retro-listbox::-webkit-scrollbar-track {
  background-color: #c0c0c0;
  border-left: 1px solid #000;
  background-image: radial-gradient(#000 1px, transparent 1px);
  background-size: 6px 6px;
}

.retro-listbox::-webkit-scrollbar-thumb {
  background-color: #c0c0c0;
  border: 1px solid #000;
  background-image: radial-gradient(#000 0.5px, transparent 0.5px);
  background-size: 2px 2px;
  min-height: 20px;
  box-shadow: none;
}

.retro-listbox::-webkit-scrollbar-button {
  display: block;
  height: 18px;
  width: 18px;
  background-color: #c0c0c0;
  border: 1px solid #000;
}

.retro-listbox::-webkit-scrollbar-button:vertical:start:decrement {
  border-bottom: 1px solid #000;
  background-image:
    url("data:image/svg+xml;charset=utf-8,%3Csvg width='12' height='12' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 2 L2 8 L10 8 Z' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E"),
    radial-gradient(#000 0.5px, transparent 0.5px);
  background-position: center, 0 0;
  background-repeat: no-repeat, repeat;
  background-size: auto, 4px 4px;
}

.retro-listbox::-webkit-scrollbar-button:vertical:end:increment {
  border-top: 1px solid #000;
  background-image:
    url("data:image/svg+xml;charset=utf-8,%3Csvg width='12' height='12' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 10 L2 4 L10 4 Z' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E"),
    radial-gradient(#000 0.5px, transparent 0.5px);
  background-position: center, 0 0;
  background-repeat: no-repeat, repeat;
  background-size: auto, 4px 4px;
}

.retro-listbox::-webkit-scrollbar-button:vertical:start:increment,
.retro-listbox::-webkit-scrollbar-button:vertical:end:decrement {
  display: none;
}

/* --- Retro Radio Button --- */

.retro-radio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Header-Reg', monospace;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.retro-radio input[type="radio"] {
  margin: 0;
  accent-color: #000;
}

/* --- Login page (centered Mac-style window) --- */

#desktop-wrapper.login-desktop {
  padding-top: calc(0.5in + 22px);
}
