/* =========================
   Root Variables
========================= */
:root {
  --bg: #000614;
  --white: #ffffff;
  --accent: #0A00FF;
  --muted: rgba(255, 255, 255, 0.6);
  --panel-bg: rgba(255, 255, 255, 0.03);
}

/* =========================
   Floating Button
========================= */
.cashly-floating-btn {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 99999;

  width: 56px;
  height: 56px;

  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--accent), #3a3cff);

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);

  line-height: 1;
  transition: transform 0.15s ease;
}

.cashly-floating-btn:hover {
  transform: scale(1.08);
}

.cashly-floating-btn:active {
  transform: scale(0.95);
}


.chat-icon{
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
}

.chat-icon svg{
  width:55px;
  height:55px;
}
@media (max-width: 720px){
  .chat-icon svg{
    width:39px;
    height:39px;
  }
}

/* Quota Modal (Cashly style) */
.cashly-quota-modal{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(180deg, rgba(2,6,18,0.6), rgba(0,6,20,0.6));
  z-index:120000;
  padding:20px;
}
.cashly-q-card{
  width:100%;
  max-width:520px;
  background:linear-gradient(180deg, #071025, #001027);
  border-radius:12px;
  padding:20px;
  color:var(--white);
  box-shadow:0 20px 60px rgba(0,0,0,0.6);
  border:1px solid rgba(255,255,255,0.04);
  box-sizing:border-box;
}
.cashly-q-card h3{ margin:0 0 8px; font-size:1.1rem; }
.cashly-q-card p{ color:var(--muted); margin:6px 0 12px; }
.cashly-q-list{ list-style:none; padding:0; margin:0 0 12px; color:var(--muted); }
.cashly-q-list li{ padding:6px 0; border-bottom:1px dashed rgba(255,255,255,0.03); }
.cashly-q-reset{ color:var(--muted); margin-bottom:14px; }
.cashly-q-actions{ display:flex; gap:10px; align-items:center; }
.cashly-q-upgrade{
  background:linear-gradient(90deg,var(--accent), #3a3cff);
  color:#fff;
  padding:10px 14px;
  border-radius:10px;
  text-decoration:none;
  font-weight:700;
  box-shadow:0 10px 30px rgba(10,0,255,0.12);
}
.cashly-q-ok{
  background:transparent;
  color:var(--white);
  border:1px solid rgba(255,255,255,0.06);
  padding:10px 12px;
  border-radius:8px;
  cursor:pointer;
}
.cashly-q-close{
  position:absolute;
  right:18px;
  top:18px;
  background:transparent;
  border:none;
  color:var(--muted);
  font-size:16px;
  cursor:pointer;
}
/* =========================
   Quota Modal – Optische Fixes
========================= */

.cashly-q-card h3 {
  color: #ffffff; /* vorher grau */
  font-weight: 800;
  letter-spacing: 0.2px;
}

.cashly-q-card p {
  color: rgba(255,255,255,0.85);
}

/* Verstanden Button */
.cashly-q-ok {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cashly-q-ok:hover {
  background: rgba(255,255,255,0.08);
  border-color: #ffffff;
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25);
}

/* Upgrade Button bleibt Accent */
.cashly-q-upgrade:hover {
  filter: brightness(1.05);
}

/* Close Button */
.cashly-q-close {
  color: rgba(255,255,255,0.8);
}

.cashly-q-close:hover {
  color: #ffffff;
}

@media(max-width:720px){
  .cashly-q-card{ padding:16px; max-width:92vw; }
  .cashly-q-actions{ flex-direction:column; align-items:stretch; }
  .cashly-q-upgrade, .cashly-q-ok{ width:100%; text-align:center; }
}


/* =========================
   Panel
========================= */
.cashly-panel {
  position: fixed;
  left: 14px;
  bottom: 84px;
  z-index: 99999;

  width: 360px;
  max-width: 92vw;
  height: 70vh;
  max-height: 720px;

  background: var(--bg);
  color: var(--white);

  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);

  display: flex;
  flex-direction: column;
  overflow: hidden;

  transform: translateY(10px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.cashly-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* =========================
   Header
========================= */
.cashly-panel .header {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.cashly-panel .logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
}

.cashly-panel .title {
  font-weight: 700;
  font-size: 1rem;
}

.cashly-panel .sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Runde Icon-Buttons */
.header-actions button {
  width: 20px;
  height: 20px;
  padding: 0;

  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;

  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  transition: transform 0.08s ease, filter 0.12s ease;
  box-shadow: 0 4px 12px rgba(10, 0, 255, 0.12);
}

.header-actions button:hover {
  filter: brightness(0.95);
  transform: translateY(-1px);
}

/* Icon pseudo content */
#cashly-close::before {
  content: "\00D7";
  font-size: 14px;
  line-height: 1;
  display: inline-block;
}

#cashly-fullscreen::before {
  content: "⤢";
  font-size: 13px;
  line-height: 1;
  display: inline-block;
}

.cashly-panel.fullscreen {
  position: fixed !important;
  inset: 0 !important;

  width: 100vw !important;
  height: 100vh !important;

  max-width: none !important;
  max-height: none !important;

  border-radius: 0 !important;
  margin: 0 !important;
  transform: none !important;
  box-shadow: none !important;
  z-index: 100000 !important;
}

/* =========================
   Body Layout
========================= */
.cashly-panel .body {
  flex: 1;
  min-height: 0;

  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
}

/* =========================
   Chats List
========================= */
.chats-list {
  background: var(--panel-bg);
  padding: 8px;
  border-radius: 8px;
  overflow: auto;
}

.chat-item {
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.chat-item.active {
  background: linear-gradient(90deg, var(--accent), #3a3cff);
  color: #fff;
  font-weight: 700;
}

.chat-item.new-chat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.chat-item.new-chat:hover {
  background: rgba(10, 0, 255, 0.2);
}

.chat-item.new-chat .plus {
  font-size: 14px;
  opacity: 0.8;
}

/* =========================
   Messages
========================= */
.messages {
  flex: 1;
  min-height: 0;

  display: flex;
  flex-direction: column;
  gap: 8px;

  overflow: auto;
}

/* Message Bubble */
.msg {
  position: relative;
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;

  display: flex;
  flex-direction: column;
}

.msg.user {
  align-self: flex-end;
  background: linear-gradient(90deg, var(--accent), #3a3cff);
  color: #fff;
}

.msg.ai {
  align-self: flex-start;
  background: #0c1220;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Message Text */
.msg-text {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-text {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Inter", "Helvetica Neue", Arial, sans-serif;
}

.msg-text emoji,
.msg-text span[role="img"] {
  opacity: 0.85;
}


/* Meta (time + copy) */
.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;

  margin-top: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);

  opacity: 0;
  transition: opacity 0.15s ease;
}

.msg:hover .msg-meta {
  opacity: 1;
}
/* =========================
   Thinking Indicator
========================= */
.msg.ai.thinking {
  font-style: italic;
  opacity: 0.85;
  color: rgba(255,255,255,0.85);
  background: linear-gradient(
    90deg,
    rgba(10,0,255,0.12),
    rgba(10,0,255,0.22),
    rgba(10,0,255,0.12)
  );
  background-size: 200% 100%;
  animation: cashlyThinking 2.5s ease-in-out infinite;
}

@keyframes cashlyThinking {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}


/* Copy Button */
.copy-btn {
  background: transparent;
  border: none;

  width: 16px;
  height: 16px;
  padding: 0;

  cursor: pointer;
  color: rgba(255, 255, 255, 0.45);

  border-radius: 3px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 12px;
  line-height: 1;

  transition: color 0.15s ease, background 0.15s ease;

  outline: none;
  user-select: none;
}

.copy-btn:focus,
.copy-btn:active {
  background: transparent;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.45);
}

/* Copy Icon */
.copy-btn::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.copy-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* =========================
   Input Area
========================= */
.input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.input-row textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  resize: none;

  padding: 10px;
  border-radius: 10px;

  border: 1px solid rgba(255, 255, 255, 0.04);
  background: #0b0b10;
  color: #fff;
}

.input-row button {
  background: var(--accent);
  border: none;
  color: #fff;

  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

/* =========================
   Chat Delete – Trash Icon
========================= */
.chat-delete {
  all: unset;
  width: 16px;
  height: 16px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.chat-item .chat-delete {
  opacity: 0;
}

.chat-item.active .chat-delete {
  opacity: 1;
}

.trash-icon {
  width: 14px;
  height: 14px;

  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 2;
  fill: none;

  transition: stroke 0.15s ease, transform 0.15s ease;
}

.chat-delete:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chat-delete:hover .trash-icon {
  stroke: #ffffff;
  transform: scale(1.2);
}

.chat-delete:focus,
.chat-delete:active {
  outline: none;
  background: none;
}
/* Rechte Spalte: Nachrichten + Input-Leiste */
.chat-column {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0; /* wichtig für Flexbox + overflow */
}

/* Nachrichtenbereich füllt alles außer Input */
.messages {
  flex: 1;
  min-height: 0; /* wichtig, sonst scrollt es nicht korrekt */
  overflow-y: auto;
  padding-bottom: 8px; /* optional: Platz für Input */
}

/* Input-Leiste immer unten fix */
.input-row {
  flex-shrink: 0; /* nicht schrumpfen */
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  background: var(--bg);
}
/* Mobile Vollbild: Input-Leiste etwas weiter unten */
.cashly-panel.fullscreen.fullscreen-mobile .input-row {
    position: absolute;
    bottom: 12%; /* kleiner als vorher, Input-Leiste etwas tiefer */
    left: 0;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
}

/* Nachrichtenbereich, damit Hintergrund weiterhin sichtbar ist */
.cashly-panel.fullscreen.fullscreen-mobile .messages {
    margin-bottom: calc(12% + 60px); /* Abstand passend zur Input-Leiste */
    background: var(--bg); /* Panel-Hintergrund weiterziehen */
}
/* =========================
   AI DISCLAIMER – REAL FIX
========================= */

.cashly-panel .ai-disclaimer {
  font-size: 10px;
  line-height: 1.3;

  color: rgba(255,255,255,0.55);

  background: rgba(255,255,255,0.05);
  border-radius: 6px;

  padding: 4px 8px;
  margin: 4px 8px 6px;

  max-width: calc(100% - 16px);

  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Inter, Arial, sans-serif;

  opacity: 0.9;
}

/* =========================
   Responsive
========================= */
@media (min-width: 721px) {
  .cashly-floating-btn {
    width: 70px;
    height: 70px;
    font-size: 0px;
  }

  .cashly-panel {
    width: 480px;
    height: 75vh;
    bottom: 20px;
    left: 20px;
  }

  .chat-column {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
}
