/* ===== Reset & bază — temă strict alb-negru ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --taskbar-height: 48px;
  --black: #111111;
  --white: #ffffff;
  --gray-light: #f2f2f2;
  --gray-mid: #d4d4d4;
  --gray-text: #666666;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--black);
  user-select: none;
}

/* ===== Desktop ===== */
.desktop {
  position: relative;
  height: calc(100vh - var(--taskbar-height));
  background: var(--white);
  background-image: radial-gradient(circle, var(--gray-mid) 1px, transparent 1px);
  background-size: 28px 28px;
  overflow: hidden;
}

/* Versiune — colț dreapta sus */
.version {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 11px;
  color: var(--gray-text);
  letter-spacing: 0.5px;
  z-index: 1;
}

/* ===== Iconițe desktop ===== */
.desktop-icons {
  position: absolute;
  top: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 1;
}

.icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 96px;
  padding: 12px 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--black);
}

.icon:hover,
.icon:focus-visible {
  background: var(--gray-light);
  border-color: var(--black);
  outline: none;
}

.icon-img {
  width: 36px;
  height: 36px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-label {
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  word-break: break-word;
}

/* ===== Ferestre ===== */
.window {
  position: absolute;
  min-width: 340px;
  max-width: 92vw;
  background: var(--white);
  border: 2px solid var(--black);
  box-shadow: 6px 6px 0 rgba(17, 17, 17, 0.9);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.window.open {
  display: flex;
  animation: window-open 0.16s ease-out;
}

@keyframes window-open {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Fullscreen */
.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100%;
  max-width: 100vw;
  box-shadow: none;
  border: none;
  border-bottom: 2px solid var(--black);
}

.window.maximized .window-body {
  max-height: none;
  flex: 1;
}

.window.maximized .window-titlebar {
  cursor: default;
}

.window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--black);
  color: var(--white);
  cursor: grab;
  touch-action: none; /* permite drag cu degetul, fără scroll */
}

.window-titlebar:active {
  cursor: grabbing;
}

.window-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.title-icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.window-controls {
  display: flex;
  gap: 6px;
}

.window-controls button {
  width: 26px;
  height: 22px;
  border: 1px solid var(--white);
  border-radius: 0;
  background: var(--black);
  color: var(--white);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.window-controls button:hover {
  background: var(--white);
  color: var(--black);
}

.window-body {
  padding: 22px 24px;
  max-height: 60vh;
  overflow-y: auto;
  user-select: text;
}

.window-body h1 {
  font-size: 22px;
  margin-bottom: 2px;
}

.window-body h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 18px 0 8px;
  border-bottom: 1px solid var(--black);
  padding-bottom: 4px;
}

.window-body p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.subtitle {
  color: var(--gray-text);
  font-size: 13px !important;
  margin-bottom: 14px !important;
}

/* Etichete de competențe / tehnologii */
.skills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.skills li {
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--black);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* Folder cu proiecte */
.folder-view {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.icon-in-folder:hover,
.icon-in-folder:focus-visible {
  background: var(--gray-light);
  border-color: var(--black);
}

.folder-hint {
  color: var(--gray-text);
  font-size: 12px !important;
  margin-top: 12px;
}

/* Link proiect */
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--black);
  color: var(--white);
  text-decoration: none;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid var(--black);
}

.project-link:hover {
  background: var(--white);
  color: var(--black);
}

.link-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Contact */
.contact-list {
  list-style: none;
  font-size: 14px;
  line-height: 2.2;
}

.contact-list a {
  color: var(--black);
  text-decoration: underline;
}

.contact-list a:hover {
  background: var(--black);
  color: var(--white);
  text-decoration: none;
}

/* ===== Taskbar ===== */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--taskbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--black);
  z-index: 1000;
}

.start-button {
  background: var(--white);
  color: var(--black);
  border: none;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.start-button:hover {
  background: var(--gray-mid);
}

.taskbar-windows {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
}

.taskbar-item {
  background: var(--black);
  border: 1px solid var(--white);
  color: var(--white);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.taskbar-item:hover {
  background: #333333;
}

.taskbar-item.active {
  background: var(--white);
  color: var(--black);
}

/* Ceas — colț dreapta jos */
.taskbar-clock {
  color: var(--white);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 0 6px;
  white-space: nowrap;
  text-transform: capitalize;
  /* lățime fixă pentru cel mai lung text posibil (ex. „mercoledì 25 settembre · 14:35"),
     ca elementele din jur să nu se miște când se schimbă limba */
  width: 235px;
  text-align: right;
}

/* ===== Tray — săgeata din colțul dreapta jos ===== */
.tray {
  position: relative;
}

.tray-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--black);
  border: 1px solid var(--white);
  color: var(--white);
  cursor: pointer;
}

.tray-toggle:hover {
  background: var(--white);
  color: var(--black);
}

.tray-toggle .tray-icon {
  transition: transform 0.15s ease;
}

.tray-toggle.open .tray-icon {
  transform: rotate(180deg);
}

.tray-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Meniul care se deschide în sus */
.tray-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  min-width: 190px;
  background: var(--white);
  border: 2px solid var(--black);
  box-shadow: 6px 6px 0 rgba(17, 17, 17, 0.9);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tray-menu[hidden] {
  display: none;
}

.tray-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  background: var(--white);
  border: none;
  color: var(--black);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.tray-item:hover {
  background: var(--black);
  color: var(--white);
}

/* Sub-meniul cu limbi */
.tray-submenu {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--gray-mid);
  border-bottom: 1px solid var(--gray-mid);
  margin: 2px 0;
}

.tray-submenu[hidden] {
  display: none;
}

.tray-submenu button {
  padding: 8px 10px 8px 36px;
  background: var(--white);
  border: none;
  color: var(--black);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.tray-submenu button:hover {
  background: var(--gray-light);
}

.tray-submenu button.active {
  background: var(--black);
  color: var(--white);
}

.tray-submenu button.active::before {
  content: "✓ ";
}

/* ===== Responsive ===== */

/* Ecrane mici: ferestrele ocupă tot ecranul, iconițele trec pe orizontală */
@media (max-width: 768px) {
  .desktop-icons {
    top: 12px;
    left: 12px;
    right: 12px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .icon {
    width: 82px;
    padding: 10px 4px;
  }

  .window {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100%;
    min-width: 0;
    max-width: 100vw;
    border: none;
    border-bottom: 2px solid var(--black);
    box-shadow: none;
  }

  .window-body {
    max-height: none;
    flex: 1;
    padding: 18px 16px;
  }

  /* fereastra e mereu pe tot ecranul — fullscreen și drag nu mai au sens */
  .btn-maximize {
    display: none;
  }

  .window-titlebar {
    cursor: default;
  }

  .taskbar {
    gap: 6px;
    padding: 0 8px;
  }

  .start-button {
    padding: 7px 10px;
  }
}

/* Telefoane: ceasul trece pe format compact (setat și din JS) */
@media (max-width: 600px) {
  .taskbar-clock {
    width: auto;
    font-size: 11px;
    padding: 0 2px;
  }
}
