/* Windows 98 Base Styles */

/* Screen reader only class */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Windows 98 Color Palette */
:root {
  --win98-desktop: #008080;
  --win98-window-bg: #c0c0c0;
  --win98-text: #000000;
  --win98-title-active: #000080;
  --win98-title-inactive: #808080;
  --win98-title-text-active: #ffffff;
  --win98-title-text-inactive: #c0c0c0;
  --win98-button-face: #c0c0c0;
  --win98-button-highlight: #ffffff;
  --win98-button-shadow: #808080;
  --win98-button-dark-shadow: #000000;
}

/* Windows 98 Font */
@font-face {
  font-family: 'MS Sans Serif';
  src: url('../assets/fonts/micross.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'MS Sans Serif';
  src: url('../assets/fonts/micross.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

/* Windows 98 Button */
.win98-button {
  display: inline-block;
  padding: 4px 10px;
  background-color: var(--win98-button-face);
  border: 2px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  color: var(--win98-text);
  font-family: 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
  font-size: 11px;
  box-shadow: 1px 1px 0 0 var(--win98-button-dark-shadow);
  position: relative;
  cursor: pointer;
}

.win98-button:active {
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
  box-shadow: none;
  padding: 5px 9px 3px 11px;
}

/* Windows 98 Inset (for text fields, etc.) */
.win98-inset {
  border: 2px solid;
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
  background-color: #ffffff;
}

/* Windows 98 Checkbox */
.win98-checkbox {
  appearance: none;
  width: 13px;
  height: 13px;
  background-color: #ffffff;
  border: 2px solid;
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
  position: relative;
  cursor: pointer;
}

.win98-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: -2px;
  left: 1px;
  font-size: 11px;
}

/* Windows 98 Radio Button */
.win98-radio {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 2px solid;
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
  position: relative;
  cursor: pointer;
}

.win98-radio:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--win98-text);
}

/* Windows 98 Dropdown */
.win98-dropdown {
  background-color: var(--win98-window-bg);
  border: 2px solid;
  border-color: var(--win98-button-shadow) var(--win98-button-highlight) var(--win98-button-highlight) var(--win98-button-shadow);
  padding: 2px;
}

.win98-dropdown-item {
  padding: 2px 10px;
  cursor: pointer;
}

.win98-dropdown-item:hover {
  background-color: var(--win98-title-active);
  color: var(--win98-title-text-active);
}

.win98-dropdown-divider {
  height: 1px;
  background-color: var(--win98-button-shadow);
  margin: 2px 0;
}

/* Windows 98 Dialog */
.win98-dialog {
  background-color: var(--win98-window-bg);
  border: 2px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  box-shadow: 2px 2px 0 0 var(--win98-button-dark-shadow);
  padding: 10px;
}

/* Windows 98 Scrollbar */
::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-track {
  background-color: var(--win98-window-bg);
}

::-webkit-scrollbar-thumb {
  background-color: var(--win98-window-bg);
  border: 2px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
}

::-webkit-scrollbar-button {
  background-color: var(--win98-window-bg);
  border: 2px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  display: block;
  height: 16px;
  width: 16px;
}/*
 Touch device optimizations */
@media (pointer: coarse) {
  /* Increase touch target sizes */
  .win98-button {
    padding: 8px 12px;
    min-height: 36px;
    min-width: 36px;
  }
  
  .win98-window-button {
    width: 24px;
    height: 24px;
  }
  
  .notepad-menu-item,
  .win98-start-menu-item,
  .notepad-dropdown-item {
    padding: 10px 12px;
    min-height: 44px;
  }
  
  .calculator-row button {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Add touch feedback */
  .win98-button:active,
  .win98-window-button:active,
  .win98-taskbar-item:active,
  .win98-desktop-icon:active,
  .notepad-menu-item:active,
  .notepad-dropdown-item:active,
  .win98-start-menu-item:active,
  .calculator-row button:active {
    opacity: 0.7;
  }
}

/* Error Boundary Styles */
.win98-error-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.win98-error-dialog .win98-dialog {
  max-width: 500px;
  min-width: 300px;
}

.error-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.error-icon {
  width: 32px;
  height: 32px;
  margin-right: 10px;
}

.error-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: bold;
}

.error-content {
  margin-bottom: 15px;
}

.error-details {
  margin-top: 10px;
}

.error-details summary {
  cursor: pointer;
  font-weight: bold;
  margin-bottom: 5px;
}

.error-details pre {
  background-color: #f0f0f0;
  padding: 5px;
  border: 1px solid var(--win98-button-shadow);
  font-size: 10px;
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
}

.error-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Performance optimization classes */
.win98-lazy-load {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.win98-lazy-load.loaded {
  opacity: 1;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .win98-lazy-load {
    transition: none;
  }
  
  .win98-button:active,
  .win98-window-button:active,
  .win98-taskbar-item:active,
  .win98-desktop-icon:active,
  .notepad-menu-item:active,
  .notepad-dropdown-item:active,
  .win98-start-menu-item:active,
  .calculator-row button:active {
    opacity: 1;
  }
}
/*
 Desktop Icon Styles */
.win98-desktop-icon {
  position: absolute;
  width: 64px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  padding: 4px;
  border-radius: 2px;
  transition: background-color 0.1s ease;
  z-index: 1;
}

.win98-desktop-icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.win98-desktop-icon.selected {
  background-color: var(--win98-title-active);
  color: var(--win98-title-text-active);
}

.win98-desktop-icon.dragging {
  opacity: 0.7;
  cursor: grabbing;
  z-index: 9999;
  transform: rotate(2deg);
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.win98-desktop-icon-image {
  width: 32px;
  height: 32px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.win98-desktop-icon-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.win98-desktop-icon-label {
  font-family: 'MS Sans Serif', sans-serif;
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
  word-wrap: break-word;
  max-width: 60px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.win98-desktop-icon.selected .win98-desktop-icon-label {
  color: var(--win98-title-text-active);
  text-shadow: none;
}

/* Drag indicator */
.drag-indicator {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px dashed rgba(255, 255, 255, 0.8);
  border-radius: 4px;
  pointer-events: none;
  animation: drag-pulse 1s infinite alternate;
}

@keyframes drag-pulse {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Grid snap visual feedback */
.win98-desktop-icon.snap-to-grid {
  transition: left 0.2s ease, top 0.2s ease;
}

.win98-desktop-icon.snap-to-grid.dragging {
  transition: none;
}

/* Body class for global drag state */
body.icon-dragging {
  cursor: grabbing;
}

body.icon-dragging .win98-desktop-icon:not(.dragging) {
  opacity: 0.8;
}

/* Touch support */
@media (hover: none) and (pointer: coarse) {
  .win98-desktop-icon {
    width: 72px;
    height: 88px;
    padding: 8px;
  }
  
  .win98-desktop-icon-image {
    width: 40px;
    height: 40px;
  }
  
  .win98-desktop-icon-label {
    font-size: 12px;
    max-width: 68px;
  }
}

/* Focus styles for keyboard navigation */
.win98-desktop-icon:focus {
  outline: 2px dotted var(--win98-title-text-active);
  outline-offset: 2px;
  background-color: rgba(255, 255, 255, 0.2);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .win98-desktop-icon {
    border: 1px solid transparent;
  }
  
  .win98-desktop-icon.selected {
    border-color: var(--win98-title-text-active);
  }
  
  .win98-desktop-icon-label {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .win98-desktop-icon.snap-to-grid {
    transition: none;
  }
  
  .win98-desktop-icon.dragging {
    transform: none;
  }
  
  .drag-indicator {
    animation: none;
    opacity: 0.8;
  }
}/
* Desktop Context Menu Styles */
.win98-context-menu {
  position: fixed;
  background-color: var(--win98-button-face);
  border: 2px solid;
  border-color: var(--win98-button-highlight) var(--win98-button-shadow) var(--win98-button-shadow) var(--win98-button-highlight);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  min-width: 180px;
  font-family: 'MS Sans Serif', sans-serif;
  font-size: 11px;
}

.context-menu-item {
  padding: 6px 16px;
  cursor: pointer;
  user-select: none;
  color: var(--win98-text);
}

.context-menu-item:hover {
  background-color: var(--win98-title-active);
  color: var(--win98-title-text-active);
}

.context-menu-separator {
  height: 1px;
  background-color: var(--win98-button-shadow);
  margin: 2px 8px;
}

/* Prevent context menu from going off-screen */
.win98-context-menu {
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 20px);
  overflow: hidden;
}