/* =========================================================
   Mac Finder Module — System 7 Aesthetic
   Font: Chicago (fallback stack)
   ========================================================= */

/* ---- ChicagoFLF web font (graceful fallback) ---- */
@font-face {
  font-family: 'ChicagoFLF';
  src: url('https://fonts.cdnfonts.com/s/30112/ChicagoFLF.woff') format('woff');
  font-display: swap;
}

/* ---- Root container ---- */
/* Hard-reset all DumbOS theme variables so dark theme can't bleed in */
.mf-root {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'ChicagoFLF', 'Chicago', Geneva, 'Lucida Grande', sans-serif;
  font-size: 12px;
  background-color: #aaaaaa;
  /* Diagonal line texture (System 7 desktop) */
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 1px,
    rgba(255,255,255,0.18) 1px,
    rgba(255,255,255,0.18) 2px
  );
  user-select: none;
  cursor: default;
  /* Force black text everywhere — override DumbOS dark theme */
  color: #000000;
  --text-primary: #000000;
  --text-secondary: #000000;
  --text-muted: #555555;
  --bg-primary: #ffffff;
  --bg-secondary: #f0f0f0;
  --bg-window: #ffffff;
  --border-color: #000000;
}

/* Explicit black text on all descendant elements */
.mf-root *:not(svg):not(path):not(rect):not(line):not(circle):not(polygon) {
  color: #000000;
}

/* ---- Menu Bar ---- */
.mf-menubar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: #ffffff;
  border-bottom: 1px solid #000000;
  display: flex;
  align-items: center;
  z-index: 1000;
  padding: 0 4px;
}

.mf-menu-item {
  padding: 1px 8px;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: default;
  white-space: nowrap;
  font-size: 12px;
  position: relative;
}

.mf-menu-item:hover,
.mf-menu-item.active {
  background: #000080;
  color: #ffffff !important;
}

.mf-menu-item svg {
  width: 14px;
  height: 14px;
}

/* Apple menu icon */
.mf-apple-menu {
  font-size: 14px;
  padding: 0 10px;
}

/* ---- Dropdown Menus ---- */
.mf-dropdown {
  display: none;
  position: absolute;
  top: 20px;
  left: 0;
  min-width: 160px;
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  z-index: 2000;
}

.mf-dropdown.open {
  display: block;
}

.mf-dropdown-item {
  padding: 2px 18px 2px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: default;
  white-space: nowrap;
  font-size: 12px;
  height: 18px;
}

.mf-dropdown-item:hover:not(.disabled):not(.separator) {
  background: #000080;
  color: #ffffff !important;
}

.mf-dropdown-item.disabled {
  color: #999999 !important;
  cursor: default;
}

.mf-dropdown-item.separator {
  height: 1px;
  padding: 0;
  border-top: 1px solid #999999;
  margin: 2px 4px;
}

.mf-dropdown-item .mf-shortcut {
  font-size: 11px;
  margin-left: 20px;
  color: inherit;
}

/* ---- Desktop Area ---- */
.mf-desktop {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  bottom: 0;
}

/* ---- Desktop Icons (HD, Trash) ---- */
.mf-desktop-icon {
  position: absolute;
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
  padding: 4px;
}

.mf-desktop-icon .mf-icon-img {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mf-desktop-icon .mf-icon-label {
  font-size: 11px;
  text-align: center;
  padding: 1px 3px;
  line-height: 1.3;
  max-width: 70px;
  word-break: break-word;
}

.mf-desktop-icon.selected .mf-icon-label {
  background: #000080;
  color: #ffffff !important;
}

.mf-desktop-icon.selected .mf-icon-img svg rect,
.mf-desktop-icon.selected .mf-icon-img svg path,
.mf-desktop-icon.selected .mf-icon-img svg polygon {
  fill: #000080;
}

/* ---- Finder Sub-Windows ---- */
.mf-window {
  position: absolute;
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  min-width: 200px;
  min-height: 120px;
}

.mf-window.focused {
  z-index: 500;
}

/* Title bar — System 7 striped drag bar */
.mf-titlebar {
  height: 20px;
  background: repeating-linear-gradient(
    180deg,
    #ffffff 0px,
    #ffffff 1px,
    #aaaaaa 1px,
    #aaaaaa 2px
  );
  border-bottom: 1px solid #000000;
  display: flex;
  align-items: center;
  cursor: move;
  flex-shrink: 0;
  position: relative;
}

.mf-window:not(.focused) .mf-titlebar {
  background: #dddddd;
}

.mf-window:not(.focused) .mf-window-title {
  color: #888888 !important;
}

.mf-close-box {
  width: 13px;
  height: 13px;
  border: 1px solid #000000;
  margin-left: 4px;
  margin-right: 4px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 10px;
  line-height: 1;
}

.mf-close-box:hover {
  background: #000000;
  color: #ffffff;
}

.mf-window-title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  pointer-events: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 0 20px;
}

.mf-zoom-box {
  width: 13px;
  height: 13px;
  border: 1px solid #000000;
  margin-right: 4px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 8px;
}

/* Info bar below title — 3-column Mac format */
.mf-window-info {
  height: 18px;
  border-bottom: 1px solid #000000;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  font-size: 11px;
}

.mf-info-bar {
  display: flex;
  align-items: stretch;
}

.mf-info-count,
.mf-info-disk,
.mf-info-avail {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 6px;
  border-right: 1px solid #999999;
  white-space: nowrap;
  overflow: hidden;
  font-size: 11px;
}

.mf-info-avail {
  border-right: none;
}

/* Window content */
.mf-window-content {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* Status bar */
.mf-window-status {
  height: 16px;
  border-top: 1px solid #000000;
  background: #e8e8e8;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  flex-shrink: 0;
}

/* ---- Icon View ---- */
.mf-icon-view {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  padding: 12px 8px;
  gap: 0;
  min-height: 100%;
}

.mf-file-icon {
  width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
  padding: 6px 4px;
  position: relative;
}

.mf-file-icon .mf-icon-img {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.mf-file-icon .mf-icon-label {
  font-size: 11px;
  text-align: center;
  padding: 1px 3px;
  line-height: 1.3;
  max-width: 84px;
  word-break: break-word;
  pointer-events: none;
}

.mf-file-icon.selected .mf-icon-label {
  background: #000080;
  color: #ffffff !important;
}

.mf-file-icon .mf-icon-label-input {
  font-family: inherit;
  font-size: 11px;
  text-align: center;
  border: 1px solid #000000;
  background: #ffffff;
  padding: 1px 2px;
  width: 66px;
  outline: none;
  box-sizing: border-box;
}

/* ---- List View ---- */
.mf-list-view {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.mf-list-view table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mf-list-view thead th {
  background: #cccccc;
  border-bottom: 1px solid #000000;
  border-right: 1px solid #000000;
  padding: 2px 8px;
  text-align: left;
  font-weight: normal;
  position: sticky;
  top: 0;
  cursor: pointer;
}

.mf-list-view thead th:hover {
  background: #aaaaaa;
}

.mf-list-view tbody tr {
  border-bottom: 1px solid #cccccc;
  cursor: default;
}

.mf-list-view tbody tr:hover {
  background: #e8e8e8;
}

.mf-list-view tbody tr.selected {
  background: #000080;
  color: #ffffff !important;
}

.mf-list-view tbody td {
  padding: 2px 8px;
  border-right: 1px solid #cccccc;
}

.mf-list-view .mf-list-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  vertical-align: middle;
}

.mf-list-view .mf-list-icon svg {
  width: 16px;
  height: 16px;
}

/* ---- Drag Ghost ---- */
.mf-drag-ghost {
  position: fixed;
  pointer-events: none;
  opacity: 0.6;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

/* ---- Modal Overlay ---- */
.mf-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

/* ---- Dialogs ---- */
.mf-dialog {
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
  padding: 16px;
  min-width: 280px;
  max-width: 380px;
  font-family: 'ChicagoFLF', 'Chicago', Geneva, 'Lucida Grande', sans-serif;
  font-size: 12px;
}

.mf-dialog-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.mf-dialog-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.mf-dialog-title {
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 4px;
}

.mf-dialog-body {
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.mf-dialog-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* System 7 button style */
.mf-btn {
  font-family: 'ChicagoFLF', 'Chicago', Geneva, 'Lucida Grande', sans-serif;
  font-size: 12px;
  min-width: 56px;
  height: 20px;
  background: #ffffff;
  border: 1px solid #000000;
  padding: 0 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mf-btn:hover {
  background: #e0e0e0;
}

.mf-btn:active {
  background: #aaaaaa;
}

/* Default/OK button has double border */
.mf-btn-default {
  border: 3px solid #000000;
  outline: 1px solid #000000;
  outline-offset: -3px;
}

.mf-btn-default:hover {
  background: #cccccc;
}

/* Password input */
.mf-dialog input[type="password"],
.mf-dialog input[type="text"] {
  font-family: 'ChicagoFLF', 'Chicago', Geneva, 'Lucida Grande', sans-serif;
  font-size: 12px;
  border: 1px solid #000000;
  background: #ffffff;
  padding: 2px 6px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  margin-top: 6px;
  height: 20px;
}

.mf-dialog input:focus {
  outline: 1px solid #000080;
  outline-offset: 1px;
}

/* Shake animation for wrong password */
@keyframes mf-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.mf-shake {
  animation: mf-shake 0.35s ease;
}

/* ---- About Dialog ---- */
.mf-about-dialog {
  min-width: 340px;
}

.mf-about-title {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 2px;
}

.mf-about-subtitle {
  font-size: 11px;
  color: #555555;
  margin-bottom: 12px;
}

/* Memory bar */
.mf-memory-bar-wrap {
  margin-top: 8px;
  border: 1px solid #000000;
  height: 14px;
  background: #ffffff;
  position: relative;
  font-size: 10px;
}

.mf-memory-bar-fill {
  height: 100%;
  background: #000080;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff !important;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.mf-memory-label {
  font-size: 10px;
  margin-top: 2px;
  display: flex;
  justify-content: space-between;
}

/* ---- SimpleText image viewer ---- */
.mf-simpletext-content {
  padding: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 200px;
}

.mf-simpletext-content img {
  max-width: 100%;
  max-height: 360px;
  border: 1px solid #cccccc;
}

/* ---- Get Info dialog ---- */
.mf-info-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}

.mf-info-label {
  font-weight: bold;
  min-width: 80px;
  flex-shrink: 0;
}

/* ---- Happy Mac splash ---- */
.mf-splash {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  transition: opacity 0.4s ease;
}

.mf-splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.mf-happy-mac-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.mf-happy-mac-large svg {
  width: 80px;
  height: 80px;
}

.mf-happy-mac-label {
  font-size: 13px;
  color: #000000;
  letter-spacing: 0.05em;
}

/* ---- Trash drop zone highlight ---- */
.mf-trash-drop-active .mf-icon-img {
  filter: brightness(0.7);
}

/* ---- Resize handle ---- */
.mf-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
  background: repeating-linear-gradient(
    -45deg,
    #000000,
    #000000 1px,
    transparent 1px,
    transparent 3px
  );
}

/* ---- View toggle buttons in window toolbar ---- */
.mf-view-toggles {
  display: flex;
  gap: 0;
  margin-left: auto;
  margin-right: 4px;
}

.mf-view-btn {
  width: 20px;
  height: 14px;
  border: 1px solid #000000;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

.mf-view-btn.active {
  background: #000080;
  color: #ffffff !important;
}

.mf-view-btn:not(:last-child) {
  border-right: none;
}

/* ---- Mac-style scrollbars ---- */
.mf-window-content::-webkit-scrollbar {
  width: 15px;
  height: 15px;
}

.mf-window-content::-webkit-scrollbar-track {
  background: repeating-linear-gradient(
    45deg,
    #ffffff,
    #ffffff 1px,
    #c8c8c8 1px,
    #c8c8c8 2px
  );
  border-left: 1px solid #000000;
  border-top: 1px solid #000000;
}

.mf-window-content::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border: 1px solid #000000;
  box-shadow: inset 1px 1px 0 #e8e8e8, inset -1px -1px 0 #888888;
}

/* Up/left arrows */
.mf-window-content::-webkit-scrollbar-button:single-button:vertical:decrement {
  background: #c0c0c0;
  border: 1px solid #000000;
  height: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15'%3E%3Cpolygon points='7.5,4 12,11 3,11' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Down/right arrows */
.mf-window-content::-webkit-scrollbar-button:single-button:vertical:increment {
  background: #c0c0c0;
  border: 1px solid #000000;
  height: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15'%3E%3Cpolygon points='7.5,11 12,4 3,4' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.mf-window-content::-webkit-scrollbar-button:single-button:horizontal:decrement {
  background: #c0c0c0;
  border: 1px solid #000000;
  width: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15'%3E%3Cpolygon points='4,7.5 11,3 11,12' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.mf-window-content::-webkit-scrollbar-button:single-button:horizontal:increment {
  background: #c0c0c0;
  border: 1px solid #000000;
  width: 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15'%3E%3Cpolygon points='11,7.5 4,3 4,12' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Hide double-button scrollbar arrows */
.mf-window-content::-webkit-scrollbar-button:double-button {
  display: none;
}

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