/* =========================================================
   WINDOW.CSS — style "khung" chung cho MỌI cửa sổ.
   Đây là phần bạn KHÔNG cần đụng vào khi thêm cửa sổ mới.
   ========================================================= */

.pixel-window {
  position: absolute;
  background-color: var(--window-bg);
  border: 2px solid var(--border-color);
  box-shadow: 5px 5px 0px var(--dim-color);
  min-width: 280px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: hidden;
  animation: winOpen 0.12s ease-out;
}

@keyframes winOpen {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.pixel-window.hidden-win { display: none !important; }

/* Thanh gợi ý vuốt (chỉ hiện mobile) */
#swipe-hint { display: none; }

[data-theme="win95"] .pixel-window {
  border-top-color: #ffffff;
  border-left-color: #ffffff;
  border-right-color: #404040;
  border-bottom-color: #404040;
  box-shadow: 2px 2px 0 #000000;
}

.window-header {
  background-color: var(--dim-color);
  color: var(--main-color);
  padding: 8px 12px;
  font-family: var(--font-pixel-title);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  border-bottom: 2px solid var(--border-color);
  flex-shrink: 0;
}
.window-header span.win-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

[data-theme="win95"] .window-header {
  background-color: #000080;
  color: #ffffff;
  border-bottom: none;
}

.window-header .win-btns { display: flex; gap: 4px; flex-shrink: 0; }

.window-btn {
  background: var(--dark-color);
  border: 1px solid var(--main-color);
  color: var(--main-color);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-family: var(--font-pixel-title);
  cursor: pointer;
}
.window-btn:hover { background: var(--main-color); color: var(--bg-color); }

[data-theme="win95"] .window-btn {
  background: #d4d0c8; color: #000;
  border-top-color: #fff; border-left-color: #fff;
  border-right-color: #000; border-bottom-color: #000;
}

.window-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  min-height: 0;
}

.pixel-btn {
  border: 2px solid var(--border-color);
  background: var(--dark-color);
  color: var(--main-color);
  font-family: var(--font-pixel-body);
  cursor: pointer;
  transition: background 0.08s ease, color 0.08s ease;
}
.pixel-btn:hover { background: var(--main-color); color: var(--bg-color); }

[data-theme="win95"] .pixel-btn {
  background: #d4d0c8; color: #000;
  border-top-color: #fff; border-left-color: #fff;
  border-right-color: #000; border-bottom-color: #000;
}

/* Mobile App Switcher (≤768px): 1 cửa sổ fullscreen, taskbar thành dock */
@media (max-width: 768px) {
  #desktop {
    position: relative;
    width: 100%;
    height: calc(100vh - 150px);
    height: calc(100dvh - 150px);
    min-height: 320px;
    padding: 6px;
    overflow: hidden;
  }
  .pixel-window {
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0; bottom: 0;
    width: 100% !important; height: 100% !important;
    margin: 0 !important;
    resize: none !important;
    box-shadow: none;
    display: none;
    flex-direction: column;
    z-index: 1;
  }
  .pixel-window.mobile-active {
    display: flex !important;
    z-index: 10 !important;
  }
  .window-header { cursor: default; }
  /* Ẩn minimize trên mobile (đã fullscreen), X = về Profile */
  .pixel-window .window-btn[data-action="minimize"] { display: none !important; }

  #taskbar {
    display: flex !important;
    align-items: center;
    gap: 6px !important;
    padding: 6px 8px !important;
    justify-content: flex-start !important;
  }
  #taskbar .start-btn, #clock { flex-shrink: 0; }
  #taskbar-items {
    display: flex !important;
    gap: 6px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
    padding: 2px;
  }
  #taskbar-items::-webkit-scrollbar { display: none; }
  #taskbar-items .taskbar-btn {
    flex: 0 0 auto;
    font-size: 11px;
    padding: 6px 10px;
    max-width: none;
  }

  /* Thanh gợi ý vuốt + số trang + nút chuyển */
  #swipe-hint {
    display: flex !important;
    position: absolute;
    left: 50%; bottom: 8px;
    transform: translateX(-50%);
    z-index: 30;
    align-items: center;
    gap: 4px;
    background: var(--window-bg);
    border: 1px solid var(--border-color);
    box-shadow: 3px 3px 0 var(--dim-color);
    padding: 2px 4px;
    font-size: 12px;
    font-family: var(--font-mono-readable);
    animation: hintPulse 2s infinite;
  }
  @keyframes hintPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
  }
  #swipe-hint button {
    background: none;
    border: none;
    color: var(--main-color);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 10px;
  }
  #swipe-hint span { min-width: 44px; text-align: center; }
}
