/* Nettprat 5.0. Et flytende lynmeldingsvindu i stil med tidlig totusentall.
   Navnet er oppdiktet og programmet har ingenting med noe ekte tjeneste å
   gjøre. All grafikk er laget i CSS, ingen bilder og ingen nettverkskall.
   Alle regler er prefikset med id-ene #np-win og #np-launch slik at temaene
   i resten av appen ikke klarer å overstyre dem. */

:root {
  --np-blue-1: #9dc3f0;
  --np-blue-2: #4a82c8;
  --np-blue-3: #1a4f96;
  --np-silver-1: #f4f4ee;
  --np-silver-2: #dcd9cf;
  --np-silver-3: #b4b0a4;
  --np-ink: #1d1d1b;
}

/* ---------- selve vinduet ---------- */

#np-win {
  position: fixed;
  z-index: 2147483200;
  width: 372px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  font: 11px/1.45 Tahoma, "MS Sans Serif", Verdana, Geneva, sans-serif;
  color: var(--np-ink);
  background: linear-gradient(180deg, var(--np-silver-1), var(--np-silver-2));
  border: 1px solid #5c7ea8;
  border-radius: 7px 7px 4px 4px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .75) inset,
    0 10px 30px rgba(0, 0, 0, .45);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}
#np-win[hidden] { display: none; }
#np-win * { box-sizing: border-box; }

/* Vinduet er sammenrullet når du trykker minimer. Da står bare tittellinja igjen. */
#np-win.np-rolled > :not(.np-title) { display: none; }
#np-win.np-rolled { width: 372px; }

/* Lite rist når noen sender en dult. */
@keyframes np-nudge {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-6px, 3px); }
  30% { transform: translate(5px, -4px); }
  45% { transform: translate(-4px, -3px); }
  60% { transform: translate(4px, 4px); }
  80% { transform: translate(-2px, 1px); }
}
#np-win.np-nudging { animation: np-nudge .5s ease-in-out 1; }

/* ---------- tittellinje ---------- */

#np-win .np-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 6px;
  cursor: move;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .55);
  font-weight: 700;
  background: linear-gradient(180deg, #7fb0e8 0%, #3f7ec4 46%, #2a63aa 54%, #17457f 100%);
  border-bottom: 1px solid #14396b;
}
#np-win .np-title-ico {
  position: relative;
  width: 16px;
  height: 13px;
  flex: none;
  border-radius: 3px 3px 3px 0;
  background: linear-gradient(180deg, #fffbe2, #ffd85e);
  border: 1px solid #a37b12;
}
#np-win .np-title-ico::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 8px;
  height: 1px;
  background: #a37b12;
  box-shadow: 0 3px 0 #a37b12;
}
#np-win .np-title-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
  letter-spacing: .01em;
}
#np-win .np-title-btns { display: flex; gap: 2px; flex: none; }

#np-win .np-tbtn {
  all: unset;
  width: 17px;
  height: 15px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid #1d4a84;
  background: linear-gradient(180deg, #cfe2f8, #8ab2e0 52%, #6d9ad0);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset;
}
#np-win .np-tbtn:hover { background: linear-gradient(180deg, #eaf3ff, #a9c9ef 52%, #87b0dd); }
#np-win .np-tbtn:active { background: linear-gradient(180deg, #6d9ad0, #8ab2e0); }
#np-win .np-tbtn.np-close {
  border-color: #8d2318;
  background: linear-gradient(180deg, #f5b7ac, #d9604c 52%, #bc3d2b);
}
#np-win .np-tbtn.np-close:hover { background: linear-gradient(180deg, #ffd6cd, #e77864 52%, #c9503c); }
#np-win .np-tbtn i {
  display: block;
  position: relative;
  width: 7px;
  height: 7px;
}
#np-win .np-tbtn.np-min i::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 1px;
  width: 7px;
  height: 2px;
  background: #10294b;
}
#np-win .np-tbtn.np-close i::before,
#np-win .np-tbtn.np-close i::after {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 8px;
  height: 2px;
  background: #fff;
}
#np-win .np-tbtn.np-close i::before { transform: rotate(45deg); }
#np-win .np-tbtn.np-close i::after { transform: rotate(-45deg); }

/* ---------- menylinje ---------- */

#np-win .np-menu {
  display: flex;
  gap: 1px;
  padding: 2px 3px;
  background: linear-gradient(180deg, #fbfbf7, #e7e4da);
  border-bottom: 1px solid var(--np-silver-3);
}
#np-win .np-menu button {
  all: unset;
  padding: 2px 7px;
  cursor: default;
  border-radius: 2px;
  font-size: 11px;
  color: #1d1d1b;
}
#np-win .np-menu button:hover,
#np-win .np-menu button.np-open { background: #2a63aa; color: #fff; }

#np-win .np-drop {
  position: absolute;
  min-width: 158px;
  padding: 2px;
  background: #fbfbf7;
  border: 1px solid #8f8b7f;
  box-shadow: 2px 3px 7px rgba(0, 0, 0, .35);
  z-index: 4;
}
#np-win .np-drop[hidden] { display: none; }
#np-win .np-drop button {
  all: unset;
  display: block;
  width: 100%;
  padding: 3px 9px;
  cursor: default;
  font-size: 11px;
  color: #1d1d1b;
}
#np-win .np-drop button:hover { background: #2a63aa; color: #fff; }

/* ---------- egen visningsnavn og status ---------- */

#np-win .np-me {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  background: linear-gradient(180deg, #ffffff, #e9eef6);
  border-bottom: 1px solid var(--np-silver-3);
}
#np-win .np-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 3px;
  border: 1px solid #7e93ad;
  background: linear-gradient(160deg, #cfe0f5, #7ba3d4 60%, #4d7cb4);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset;
  overflow: hidden;
}
#np-win .np-avatar::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fbe3c6;
  border: 1px solid #8a6a4a;
}
#np-win .np-avatar::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 18px;
  width: 21px;
  height: 14px;
  border-radius: 9px 9px 0 0;
  background: #e0294a;
  border: 1px solid #8e2150;
  border-bottom: 0;
}
#np-win .np-me-col { flex: 1 1 auto; min-width: 0; }
#np-win .np-me-name {
  font-weight: 700;
  font-size: 11.5px;
  color: #123a68;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#np-win .np-me-mail { font-size: 10px; color: #5d5a51; }
#np-win select#np-status {
  margin-top: 2px;
  max-width: 100%;
  font: 11px Tahoma, "MS Sans Serif", Verdana, sans-serif;
  color: #1d1d1b;
  background: #fff;
  border: 1px solid #8f8b7f;
  border-radius: 2px;
  padding: 1px 2px;
}

/* ---------- midtpartiet, samtale og kontakter ---------- */

#np-win .np-body { display: flex; min-height: 0; }
#np-win .np-conv {
  flex: 1 1 auto;
  min-width: 0;
  height: 208px;
  overflow-y: auto;
  padding: 5px 6px;
  background: #fff;
  border: 1px solid #8f8b7f;
  border-radius: 2px;
  margin: 6px 4px 4px 6px;
  -webkit-user-select: text;
  user-select: text;
  line-height: 1.5;
}
#np-win .np-line { margin: 0 0 3px; word-wrap: break-word; overflow-wrap: anywhere; }
#np-win .np-line .np-who { font-weight: 700; }
#np-win .np-line.np-me-line .np-who { color: #1a4f96; }
#np-win .np-line.np-them .np-who { color: #a3252f; }
#np-win .np-line.np-sys { color: #6b6860; font-style: italic; }
#np-win .np-line .np-txt { color: #1d1d1b; }

#np-win .np-contacts {
  flex: none;
  width: 112px;
  margin: 6px 6px 4px 2px;
  padding: 3px;
  overflow-y: auto;
  height: 208px;
  background: #fff;
  border: 1px solid #8f8b7f;
  border-radius: 2px;
}
#np-win .np-ctitle {
  font-weight: 700;
  font-size: 10px;
  color: #4a4740;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 1px 0 3px 2px;
}
#np-win .np-contact {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 3px;
  border-radius: 2px;
  cursor: default;
  font-size: 11px;
  color: #1d1d1b;
}
#np-win .np-contact:hover { background: #dbe8f8; }
#np-win .np-contact.np-off { color: #97948c; }
#np-win .np-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, .45);
  background: #57b04a;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset;
}
#np-win .np-dot.np-away { background: #e8b73a; }
#np-win .np-dot.np-busy { background: #cf4130; }
#np-win .np-dot.np-gone { background: #b6b3aa; }
#np-win .np-cname { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- statuslinje med «skriver» ---------- */

#np-win .np-typing {
  min-height: 15px;
  padding: 0 8px 3px;
  font-size: 10.5px;
  color: #4a4740;
  font-style: italic;
}
#np-win .np-typing .np-dots::after {
  content: "";
  animation: np-dots 1.1s steps(4, end) infinite;
}
@keyframes np-dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

/* ---------- formatlinje med smilefjes ---------- */

#np-win .np-fmt {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  background: linear-gradient(180deg, #fbfbf7, #e7e4da);
  border-top: 1px solid var(--np-silver-3);
  border-bottom: 1px solid var(--np-silver-3);
}
#np-win .np-fbtn {
  all: unset;
  width: 21px;
  height: 19px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 2px;
}
#np-win .np-fbtn:hover { border-color: #7d9dc4; background: #dbe8f8; }
#np-win .np-fbtn.np-txtbtn { font-weight: 700; font-size: 11px; color: #1d1d1b; }
#np-win .np-fbtn.np-txtbtn.np-i { font-style: italic; font-family: Georgia, serif; }
#np-win .np-fsep {
  width: 1px;
  height: 15px;
  margin: 0 2px;
  background: var(--np-silver-3);
  box-shadow: 1px 0 0 #fff;
}

/* ---------- smilefjes tegnet i CSS ---------- */

#np-win .np-emo {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -3px;
  margin: 0 1px;
  border-radius: 50%;
  border: 1px solid #9a7200;
  background: radial-gradient(circle at 34% 28%, #fff7b0, #ffd21e 58%, #eaa900);
}
#np-win .np-emo i {
  position: absolute;
  background: #4a3600;
}
#np-win .np-emo .np-e1,
#np-win .np-emo .np-e2 {
  top: 4px;
  width: 2px;
  height: 3px;
  border-radius: 1px;
}
#np-win .np-emo .np-e1 { left: 3px; }
#np-win .np-emo .np-e2 { right: 3px; }
#np-win .np-emo .np-m {
  left: 3px;
  top: 7px;
  width: 6px;
  height: 4px;
  background: none;
  border-bottom: 1.5px solid #4a3600;
  border-radius: 0 0 7px 7px;
}
#np-win .np-emo.np-sad .np-m {
  top: 9px;
  border-bottom: 0;
  border-top: 1.5px solid #4a3600;
  border-radius: 7px 7px 0 0;
}
#np-win .np-emo.np-wink .np-e2 {
  top: 6px;
  width: 4px;
  height: 1.5px;
  right: 2px;
  border-radius: 1px;
}
#np-win .np-emo.np-tongue .np-m {
  border-bottom-width: 1.5px;
  width: 7px;
}
#np-win .np-emo.np-tongue .np-t {
  left: 5px;
  top: 9px;
  width: 4px;
  height: 3px;
  background: #e0506c;
  border-radius: 0 0 3px 3px;
}
#np-win .np-emo.np-cool .np-e1 {
  left: 1px;
  top: 4px;
  width: 10px;
  height: 3px;
  border-radius: 1px;
  background: #241a00;
}
#np-win .np-emo.np-cool .np-e2 { display: none; }
#np-win .np-emo.np-cool .np-m { top: 8px; }
#np-win .np-heart {
  position: relative;
  display: inline-block;
  width: 13px;
  height: 12px;
  margin: 0 1px;
  vertical-align: -2px;
}
#np-win .np-heart i {
  position: absolute;
  top: 1px;
  width: 7px;
  height: 10px;
  border-radius: 7px 7px 0 0;
  background: #e0294a;
}
#np-win .np-heart .np-h1 { left: 6px; transform: rotate(-45deg); transform-origin: 0 100%; }
#np-win .np-heart .np-h2 { left: 0; transform: rotate(45deg); transform-origin: 100% 100%; }

/* ---------- skrivefelt og sendeknapp ---------- */

#np-win .np-send-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
  padding: 6px;
}
#np-win textarea#np-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  resize: none;
  padding: 4px 5px;
  font: 11.5px/1.4 Tahoma, "MS Sans Serif", Verdana, sans-serif;
  color: #1d1d1b;
  background: #fff;
  border: 1px solid #8f8b7f;
  border-radius: 2px;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .08) inset;
  -webkit-user-select: text;
  user-select: text;
}
#np-win textarea#np-input:focus { outline: 1px dotted #2a63aa; outline-offset: -3px; }
#np-win button#np-send {
  all: unset;
  flex: none;
  width: 62px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font: 700 11px Tahoma, "MS Sans Serif", Verdana, sans-serif;
  color: #14304f;
  border: 1px solid #5f7fa5;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff, #dfe7f2 48%, #c3d2e6);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset;
}
#np-win button#np-send:hover { background: linear-gradient(180deg, #ffffff, #eaf1fb 48%, #d3dff0); }
#np-win button#np-send:active { background: linear-gradient(180deg, #c3d2e6, #dfe7f2); }

/* Rullefelt i tidsriktig grå. */
#np-win .np-conv::-webkit-scrollbar,
#np-win .np-contacts::-webkit-scrollbar { width: 14px; }
#np-win .np-conv::-webkit-scrollbar-track,
#np-win .np-contacts::-webkit-scrollbar-track { background: #efeee8; }
#np-win .np-conv::-webkit-scrollbar-thumb,
#np-win .np-contacts::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #f6f6f2, #d0ccc0);
  border: 1px solid #8f8b7f;
}

/* ---------- oppstartsknappen ---------- */

#np-launch {
  position: fixed;
  left: 168px;
  bottom: 8px;
  z-index: 2147483199;
  display: none;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 7px 11px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .65);
  color: #fff;
  font: 600 12px/1 system-ui, -apple-system, Segoe UI, sans-serif;
}
#np-launch.np-show { display: inline-flex; }
#np-launch:hover { background: rgba(0, 0, 0, .85); }
#np-launch .np-lico {
  position: relative;
  width: 13px;
  height: 11px;
  flex: none;
  border-radius: 3px 3px 3px 0;
  background: linear-gradient(180deg, #fffbe2, #ffd85e);
}
#np-launch .np-badge {
  display: none;
  min-width: 15px;
  padding: 1px 4px;
  text-align: center;
  border-radius: 8px;
  background: #e0294a;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .4);
}
#np-launch .np-badge.np-on { display: inline-block; }
@keyframes np-blink {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 255, 255, .4); }
  50% { box-shadow: 0 0 0 3px rgba(224, 41, 74, .45); }
}
#np-launch .np-badge.np-on { animation: np-blink 1.3s ease-in-out infinite; }

/* ---------- små skjermer ---------- */

@media (max-width: 760px) {
  #np-win, #np-launch { display: none !important; }
}
