/* ============================================
   WINDOWS 98 FLOATING WINDOWS
   ============================================ */

.win98-window {
  position: fixed;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #dfdfdf #808080 #808080 #dfdfdf;
  box-shadow: 
    2px 2px 0 rgba(0, 0, 0, 0.5),
    inset 1px 1px 0 #ffffff;
  cursor: default;
  user-select: none;
  animation: windowSpawn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transition: transform 0.1s ease-out;
}

@keyframes windowSpawn {
  0% {
    transform: scale(0) rotate(180deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes windowClose {
  0% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
}

.win98-window.dragging {
  cursor: grabbing !important;
  opacity: 0.9;
}

.win98-window.minimized {
  transform: scale(0.1) !important;
  opacity: 0;
  pointer-events: none;
}

.win98-window.maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  transform: none !important;
}

/* Title Bar */
.win98-titlebar {
  background: linear-gradient(180deg, #000080 0%, #1084d0 100%);
  padding: 3px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  user-select: none;
  border-bottom: 2px solid;
  border-color: #808080;
}

.win98-window.dragging .win98-titlebar {
  cursor: grabbing;
}

.win98-titlebar-text {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  font-family: 'MS Sans Serif', 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.win98-icon {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
}

/* Window Buttons */
.win98-buttons {
  display: flex;
  gap: 2px;
}

.win98-btn {
  width: 18px;
  height: 18px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-family: 'MS Sans Serif', system-ui, sans-serif;
  font-size: 10px;
  font-weight: bold;
  position: relative;
}

.win98-btn:hover {
  background: #d4d4d4;
}

.win98-btn:active {
  border-color: #808080 #ffffff #ffffff #808080;
  background: #a0a0a0;
}

.btn-icon {
  pointer-events: none;
  line-height: 1;
  display: block;
  color: #000000;
}

.win98-minimize .btn-icon {
  position: relative;
  top: 2px;
}

.win98-maximize .btn-icon {
  font-size: 12px;
}

.win98-close {
  background: #c0c0c0;
}

.win98-close:hover {
  background: #e81123;
  color: #ffffff;
}

.win98-close:hover .btn-icon {
  color: #ffffff;
}

/* Window Content */
.win98-content {
  background: #ffffff;
  padding: 0;
  border: 2px solid;
  border-color: #808080 #dfdfdf #dfdfdf #808080;
  overflow: hidden;
  position: relative;
}

.win98-image {
  width: 100%;
  height: auto;
  display: block;
  /* 90s crunchy look */
  image-rendering: pixelated;
  filter: 
    contrast(1.3) 
    saturate(0.8) 
    brightness(0.95) 
    sepia(0.1)
    blur(0.3px);
  transition: filter 0.3s ease;
}

.win98-window:hover .win98-image {
  filter: 
    contrast(1.4) 
    saturate(0.9) 
    brightness(0.95) 
    sepia(0.1)
    blur(0.3px)
    hue-rotate(5deg);
}

/* Add glitch effect on hover */
.win98-window:hover .win98-image {
  animation: imageGlitch 0.3s ease;
}

@keyframes imageGlitch {
  0%, 100% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(2px, -2px);
  }
  60% {
    transform: translate(-2px, -2px);
  }
  80% {
    transform: translate(2px, 2px);
  }
}

/* Scrollbar for Windows 98 aesthetic */
.win98-content::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

.win98-content::-webkit-scrollbar-track {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
}

.win98-content::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
}

.win98-content::-webkit-scrollbar-thumb:hover {
  background: #d4d4d4;
}

.win98-content::-webkit-scrollbar-button {
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  height: 16px;
  width: 16px;
}

.win98-content::-webkit-scrollbar-button:hover {
  background: #d4d4d4;
}

/* Mobile - disable floating windows */
@media (max-width: 768px) {
  .win98-window {
    display: none !important;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .win98-window {
    animation: none !important;
  }
  
  .win98-image {
    animation: none !important;
  }
}

/* Higher z-index for windows */
.win98-window {
  z-index: 1000;
}

/* Add some chaos - random rotations */
.win98-window:nth-child(3n) {
  transform: rotate(-2deg);
}

.win98-window:nth-child(3n+1) {
  transform: rotate(1deg);
}

.win98-window:nth-child(3n+2) {
  transform: rotate(-1deg);
}
