/* ============================================================
   STANZA 100 — Windows XP Desktop Faithful Skin
   Bliss wallpaper · Taskbar · Desktop icons · XP windows
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tahoma&display=swap');

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Tahoma, 'MS Sans Serif', Arial, sans-serif;
  font-size: 11px;
  color: #000;
}

body {
  overflow-x: hidden;
  padding-bottom: 30px; /* spazio taskbar */
}

/* ══════════════════════════════════════════════
   BLISS WALLPAPER — CSS puro fedele all'originale
   ══════════════════════════════════════════════ */
.xp-wallpaper {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    /* Bagliore solare in alto a sinistra */
    radial-gradient(ellipse 55% 38% at 26% 0%,
      rgba(255,255,255,.72) 0%,
      rgba(190,230,255,.28) 35%,
      transparent 65%),
    /* Nuvola principale destra */
    radial-gradient(ellipse 36% 22% at 74% 16%,
      rgba(255,255,255,.60) 0%,
      rgba(255,255,255,.20) 50%,
      transparent 70%),
    /* Nuvola piccola sinistra */
    radial-gradient(ellipse 22% 14% at 18% 28%,
      rgba(255,255,255,.38) 0%,
      transparent 60%),
    /* Nuvola centro */
    radial-gradient(ellipse 18% 10% at 52% 24%,
      rgba(255,255,255,.32) 0%,
      transparent 55%),
    /* Gradiente cielo→erba */
    linear-gradient(180deg,
      #3a92d5  0%,
      #4baee8 18%,
      #68c8f5 36%,
      #7ed2f8 43%,
      #88d8fa 45%,   /* orizzonte */
      #60c240 46%,   /* cima colline */
      #50b832 54%,
      #3ea028 65%,
      #2d8a1c 80%,
      #1c7010 100%
    );
}

/* Sagoma colline Bliss — curva morbida centrale */
.xp-wallpaper::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 130% 32% at 50% 48%,
      rgba(100,210,60,.50) 0%,
      rgba(80,185,45,.20) 55%,
      transparent 75%),
    radial-gradient(ellipse 60% 20% at 50% 52%,
      rgba(180,255,120,.30) 0%,
      transparent 65%);
}

/* Ombra profondità erba in basso */
.xp-wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    transparent 55%,
    rgba(0,40,0,.22) 100%);
}

/* Scanlines */
.crt-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,.022) 0,
    rgba(0,0,0,.022) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* ══════════════════════════════════════════════
   TASKBAR WINDOWS XP
   ══════════════════════════════════════════════ */
#xp-taskbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 30px;
  z-index: 9999;
  display: flex;
  align-items: stretch;
  background: linear-gradient(180deg,
    #2c8ef0  0%,
    #1c72d8 44%,
    #1460c0 45%,
    #1c72d8 100%
  );
  box-shadow: 0 -1px 0 #0a3a88, 0 -2px 0 rgba(255,255,255,.1);
  user-select: none;
}
#xp-taskbar::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, #4aa0ff 0%, #88ccff 50%, #4aa0ff 100%);
}

/* Pulsante START */
#xp-start {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 0 8px;
  background: linear-gradient(180deg,
    #62c230  0%,
    #42a818 46%,
    #389010 47%,
    #42a818 100%
  );
  border-radius: 0 14px 14px 0;
  border: none;
  border-right: 1px solid rgba(0,60,0,.3);
  color: #fff;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 13px;
  font-weight: bold;
  font-style: italic;
  cursor: pointer;
  height: 100%;
  box-shadow: inset 0 1px rgba(255,255,255,.3), 2px 0 6px rgba(0,0,0,.35);
  text-shadow: 0 1px 2px rgba(0,60,0,.7);
  letter-spacing: .4px;
  flex-shrink: 0;
}
#xp-start:hover {
  background: linear-gradient(180deg,
    #72d840  0%,
    #52b828 46%,
    #44a018 47%,
    #52b828 100%
  );
}
.start-orb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 33% 28%, #ffffff 0%, #66ee44 40%, #009900 80%);
  border: 1px solid rgba(0,60,0,.45);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

/* Finestre aperte in taskbar */
#xp-taskbar-windows {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 6px;
  gap: 4px;
  overflow: hidden;
}
.taskbar-btn {
  height: 22px;
  padding: 0 10px;
  background: linear-gradient(180deg, #4090e8, #1c68cc);
  border: 1px solid #0a48aa;
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  font-family: Tahoma, Arial, sans-serif;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  box-shadow: inset 0 1px rgba(255,255,255,.2);
}

/* System tray */
#xp-tray {
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  background: linear-gradient(180deg, #0e62cc, #0848a8);
  border-left: 1px solid #083888;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}
#xp-clock {
  font-size: 11px;
  color: #fff;
  text-align: center;
  cursor: default;
  min-width: 44px;
  line-height: 1.3;
}
.tray-icon { font-size: 13px; cursor: default; opacity: .9; }

/* ══════════════════════════════════════════════
   ICONE DESKTOP XP
   ══════════════════════════════════════════════ */
#xp-desktop-icons {
  position: fixed;
  top: 10px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
  pointer-events: none;
}
.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 68px;
}
.icon-img {
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  font-size: 26px;
  filter: drop-shadow(1px 2px 4px rgba(0,0,0,.55));
  line-height: 1;
}
.desktop-icon span {
  font-size: 11px;
  color: #fff;
  text-shadow:
    1px 1px 2px rgba(0,0,0,.95),
    -1px -1px 2px rgba(0,0,0,.8),
    0 0 6px rgba(0,0,0,.6);
  text-align: center;
  line-height: 1.25;
  padding: 1px 2px;
  max-width: 68px;
  word-break: break-word;
}

/* ══════════════════════════════════════════════
   FINESTRE XP
   ══════════════════════════════════════════════ */
.window, .msn-login-card {
  border: 1px solid #0050d0;
  border-radius: 8px 8px 3px 3px;
  background: #ece9d8;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.55) inset,
    0 12px 45px rgba(0,0,0,.65);
  overflow: hidden;
}

/* ══════════════════════════════════════════════
   TITLEBAR XP
   ══════════════════════════════════════════════ */
.xp-titlebar {
  height: 30px;
  background: linear-gradient(180deg,
    #58a0f2  0%,
    #3282e2  8%,
    #1262d2 48%,
    #0a4aba 50%,
    #1262d2 80%,
    #1c72de 100%
  );
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 8px;
  font-weight: bold;
  font-size: 12px;
  text-shadow: 1px 1px 2px rgba(0,0,0,.7);
  user-select: none;
  position: relative;
}
.xp-titlebar::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: rgba(255,255,255,.55);
  pointer-events: none;
}

.xp-controls { display: flex; gap: 2px; }
.xp-controls b {
  width: 21px; height: 21px;
  display: grid; place-items: center;
  border-radius: 4px;
  background: linear-gradient(180deg, #72bcf8, #2282e2 50%, #1668ca);
  border: 1px solid rgba(0,0,0,.35);
  font-size: 10px; font-weight: bold;
  color: #fff; cursor: pointer;
  text-shadow: none;
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset;
}
.xp-controls b:last-child {
  background: linear-gradient(180deg, #e87878, #c83838 50%, #a82020);
  border-color: rgba(80,0,0,.4);
}
.xp-controls b:hover { filter: brightness(1.18); }

/* ══════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════ */
.gate {
  min-height: calc(100vh - 30px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.msn-login-card { width: min(420px, 100%); background: #ece9d8; }
.login-content { padding: 20px 24px 24px; }
.butterfly { font-size: 16px; margin-right: 5px; }
.msn-logo { text-align: center; margin-bottom: 14px; }

.orb {
  width: 72px; height: 72px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #fff 0%, #55d466 35%, #009e2e 80%);
  display: grid; place-items: center;
  box-shadow: 0 2px 12px rgba(0,150,60,.5);
  border: 2px solid #007f25;
}

h1 { font-size: 24px; margin: 0 0 4px; color: #003399; font-weight: bold; letter-spacing: -.5px; }
.msn-logo p { color: #444; font-size: 11px; line-height: 1.4; margin: 0; }

.meter {
  height: 18px; border: 1px solid #999; background: #fff;
  border-radius: 2px; position: relative; overflow: hidden;
  margin: 14px 0; box-shadow: inset 1px 1px 2px rgba(0,0,0,.2);
}
.meter span {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center;
  font-size: 10px; font-weight: bold; color: #000;
}
.meter i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #3db84c, #66dd6a);
  display: block;
}

.tabs { display: flex; margin: 14px 0 0; border-bottom: 1px solid #999; }
.tab {
  flex: 1; padding: 6px 10px;
  border: 1px solid #999; border-bottom: none;
  background: #d4d0c8; cursor: pointer;
  font-weight: bold; font-size: 11px; color: #000;
  border-radius: 4px 4px 0 0; margin-right: 2px;
}
.tab.active { background: #ece9d8; border-bottom: 1px solid #ece9d8; margin-bottom: -1px; }
.tab:hover:not(.active) { background: #e0ddd4; }

.auth-form { display: none; flex-direction: column; gap: 6px; padding-top: 14px; }
.auth-form.active { display: flex; }

label { font-size: 11px; font-weight: bold; color: #000; margin-top: 4px; }

input, textarea, select {
  font-family: Tahoma, Arial, sans-serif; font-size: 11px;
  border: 1px solid #999; border-radius: 0; padding: 4px 6px;
  background: #fff; outline: none;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,.15);
}
input:focus, textarea:focus, select:focus { border-color: #0a5fcc; }

button {
  font-family: Tahoma, Arial, sans-serif; font-size: 11px;
  border: 1px solid #888; border-radius: 3px;
  background: linear-gradient(180deg, #f3f2ef, #dbd9ce);
  color: #000; padding: 5px 14px; cursor: pointer;
  box-shadow: 1px 1px 0 rgba(255,255,255,.8) inset, -1px -1px 0 rgba(0,0,0,.2) inset;
  text-shadow: none;
}
button:hover { background: linear-gradient(180deg, #e8f4ff, #c5dff7); border-color: #0066cc; }
button:active { background: linear-gradient(180deg, #c5dff7, #e8f4ff); }

.auth-form button[type="submit"], button#sendBtn {
  background: linear-gradient(180deg, #4da6ff, #0066cc 50%, #0050a8);
  color: #fff; border: 1px solid #004898;
  font-weight: bold; text-shadow: 0 1px rgba(0,0,0,.4);
}
.auth-form button[type="submit"]:hover, button#sendBtn:hover {
  background: linear-gradient(180deg, #6ab7ff, #1a7fe0 50%, #0060b8);
}

.note { font-size: 11px; line-height: 1.5; color: #555; text-align: center; margin-top: 14px; }
#authMsg { font-size: 11px; text-align: center; color: #c00; font-weight: bold; margin-top: 8px; min-height: 16px; }
.full-box {
  background: #fffbe6; border: 1px solid #c8a800; border-radius: 2px;
  padding: 10px 14px; margin: 14px 0; color: #5a4000; font-size: 11px;
}

/* ══════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════ */
.desktop {
  min-height: calc(100vh - 30px);
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 8px; padding: 8px;
  align-items: stretch;
}

.contact-list {
  height: calc(100vh - 46px);
  display: flex; flex-direction: column;
  background: #fff;
}

.profile {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 10px 8px;
  background: linear-gradient(180deg, #daeeff, #b8dcf5);
  border-bottom: 1px solid #a0c4e4;
}

.avatar {
  width: 40px; height: 40px; border-radius: 3px;
  border: 1px solid #888; box-shadow: 1px 1px 3px rgba(0,0,0,.3);
  background: linear-gradient(135deg, #51e76c, #009f35); flex-shrink: 0;
}
.avatar-2 { background: linear-gradient(135deg, #78b7ff, #0744b9); }
.avatar-3 { background: linear-gradient(135deg, #ffcc55, #ff6b00); }
.avatar-4 { background: linear-gradient(135deg, #ff7bd5, #8434ff); }
.avatar-5 { background: linear-gradient(135deg, #7cf7ff, #007d9b); }
.avatar-6 { background: linear-gradient(135deg, #e4ff73, #5cb800); }
.avatar-7 { background: linear-gradient(135deg, #ff8282, #a10000); }
.avatar-8 { background: linear-gradient(135deg, #fff,    #7e98b8); }

.profile strong { display: block; color: #003399; font-size: 12px; font-weight: bold; }
.profile small  { display: block; color: #555; font-size: 10px; margin-top: 2px; }

.status-edit {
  padding: 6px 8px; display: grid; gap: 5px;
  border-bottom: 1px solid #c0d9ee; background: #eaf4fb;
}
.status-edit select { font-size: 11px; padding: 3px 4px; }
.status-edit input  { font-size: 11px; padding: 3px 6px; }
.status-edit button { font-size: 10px; padding: 3px 8px; justify-self: end; }

.contact-list h3 {
  font-size: 11px; font-weight: bold; color: #003399;
  margin: 8px 8px 4px;
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 3px; border-bottom: 1px solid #b0c8e4;
}

.rooms { padding: 0 6px; display: grid; gap: 3px; }
.room {
  background: linear-gradient(180deg, #f3f2ef, #e4e2d8);
  border: 1px solid #aaa; color: #000; text-shadow: none;
  text-align: left; padding: 5px 8px; font-size: 11px;
  border-radius: 2px; display: flex; gap: 6px; align-items: center;
}
.room:hover { background: linear-gradient(180deg, #e8f4ff, #c8dff5); border-color: #0066cc; }
.room.active {
  background: linear-gradient(180deg, #d0e8ff, #a0ccf0);
  border-color: #0066cc; color: #003399; font-weight: bold;
}

.online-list { padding: 0 6px 6px; overflow-y: auto; flex: 1; }
.online-user {
  display: flex; gap: 8px; align-items: center;
  padding: 5px 6px; margin-bottom: 2px;
  border-bottom: 1px dotted #d0d8e8; font-size: 11px;
}
.online-user:hover { background: #e8f4ff; }

.dot { width: 10px; height: 10px; border-radius: 50%; background: #00aa00; box-shadow: 0 0 3px #00aa00; flex-shrink: 0; }
.dot.away { background: #ffc700; box-shadow: 0 0 3px #ffc700; }
.dot.busy { background: #dd0000; box-shadow: 0 0 3px #dd0000; }

.logout {
  display: block; margin: 6px 8px 8px; padding: 5px;
  text-align: center;
  background: linear-gradient(180deg, #f3f2ef, #dbd9ce);
  border: 1px solid #999; border-radius: 3px;
  color: #000; text-decoration: none; font-size: 11px; font-weight: bold;
}
.logout:hover { background: linear-gradient(180deg, #e8f4ff, #c5dff7); border-color: #0066cc; color: #003399; }

.chat-window {
  height: calc(100vh - 46px);
  display: flex; flex-direction: column; background: #fff;
}
.chatbar { font-size: 12px; }

.chat-notice {
  padding: 5px 10px; background: #fffbe0;
  border-bottom: 1px solid #d4c060; color: #554000; font-size: 11px;
}

.messages {
  flex: 1; overflow-y: auto; padding: 10px 14px; background: #fff;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="160" height="160"><text x="24" y="100" font-size="80" opacity=".04">🦋</text></svg>');
  background-repeat: no-repeat; background-position: center; background-size: 180px;
}

.msg {
  max-width: 80%; margin: 0 0 8px; padding: 6px 10px;
  font-size: 11px; line-height: 1.45; border-radius: 2px;
  background: #e8f4fb; border: 1px solid #b0cfea; word-break: break-word;
}
.msg.mine { margin-left: auto; background: #d9eeff; border-color: #80b8e8; }
.msg .meta { font-weight: bold; color: #003399; margin-bottom: 2px; font-size: 11px; }
.msg .time { font-weight: normal; color: #888; margin-left: 6px; font-size: 10px; }
.msg.system {
  max-width: 100%; margin: 4px auto; text-align: center;
  background: #fffbe0; color: #6b5500; border-color: #d4c060;
  font-style: italic; font-size: 10px; border-radius: 0;
}
.msg.buzz {
  animation: buzz .2s linear 0s 5;
  background: #fff0e0; border-color: #ff9900; color: #883300; font-weight: bold;
}
@keyframes buzz {
  0%   { transform: translateX(0);   }
  25%  { transform: translateX(5px); }
  75%  { transform: translateX(-5px);}
  100% { transform: translateX(0);   }
}

.typing-row {
  padding: 4px 10px; background: #f0f8ff;
  border-top: 1px solid #c0d8ec; color: #558; font-size: 10px; font-style: italic;
}

.send-area {
  display: grid; grid-template-columns: 1fr 100px;
  gap: 6px; padding: 8px 10px; background: #ece9d8; border-top: 1px solid #aaa;
}
textarea {
  height: 58px; resize: none; font-size: 11px; border-radius: 0;
  border: 1px solid #999; padding: 5px 7px; background: #fff;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,.15);
}
.send-buttons { display: grid; gap: 5px; }

.buzz {
  background: linear-gradient(180deg, #ffde60, #ffaa00 50%, #e07800);
  border: 1px solid #b06000; color: #4a2000; font-weight: bold; text-shadow: none;
}
.buzz:hover {
  background: linear-gradient(180deg, #ffe880, #ffbb22 50%, #f08800);
  border-color: #d07000;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 820px) {
  .desktop { grid-template-columns: 1fr; padding: 4px; gap: 4px; }
  .contact-list { height: auto; max-height: 40vh; }
  .chat-window { height: 55vh; }
  .send-area { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
  #xp-desktop-icons { display: none; }
}
