/* ================================================================
   Chattixo Support Chat — Blue Neon Edition (Dubai 2026 aesthetic)
   Elegantní futuristický styl s modrými světelnými akcenty
=================================================================*/

:root {
  --ui-bg:#030712;
  --ui-surface:#0b1120;
  --ui-surface-strong:#111827;
  --ui-text:#f0f9ff;
  --ui-subtext:rgba(255,255,255,.6);
  --ui-border:rgba(255,255,255,.08);
  --ui-accent:#1f6fff;
  --ui-accent-glow:rgba(31,111,255,.45);
  --ui-accent-bg:linear-gradient(135deg,#3b82f6 0%,#1d4ed8 100%);
  --ui-radius:20px;
  --ui-blur:20px;
  --ui-shadow:0 12px 40px rgba(0,0,0,.55);
  --ui-font:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
}

/* ====== ROOT CONTAINER ====== */
.derid-chat {
  position:fixed;
  right:24px;
  bottom:24px;
  z-index:9999;
  font-family:var(--ui-font);
  color:var(--ui-text);
  perspective:800px;
}

/* ====== BUBBLE ====== */
.derid-bubble {
  position: relative;
  width:64px;height:64px;border-radius:50%;
  display:grid;place-items:center;
  background:linear-gradient(145deg,#1e3a8a,#3b82f6);
  border:1px solid rgba(255,255,255,.1);
  box-shadow:0 0 35px rgba(31,111,255,.65), 0 0 10px rgba(31,111,255,.45) inset;
  cursor:pointer;
  backdrop-filter:blur(15px);
  transition:all .35s ease;
  animation:chattixoGlow 3.5s ease-in-out infinite;
}

@keyframes chattixoGlow {
  0%,100% { box-shadow:0 0 25px rgba(31,111,255,.5),0 0 8px rgba(31,111,255,.4) inset; }
  50% { box-shadow:0 0 45px rgba(31,111,255,.9),0 0 15px rgba(31,111,255,.5) inset; }
}

.derid-bubble:hover {
  transform:translateY(-5px) scale(1.07);
  box-shadow:0 0 30px var(--ui-accent-glow);
  background:linear-gradient(145deg,#1d4ed8,#3b82f6);
}

/* ====== PANEL ====== */
.derid-panel {
  position:fixed;
  right:24px;
  bottom:calc(24px + 64px);
  width:min(92vw,400px);
  height:500px;
  max-height:calc(100vh - 140px);
  background:rgba(10,15,26,.98);
  border:1px solid var(--ui-border);
  border-radius:var(--ui-radius);
  box-shadow:0 0 30px rgba(31,111,255,.2);
  overflow:hidden;
  backdrop-filter:blur(var(--ui-blur));
  display:none;
  flex-direction:column;
  transform-origin:bottom right;
  opacity:0;
  transform:translateY(20px) scale(0.96);
}
.derid-panel.open {
  display:flex;
  animation:panelOpen .45s cubic-bezier(.3,.7,.3,1.1) forwards;
}
@keyframes panelOpen {
  to {opacity:1;transform:translateY(0) scale(1);}
}

/* ====== HEADER ====== */
.derid-head {
  padding:16px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--ui-border);
  background:linear-gradient(180deg,rgba(31,111,255,.12),transparent);
}
.derid-title {font-weight:700;font-size:16px;letter-spacing:.3px;}
.derid-sub {color:var(--ui-subtext);font-size:12px;}

/* HEADER BUTTONS */
#userActions button {
  background:var(--ui-accent-bg);
  color:#fff;
  border:none;
  border-radius:10px;
  padding:6px 14px;
  font-weight:600;
  margin-left:8px;
  cursor:pointer;
  transition:all .25s ease;
  font-size:13px;
  box-shadow:0 0 10px rgba(31,111,255,.25);
}
#userActions button:hover {
  background:linear-gradient(135deg,#60a5fa,#2563eb);
  transform:translateY(-1px);
  box-shadow:0 0 18px var(--ui-accent-glow);
}

/* ====== BODY ====== */
.derid-body {
  flex:1;overflow-y:auto;padding:16px;
  scrollbar-width:thin;scrollbar-color:rgba(31,111,255,.3) transparent;
}
.derid-body::-webkit-scrollbar{width:6px;}
.derid-body::-webkit-scrollbar-thumb{
  background:rgba(31,111,255,.35);
  border-radius:10px;
}

/* ====== MESSAGES ====== */
.msg {
  padding:10px 14px;
  margin:8px 0;
  border-radius:16px;
  max-width:86%;
  line-height:1.35;
  word-break:break-word;
  animation:msgIn .3s ease both;
}
@keyframes msgIn {
  from{opacity:0;transform:translateY(6px) scale(.96)}
  to{opacity:1;transform:none}
}
.msg.user {
  background:linear-gradient(135deg,#1f6fff,#3b82f6);
  color:#fff;
  margin-left:auto;
  border:1px solid rgba(255,255,255,.1);
  box-shadow:0 0 12px rgba(31,111,255,.3);
}
.msg.bot {
  background:#111827;
  border:1px solid var(--ui-border);
  color:#e2e8f0;
}

/* === AI typing === */
.msg.bot.typing::after {
  content:'•••';
  display:inline-block;
  animation:typingDots 1.4s infinite;
  color:#3b82f6;
}
@keyframes typingDots {
  0%,20%{content:'•'}
  40%{content:'••'}
  60%,100%{content:'•••'}
}

/* ====== INPUT AREA ====== */
.derid-input {
  display:flex;
  gap:8px;
  align-items:center;
  border-top:1px solid var(--ui-border);
  padding:12px;
  background:linear-gradient(180deg,rgba(31,111,255,.1),transparent);
}
.derid-input input {
  flex:1;
  background:rgba(255,255,255,.06);
  border:1px solid var(--ui-border);
  border-radius:12px;
  padding:12px;
  color:var(--ui-text);
  font-size:14px;
  outline:none;
  transition:all .25s ease;
}
.derid-input input:focus {
  border-color:var(--ui-accent);
  background:rgba(255,255,255,.12);
  flex:1.1;
  box-shadow:0 0 10px rgba(31,111,255,.3);
}
.derid-input button {
  background:var(--ui-accent-bg);
  color:#fff;
  border:none;
  border-radius:10px;
  padding:12px 16px;
  font-weight:600;
  cursor:pointer;
  transition:all .25s ease;
  box-shadow:0 0 10px rgba(31,111,255,.25);
}
.derid-input button:hover {
  background:linear-gradient(135deg,#60a5fa,#2563eb);
  transform:translateY(-1px);
  box-shadow:0 0 18px rgba(31,111,255,.4);
}

/* ====== LOGIN PANEL ====== */
.login-panel {
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:22px 10px;
}
.login-panel input {
  background:rgba(255,255,255,.06);
  border:1px solid var(--ui-border);
  color:#fff;
  border-radius:12px;
  padding:12px 14px;
  font-size:14px;
  outline:none;
  transition:all .25s ease;
}
.login-panel input:focus {
  border-color:var(--ui-accent);
  background:rgba(255,255,255,.14);
  box-shadow:0 0 12px rgba(31,111,255,.3);
}
.login-panel button {
  padding:12px 16px;
  border:none;
  border-radius:12px;
  cursor:pointer;
  font-weight:600;
  font-size:15px;
  background:var(--ui-accent-bg);
  color:#fff;
  box-shadow:0 0 12px rgba(31,111,255,.3);
  transition:all .25s ease;
}
.login-panel button:hover {
  background:linear-gradient(180deg,#60a5fa 10%,#2563eb 100%);
  transform:translateY(-1px);
  box-shadow:0 0 20px rgba(31,111,255,.5);
}
.login-panel a {
  color:#93c5fd;
  font-size:13px;
  text-decoration:none;
  text-align:center;
  transition:opacity .25s ease;
}
.login-panel a:hover {
  opacity:1;
  text-shadow:0 0 6px rgba(31,111,255,.6);
}

/* ====== TICKETS ====== */
.ticket-list {display:flex;flex-direction:column;gap:8px;}
.ticket-item {
  padding:10px 12px;
  border-radius:10px;
  background:#0f172a;
  border:1px solid var(--ui-border);
  cursor:pointer;
  transition:all .25s ease;
  color:#e2e8f0;
}
.ticket-item:hover {
  background:#1e3a8a;
  border-color:var(--ui-accent);
  transform:translateY(-2px);
  box-shadow:0 0 15px rgba(31,111,255,.4);
}
.ticket-item strong {color:#fff;font-weight:600;}
.ticket-item em {font-size:11px;color:rgba(255,255,255,.45);margin-left:6px;}
.ticket-item[style*="opacity:.6;"] {filter:grayscale(.7);opacity:.7;}
#btnNewTicket {
  margin-top:10px;
  background:var(--ui-accent-bg);
  color:#fff;
  font-weight:600;
  border:none;
  border-radius:10px;
  padding:10px 14px;
  cursor:pointer;
  transition:all .25s ease;
  box-shadow:0 0 10px rgba(31,111,255,.3);
}
#btnNewTicket:hover {
  background:linear-gradient(135deg,#60a5fa,#2563eb);
  transform:translateY(-1px);
  box-shadow:0 0 18px rgba(31,111,255,.5);
}

/* ====== TICKET HEADER ====== */
.ticket-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:14px;
}
.btn-close-ticket {
  background:linear-gradient(145deg,#1e293b,#1e40af);
  color:#fff;
  border:none;
  padding:8px 16px;
  border-radius:8px;
  cursor:pointer;
  transition:.25s;
}
.btn-close-ticket:hover {
  background:linear-gradient(145deg,#2563eb,#1e3a8a);
  box-shadow:0 0 10px rgba(31,111,255,.4);
}

/* ====== BACK LINKS ====== */
a.back-link,
#backToChat,
#backToChat2 {
  display:inline-block;
  margin-top:10px;
  color:#93c5fd;
  font-size:13px;
  text-decoration:none;
  font-weight:600;
  letter-spacing:.2px;
  transition:all .3s ease;
}
a.back-link:hover,
#backToChat:hover,
#backToChat2:hover {
  color:#fff;
  text-shadow:0 0 8px rgba(31,111,255,.7);
  transform:translateY(-1px);
}

/* Glowing gradient text for #backToChat2 */
#backToChat2 {
  background:linear-gradient(90deg,#60a5fa,#1f6fff,#60a5fa);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  font-weight:700;
}
#backToChat2:hover {
  text-shadow:0 0 10px rgba(31,111,255,.8);
  transform:translateY(-1px) scale(1.02);
}
/* ===============================
   MESSAGE WRAPPER
================================ */

.msg{
  display:flex;
  gap:10px;
  align-items:flex-end;
}

/* AI + SUPPORT vlevo */
.msg.bot,
.msg.admin{
  flex-direction:row;
}

/* USER vpravo */
.msg.user{
  flex-direction:row-reverse;
}

/* ===============================
   AVATAR
================================ */

.avatar{
  width:32px;
  height:32px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  color:#fff;
  flex-shrink:0;
}

.msg.user .avatar{
  background:linear-gradient(135deg,#3b82f6,#2563eb);
}

.msg.admin .avatar{
  background:linear-gradient(135deg,#06b6d4,#0284c7);
}

.msg.bot .avatar{
  background:linear-gradient(135deg,#6366f1,#22d3ee);
}

/* ===============================
   BUBBLE WRAP (layout only)
================================ */

.bubble-wrap{
  display:flex;
  flex-direction:column;
  max-width:68%;
}

/* ===============================
   META
================================ */

.meta{
  font-size:12px;
  opacity:.7;
  margin-bottom:4px;
}

.msg.user .meta{
  text-align:right;
}

/* ===============================
   MESSAGE TEXT – JEDINÝ BOX
================================ */

.msg-text{
  line-height:1.35;
  white-space:pre-wrap;
  word-break:break-word;
}

/* 🤖 AI */
.msg.bot .msg-text{
  background:#0b1220;
  color:#e5e7eb;
  border-radius:14px;
  padding:10px 14px;
  box-shadow:0 10px 30px rgba(0,0,0,.35);
  border-left:4px solid #6366f1;
}

/* 🧑‍💼 SUPPORT */
.msg.admin .msg-text{
  background:#0b1220;
  color:#e5e7eb;
  border-radius:14px;
  padding:10px 14px;
  box-shadow:0 10px 30px rgba(0,0,0,.35);
  border-left:4px solid #38bdf8;
}

/* 👤 USER */
.msg.user .msg-text{
  background:linear-gradient(135deg,#1f6fff,#3b82f6);
  color:#fff;
  padding:10px 14px;
  border-radius:14px;
  box-shadow:0 6px 16px rgba(31,111,255,.35);

  /* 🔹 vizuální akcent */
  border-right:3px solid rgba(255,255,255,.35);

  /* 🔹 správné formátování textu */
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ===============================
   SPACING
================================ */

.msg.bot,
.msg.admin{
  margin-bottom:6px;
}

.msg.me{
  margin-bottom:12px;
}

/* ===============================
   HARD RESET – ZABIJE BOX V BOXU
================================ */

/* bubble-wrap NESMÍ MÍT NIC */
.msg .bubble-wrap{
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  backdrop-filter: none !important;
}

/* meta nesmí tvořit vlastní blok */
.msg .meta{
  margin: 0 0 4px 0 !important;
  padding: 0 !important;
  background: none !important;
}

/* ===============================
   MESSAGE WRAPPER
================================ */

.msg{
  display:flex;
  gap:10px;
  align-items:flex-end;
}

.msg.bot,
.msg.admin{
  flex-direction:row;
}

.msg.user{
  flex-direction:row-reverse;
}

/* ===============================
   AVATAR
================================ */

.avatar{
  width:32px;
  height:32px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  color:#fff;
  flex-shrink:0;
}

.msg.user .avatar{
  background:linear-gradient(135deg,#3b82f6,#2563eb);
}

.msg.admin .avatar{
  background:linear-gradient(135deg,#06b6d4,#0284c7);
}

.msg.bot .avatar{
  background:linear-gradient(135deg,#6366f1,#22d3ee);
}

/* ===============================
   BUBBLE WIDTH
================================ */

.bubble-wrap{
  max-width:66%;
}

/* ===============================
   MESSAGE TEXT – JEDINÝ BOX
================================ */

.msg-text{
  line-height:1.25;
  white-space:pre-wrap;
  word-break:break-word;
}

/* 🤖 AI */
.msg.bot .msg-text{
  background:#0b1220;
  color:#e5e7eb;
  border-radius:12px;
  padding:8px 12px;
  box-shadow:0 8px 22px rgba(0,0,0,.32);
  border-left:3px solid #6366f1;
}

/* 🧑‍💼 SUPPORT */
.msg.admin .msg-text{
  background:#0b1220;
  color:#e5e7eb;
  border-radius:12px;
  padding:8px 12px;
  box-shadow:0 8px 22px rgba(0,0,0,.32);
  border-left:3px solid #38bdf8;
}

/* 👤 USER */
.msg.user .msg-text{
  background:linear-gradient(135deg,#3b82f6,#2563eb);
  color:#fff;
  border-radius:14px;
  padding:10px 14px;
}

/* ===============================
   SPACING
================================ */

.msg.bot,
.msg.admin{
  margin-bottom:6px;
}

.msg.me{
  margin-bottom:10px;
}
/* ======================================================
   FINAL OVERRIDE – ZRUŠÍ STARÝ MSG BOX (ROOT CAUSE)
====================================================== */

/* .msg je JEN layout, NIC VIZUÁLNÍHO */
.msg{
  padding:0 !important;
  margin:6px 0 !important;
  background:transparent !important;
  border:0 !important;
  border-radius:0 !important;
  box-shadow:none !important;
  max-width:none !important;
}

/* vypnout staré styly */
.msg.user,
.msg.bot,
.msg.admin{
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}

/* bubble-wrap jen layout */
.msg .bubble-wrap{
  background:transparent !important;
  padding:0 !important;
  margin:0 !important;
  border:0 !important;
  box-shadow:none !important;
}

/* skutečný box = msg-text */
.msg-text{
  display:inline-block;
  line-height:1.25;
  white-space:pre-wrap;
  word-break:break-word;
}

/* 🤖 AI */
.msg.bot .msg-text{
  background:#0b1220;
  color:#e5e7eb;
  padding:8px 12px;
  border-radius:12px;
  border-left:3px solid #6366f1;
  box-shadow:0 6px 18px rgba(0,0,0,.35);
}

/* 🧑‍💼 SUPPORT */
.msg.admin .msg-text{
  background:#0b1220;
  color:#e5e7eb;
  padding:8px 12px;
  border-radius:12px;
  border-left:3px solid #38bdf8;
  box-shadow:0 6px 18px rgba(0,0,0,.35);
}

/* 👤 USER */
.msg.user .msg-text{
  background:linear-gradient(135deg,#1f6fff,#3b82f6);
  color:#fff;
  padding:10px 14px;
  border-radius:14px;
  box-shadow:0 6px 16px rgba(31,111,255,.35);
}

/* šířka bublin */
.bubble-wrap{
  max-width:65%;
}
.msg.user .msg-text{
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
/* ======================================================
   CANONICAL MESSAGE BUBBLE
   jeden box, stejné rozměry, stejné řádkování
====================================================== */

/* msg = jen layout */
.msg{
  padding:0 !important;
  margin:6px 0 !important;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}

/* bubble-wrap = jen flow */
.msg .bubble-wrap{
  max-width:65%;
  padding:0 !important;
  margin:0 !important;
  background:none !important;
  border:0 !important;
  box-shadow:none !important;
}

/* ===============================
   JEDINÝ SKUTEČNÝ BOX
================================ */

.msg-text{
  display:inline-block;
  font-size:14px;
  line-height:1.35;
  font-weight:400;
  padding:10px 14px;
  border-radius:14px;
  white-space:normal;
  word-break:break-word;
  overflow-wrap:anywhere;
  box-shadow:0 6px 16px rgba(0,0,0,.28);
}

/* ===============================
   ROLE = JEN BARVA / AKCENT
================================ */

/* 👤 USER */
.msg.user .msg-text{
  background:linear-gradient(135deg,#1f6fff,#3b82f6);
  color:#fff;
  box-shadow:0 6px 16px rgba(31,111,255,.35);
}

/* 🧑‍💼 SUPPORT */
.msg.admin .msg-text{
  background:#0b1220;
  color:#e5e7eb;
  border-left:3px solid #38bdf8;
}

/* 🤖 AI */
.msg.bot .msg-text{
  background:#0b1220;
  color:#e5e7eb;
  border-left:3px solid #6366f1;
}

/* ===============================
   META
================================ */

.meta{
  font-size:12px;
  opacity:.65;
  margin:0 0 4px 0;
}

.msg.user .meta{
  text-align:right;
}
.typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0 42px;
  font-size: 13px;
  color: rgba(255,255,255,.65);
}

.typing .dot {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite both;
}

.typing .dot:nth-child(1) { animation-delay: 0s; }
.typing .dot:nth-child(2) { animation-delay: .2s; }
.typing .dot:nth-child(3) { animation-delay: .4s; }

@keyframes typingBounce {
  0%   { transform: translateY(0); opacity: .4; }
  20%  { transform: translateY(-4px); opacity: 1; }
  40%  { transform: translateY(0); opacity: .4; }
  100% { transform: translateY(0); opacity: .4; }
}
