/* ========================= QUICK CTA RAIL ========================= */

.qcta-rail {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 850;
  display: none;  flex-direction: column;
  gap: 3px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(232, 234, 239, 0.9);
  border-left: none;
  border-radius: 0 18px 18px 0;
  padding: 8px 4px 8px 10px;
  box-shadow:
    3px 0 6px rgba(35, 46, 102, 0.05),
    8px 0 24px -4px rgba(35, 46, 102, 0.1),
    16px 0 48px -8px rgba(35, 46, 102, 0.08);
  width: 56px;
  overflow: hidden;
  transition:
    width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    padding-left 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.32s ease;
  animation: qcta-slide-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.4s both;
}

.qcta-rail:hover {
  width: 248px;
  padding-left: 8px;
  box-shadow:
    3px 0 6px rgba(35, 46, 102, 0.06),
    12px 0 36px -4px rgba(35, 46, 102, 0.15),
    24px 0 64px -8px rgba(35, 46, 102, 0.1);
}

/* ── Items: icon on the right, label on the left ── */
.qcta-item {
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
  gap: 10px;
  padding: 6px 6px 6px 0;   /* no left padding in collapsed — keeps icons tight */
  border-radius: 0 12px 12px 0;
  text-decoration: none;
  color: #151515;
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  white-space: nowrap;
  transition: background 0.16s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.qcta-item:hover {
  background: rgba(232, 234, 239, 0.5);
}

/* ── Icon wrapper ── */
.qcta-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.qcta-item:hover .qcta-icon {
  transform: scale(1.08);
}

/* Kipinä chat — signature gradient */
.qcta-item--kipina .qcta-icon {
  background: linear-gradient(135deg, #fcb549 0%, #e64644 50%, #d823cd 100%);
  color: #fff;
  box-shadow: 0 4px 14px -4px rgba(230, 70, 68, 0.42);
}

/* Phone — orange */
.qcta-item--phone .qcta-icon {
  background: #fff2e6;
  color: #f58024;
}

/* Email — navy */
.qcta-item--email .qcta-icon {
  background: #eef0f8;
  color: #2d3a7d;
}

/* Emergency — red */
.qcta-item--emergency .qcta-icon {
  background: #fff0f0;
  color: #e64644;
}

/* ── Hover-only items: hidden in collapsed state ── */
.qcta-item--hover-only {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.04s,
    padding 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.04s,
    opacity 0.2s ease 0.1s;
}

.qcta-rail:hover .qcta-item--hover-only {
  max-height: 52px;
  padding-top: 6px;
  padding-bottom: 6px;
  opacity: 1;
  pointer-events: auto;
}

/* ── Label (appears to the left of the icon on hover) ── */
.qcta-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.2s ease 0.08s;
  pointer-events: none;
  min-width: 0;
  flex: 1;
}

.qcta-rail:hover .qcta-label {
  opacity: 1;
}

.qcta-label-main {
  font-size: 13px;
  font-weight: 700;
  color: #151515;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.qcta-label-sub {
  font-size: 11px;
  font-weight: 500;
  color: #6f6f6f;
  line-height: 1.3;
}

/* ── Group label: zero height when collapsed, expands on hover ── */
.qcta-group-label {
  display: block;
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a0a5b8;
  white-space: nowrap;
  overflow: hidden;
  max-height: 0;
  padding: 0 6px 0 0;
  opacity: 0;
  pointer-events: none;
  transition:
    max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.04s,
    padding 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.04s,
    opacity 0.2s ease 0.1s;
}

.qcta-rail:hover .qcta-group-label {
  max-height: 24px;
  padding: 4px 6px 2px 0;
  opacity: 1;
}

/* ── Divider: hidden when collapsed ── */
.qcta-divider {
  height: 0;
  overflow: hidden;
  background: #e8eaef;
  margin: 0 6px 0 0;
  flex-shrink: 0;
  transition: height 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.04s, margin 0.28s;
}

.qcta-rail:hover .qcta-divider {
  height: 1px;
  margin: 2px 6px 2px 0;
}

/* ── Slide-in from left wall on load ── */
@keyframes qcta-slide-in {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* ── Mobile: hide below 1024px ── */
@media (max-width: 1023px) {
  .qcta-rail {
    display: none;
  }
}

/* ========================= QUICK CTA RAIL — tabs + sliding panel ========================= */

.qcta-rail--v2 {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 849;
  display: flex;
  align-items: stretch;
  animation: qcta-slide-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s both;
  pointer-events: none; /* wrapper ei saa blokata tekstinvalintaa */
}

/* ── Tab strip — always visible ── */
.qcta-v2-tabs {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  gap: 8px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(218, 222, 234, 0.9);
  border-left: none;
  border-radius: 0 22px 22px 0;
  box-shadow:
    2px 0 4px rgba(35, 46, 102, 0.04),
    10px 0 30px -6px rgba(35, 46, 102, 0.12);
  transition:
    border-top-right-radius 0.28s ease,
    border-bottom-right-radius 0.28s ease,
    border-right-color 0.2s ease,
    box-shadow 0.28s ease;
}

/* When open, tabs visually merge with the panel — no right border/radius/shadow */
.qcta-rail--v2.is-open .qcta-v2-tabs {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right-color: transparent;
  box-shadow: 2px 0 4px rgba(35, 46, 102, 0.04);
}

.qcta-v2-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 4px 8px;
  background: transparent;
  border: none;
  border-radius: 13px;
  cursor: pointer;
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  transition: background 0.18s ease;
}

.qcta-v2-tab::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 32px;
  border-radius: 0 3px 3px 0;
  background: #1c2454;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.qcta-v2-tab:hover {
  background: rgba(35, 46, 102, 0.04);
}

.qcta-v2-tab.is-active {
  background: rgba(35, 46, 102, 0.06);
}

.qcta-v2-tab.is-active::before {
  transform: translateY(-50%) scaleY(1);
}

.qcta-v2-tab-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.22s ease;
}

.qcta-v2-tab:hover .qcta-v2-tab-icon,
.qcta-v2-tab.is-active .qcta-v2-tab-icon {
  transform: scale(1.05);
}

.qcta-v2-tab-icon--grad {
  background: #eef2ff;
  color: #4e7bef;
}

.qcta-v2-tab-icon--navy {
  background: #fff3e8;
  color: #f58024;
}

.qcta-v2-tab-icon--green {
  background: #edfcf2;
  color: #22a861;
}

.qcta-v2-tab-icon--violet {
  background: #f4f0ff;
  color: #8b5cf6;
}

.qcta-v2-tab-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #1c2454;
  line-height: 1;
}

/* ── Sliding panel ── */
.qcta-v2-panel {
  position: relative;
  z-index: 1;
  margin-left: -1px;
  display: flex;
  flex-direction: column;
  width: 320px;
  padding: 18px 18px 14px 18px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(218, 222, 234, 0.9);
  border-left: none;
  border-radius: 0 22px 22px 0;
  box-shadow:
    14px 0 32px -8px rgba(35, 46, 102, 0.16),
    32px 0 70px -14px rgba(35, 46, 102, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-24px);
  pointer-events: none;
  transition:
    opacity 0.24s ease,
    transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.32s linear;
}

.qcta-rail--v2.is-open .qcta-v2-panel {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto; /* palautetaan wrapper-tasolta */
}

/* Close button — hidden, panel closes by re-clicking the active tab */
.qcta-v2-panel-close {
  display: none;
}

/* Panel content — switch via active section */
.qcta-v2-panel-content {
  display: none;
  flex-direction: column;
}

.qcta-rail--v2[data-active="myynti"] .qcta-v2-panel-content[data-section="myynti"],
.qcta-rail--v2[data-active="tuki"] .qcta-v2-panel-content[data-section="tuki"],
.qcta-rail--v2[data-active="laskutus"] .qcta-v2-panel-content[data-section="laskutus"],
.qcta-rail--v2[data-active="palaute"] .qcta-v2-panel-content[data-section="palaute"] {
  display: flex;
  animation: qcta-v2-fadein 0.28s ease 0.04s both;
}

@keyframes qcta-v2-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Panel head */
.qcta-v2-chat-footer {
  margin-top: auto;
  padding-top: 18px;
}

.qcta-v2-chat-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid #f0d9d6;
  border-radius: 16px;
  background: #fff4ed;
  color: #252960;
  font-family: 'Figtree', system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.qcta-v2-chat-button:hover {
  background: #ffeadf;
  border-color: #e9b4a7;
}

.qcta-v2-chat-button:focus-visible {
  outline: 3px solid #252960;
  outline-offset: 3px;
}

.qcta-v2-chat-avatar {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 12px;
}

.qcta-v2-chat-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.qcta-v2-chat-title {
  font-size: 15px;
  font-weight: 750;
  line-height: 1.2;
}

.qcta-v2-chat-description {
  font-size: 12px;
  line-height: 1.35;
  color: #625365;
}

.qcta-v2-chat-arrow {
  flex-shrink: 0;
  margin-left: auto;
}

.qcta-v2-panel-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 4px 16px 4px;
  margin-bottom: 4px;
}

.qcta-v2-panel-eyebrow {
  font-family: 'Figtree', system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8892b0;
}

.qcta-v2-panel-content[data-section="myynti"] .qcta-v2-panel-eyebrow { color: #4e7bef; }
.qcta-v2-panel-content[data-section="tuki"] .qcta-v2-panel-eyebrow    { color: #f58024; }
.qcta-v2-panel-content[data-section="laskutus"] .qcta-v2-panel-eyebrow { color: #8b5cf6; }
.qcta-v2-panel-content[data-section="palaute"] .qcta-v2-panel-eyebrow  { color: #22a861; }

.qcta-v2-panel-title {
  font-family: 'Figtree', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #151515;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

/* Items inside panel */
.qcta-v2-panel .qcta-v2-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}

.qcta-v2-panel .qcta-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 13px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #151515;
  font-family: 'Figtree', system-ui, sans-serif;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s ease, transform 0.15s ease;
}

.qcta-v2-panel .qcta-item:hover {
  background: rgba(35, 46, 102, 0.05);
}

.qcta-v2-panel .qcta-item:active {
  transform: scale(0.985);
}

.qcta-v2-panel .qcta-item + .qcta-item {
  border-top: 1px solid #eef0f5;
}

.qcta-v2-panel .qcta-item::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-right: 1.8px solid #c4c8d6;
  border-top: 1.8px solid #c4c8d6;
  transform: rotate(45deg);
  flex-shrink: 0;
  margin-left: auto;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.qcta-v2-panel .qcta-item:hover::after {
  border-color: #8892b0;
  transform: rotate(45deg) translate(1px, -1px);
}

.qcta-v2-panel .qcta-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qcta-v2-panel .qcta-item--kipina .qcta-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: #faf7f2;
  box-shadow: none;
  overflow: hidden;
}

.qcta-item--kipina .qcta-avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.qcta-v2-panel .qcta-item--phone .qcta-icon {
  background: #fff2e6;
  color: #f58024;
}

.qcta-v2-panel .qcta-item--email .qcta-icon {
  background: #eef0f8;
  color: #2d3a7d;
}

.qcta-v2-panel .qcta-item--emergency .qcta-icon {
  background: #fff0f0;
  color: #e64644;
}

.qcta-v2-panel .qcta-item--oppaat .qcta-icon {
  background: #eef2ff;
  color: #4e7bef;
}

.qcta-v2-panel .qcta-item--viesti .qcta-icon {
  background: #fdeef6;
  color: #e91e85;
}

.qcta-v2-panel .qcta-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  opacity: 1;
  pointer-events: auto;
  transition: none;
}

.qcta-v2-panel .qcta-label-main {
  font-size: 15px;
  font-weight: 700;
  color: #151515;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.qcta-v2-panel .qcta-label-sub {
  font-size: 12.5px;
  font-weight: 500;
  color: #7a7a7a;
  line-height: 1.3;
}

@media (max-width: 1023px) {
  .qcta-rail--v2 {
    display: none !important;
  }
}
