/* CastiloCloud portal: floating Technical Support button and panel (signed-in users only).
   Same look as the website chat; uses the "CC Inter" font defined in castilo-login.css. */
.ccs-fab, .ccs-panel, .ccs-hint { font-family: "CC Inter", -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }

.ccs-fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 990;
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #1B3A8C, #1E6DC8); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(27, 58, 140, .35); transition: transform .25s, box-shadow .25s;
}
.ccs-fab:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(27, 58, 140, .42); }
.ccs-fab:focus-visible { outline: 3px solid #8DD4F0; outline-offset: 3px; }
.ccs-fab svg { position: absolute; width: 25px; height: 25px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: opacity .2s, transform .25s; }
.ccs-fab .i-close { opacity: 0; transform: rotate(-90deg); }
.ccs-fab.open .i-chat { opacity: 0; transform: rotate(90deg); }
.ccs-fab.open .i-close { opacity: 1; transform: none; }

.ccs-hint {
  position: fixed; right: 96px; bottom: 39px; z-index: 990; pointer-events: none;
  background: #fff; color: #0d1b3e; font-size: 13px; font-weight: 600; padding: 8px 13px; border-radius: 10px;
  border: 1px solid #d0e4f4; box-shadow: 0 8px 24px rgba(13, 27, 62, .12); white-space: nowrap;
  opacity: 0; transform: translateX(8px); transition: all .3s;
}
.ccs-hint.show { opacity: 1; transform: none; }

.ccs-panel {
  position: fixed; right: 26px; bottom: 98px; z-index: 995;
  width: min(392px, calc(100vw - 32px)); max-height: min(660px, calc(100vh - 130px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid #d0e4f4; border-radius: 18px; box-shadow: 0 24px 70px rgba(13, 27, 62, .28);
  opacity: 0; transform: translateY(16px) scale(.97); transform-origin: bottom right;
  visibility: hidden; pointer-events: none; transition: opacity .25s, transform .25s, visibility 0s .25s;
  color: #0d1b3e; font-size: 14px; line-height: 1.5;
}
.ccs-panel.open { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition: opacity .25s, transform .25s, visibility 0s; }

.ccs-head { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; padding: 16px 16px 18px;
  background: linear-gradient(135deg, #0d1b3e 0%, #1B3A8C 100%); color: #fff; }
.ccs-head::after { content: ""; position: absolute; right: -60px; top: -60px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(66, 160, 220, .25), transparent 70%); }
.ccs-av { width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); }
.ccs-av svg { width: 25px; height: 25px; }
.ccs-ht { flex: 1; min-width: 0; position: relative; z-index: 1; }
.ccs-ht strong { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.ccs-ht span { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; color: rgba(255, 255, 255, .68); }
.ccs-ht span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
.ccs-x { position: relative; z-index: 1; width: 32px; height: 32px; border: none; border-radius: 8px; cursor: pointer;
  background: rgba(255, 255, 255, .1); color: #fff; font-size: 20px; line-height: 1; }
.ccs-x:hover { background: rgba(255, 255, 255, .2); }

.ccs-body { flex: 1; overflow-y: auto; padding: 16px; background: #f0f6fc; }
.ccs-msg { background: #fff; border: 1px solid #d0e4f4; border-radius: 4px 14px 14px 14px; padding: 11px 14px; font-size: 13.5px; line-height: 1.55; max-width: 92%; }
.ccs-msg small { display: block; margin-top: 5px; font-size: 11px; color: #4a5a7a; }
.ccs-greet { font-weight: 700; }
.ccs-who { margin-top: 10px; font-size: 12.5px; line-height: 1.55; color: #0d1b3e; background: #e6f0fb; border-radius: 10px; padding: 8px 12px; }
.ccs-who span { color: #4a5a7a; }
.ccs-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0 2px; }
.ccs-cat { font: 600 12px "CC Inter", -apple-system, "Segoe UI", sans-serif; padding: 6px 11px; border-radius: 100px; cursor: pointer;
  border: 1px solid rgba(30, 109, 200, .25); background: #fff; color: #1E6DC8; transition: all .15s; }
.ccs-cat:hover { border-color: #1E6DC8; }
.ccs-cat[aria-pressed="true"] { background: #1E6DC8; border-color: #1E6DC8; color: #fff; }

.ccs-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ccs-form label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: #4a5a7a; margin: 0; }
.ccs-opt { font-weight: 400; }
.ccs-form input:not([type=checkbox]), .ccs-form textarea {
  width: 100%; box-sizing: border-box; font: 400 14px "CC Inter", -apple-system, "Segoe UI", sans-serif; color: #0d1b3e;
  background: #fff; border: 1px solid #d0e4f4; border-radius: 10px; padding: 9px 12px; transition: border-color .2s, box-shadow .2s; }
.ccs-form textarea { min-height: 104px; resize: vertical; line-height: 1.5; }
.ccs-form input:focus, .ccs-form textarea:focus { outline: none; border-color: #42A0DC; box-shadow: 0 0 0 3px rgba(66, 160, 220, .18); }
.ccs-form .inv { border-color: #e05252; }
.ccs-form label.ccs-urgent { flex-direction: row; align-items: flex-start; gap: 8px; font-size: 13px; font-weight: 500; color: #0d1b3e; cursor: pointer; }
.ccs-urgent input { margin-top: 3px; accent-color: #d9480f; }
.ccs-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ccs-err { font-size: 12.5px; color: #c43d3d; }

.ccs-foot { padding: 12px 16px 14px; background: #fff; border-top: 1px solid #d0e4f4; text-align: center; }
.ccs-send { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: none; border-radius: 10px; padding: 12px; font: 700 14px "CC Inter", -apple-system, "Segoe UI", sans-serif; color: #fff;
  background: linear-gradient(135deg, #1B3A8C, #1E6DC8); transition: filter .2s; }
.ccs-send:hover { filter: brightness(1.08); }
.ccs-send:disabled { opacity: .65; cursor: default; }
.ccs-send svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ccs-help { display: inline-block; margin-top: 9px; font-size: 12px; font-weight: 600; color: #1E6DC8; text-decoration: none; }
.ccs-help:hover { color: #42A0DC; text-decoration: underline; }

.ccs-done { display: none; text-align: center; padding: 30px 10px 10px; }
.ccs-done .ok { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #42A0DC, #1E6DC8); }
.ccs-done .ok svg { width: 27px; height: 27px; stroke: #fff; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ccs-done h4 { margin: 0 0 8px; font-size: 17px; color: #0d1b3e; }
.ccs-done p { margin: 0; font-size: 13.5px; color: #4a5a7a; line-height: 1.6; }
.ccs-done button { margin-top: 18px; background: #fff; border: 1px solid #d0e4f4; border-radius: 8px; padding: 8px 15px; cursor: pointer;
  font: 600 13px "CC Inter", -apple-system, "Segoe UI", sans-serif; color: #1B3A8C; }
.ccs-panel.sent .ccs-form-wrap, .ccs-panel.sent .ccs-foot .ccs-send { display: none; }
.ccs-panel.sent .ccs-done { display: block; }

/* Dark portal layout */
body.dark-mode .ccs-panel { background: #141414; border-color: #303030; color: #e8e8e8; }
body.dark-mode .ccs-body { background: #1d1d1d; }
body.dark-mode .ccs-msg, body.dark-mode .ccs-form input:not([type=checkbox]), body.dark-mode .ccs-form textarea, body.dark-mode .ccs-cat { background: #262626; border-color: #3a3a3a; color: #e8e8e8; }
body.dark-mode .ccs-who { background: #1f2a3d; color: #e8e8e8; }
body.dark-mode .ccs-form label, body.dark-mode .ccs-msg small, body.dark-mode .ccs-who span { color: #a6a6a6; }
body.dark-mode .ccs-foot { background: #141414; border-color: #303030; }

@media (max-width: 520px) {
  .ccs-fab { right: 16px; bottom: 16px; }
  .ccs-panel { right: 8px; left: 8px; width: auto; bottom: 84px; max-height: calc(100vh - 100px); }
  .ccs-hint { display: none; }
}
@media print { .ccs-fab, .ccs-panel, .ccs-hint { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .ccs-fab, .ccs-panel, .ccs-fab svg, .ccs-hint { transition: none; } }
