/* ============================================================
   CHAT WIDGET — Floating chat untuk login.html
   ============================================================ */

/* ============================================================
   MASCOT (Karakter Anime) + GREETING BUBBLE
   ============================================================ */
.chat-mascot-wrap {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 9997;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
}
.chat-mascot-wrap.hidden { display: none; }

.chat-mascot-bubble {
    max-width: 220px;
    background: rgba(17, 24, 39, 0.96);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 14px;
    padding: 10px 14px;
    color: #e5e7eb;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 20px rgba(99,102,241,0.15);
    opacity: 0;
    transform: translateY(8px) scale(0.92);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    cursor: default;
    position: relative;
}
.chat-mascot-bubble.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.chat-mascot-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 28px;
    width: 14px;
    height: 14px;
    background: rgba(17, 24, 39, 0.96);
    border-right: 1px solid rgba(99, 102, 241, 0.4);
    border-bottom: 1px solid rgba(99, 102, 241, 0.4);
    transform: rotate(45deg);
}
.chat-mascot-bubble .greet-name {
    font-weight: 700;
    color: #a5b4fc;
    font-size: 12px;
    margin-bottom: 2px;
}
.chat-mascot-bubble .greet-text {
    color: #e5e7eb;
}
.chat-mascot-bubble .greet-close {
    position: absolute;
    top: 4px;
    right: 6px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 2px;
}
.chat-mascot-bubble .greet-close:hover { color: #fff; }

.chat-mascot {
    width: 64px;
    height: 64px;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 8px 16px rgba(99, 102, 241, 0.5));
    animation: mascot-float 3s ease-in-out infinite;
}
.chat-mascot:hover {
    transform: scale(1.12) translateY(-4px);
    animation: none;
}
/* Happy jump (saat diklik) */
.chat-mascot.happy-jump {
    animation: mascot-jump 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes mascot-jump {
    0%   { transform: translateY(0) scale(1); }
    20%  { transform: translateY(-28px) scale(1.05); }
    40%  { transform: translateY(0) scale(1); }
    60%  { transform: translateY(-18px) scale(1.03); }
    80%  { transform: translateY(0) scale(1); }
    100% { transform: translateY(0) scale(1); }
}
@keyframes mascot-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
.chat-mascot svg {
    width: 100%;
    height: 100%;
    display: block;
}
/* Fix arm attachment (pivot di bahu) */
.chat-mascot .mascot-arm {
    transform-box: view-box;
    transform-origin: 68px 78px;
}

/* Blink mata */
.chat-mascot .mascot-eyes {
    transform-origin: center;
    animation: mascot-blink 4s infinite;
}
@keyframes mascot-blink {
    0%, 46%, 50%, 100% { transform: scaleY(1); }
    48% { transform: scaleY(0.1); }
}

/* Lambaikan tangan */
.chat-mascot .mascot-arm {
    animation: mascot-wave 2.5s ease-in-out infinite;
    transform-box: fill-box;
}
@keyframes mascot-wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-25deg); }
    50% { transform: rotate(15deg); }
    75% { transform: rotate(-15deg); }
}

/* Sembunyikan mascot saat chat panel terbuka */
.chat-panel.open ~ .chat-mascot-wrap,
.chat-panel.open + .chat-mascot-wrap { display: none; }

/* ============================================================
/* ============================================================
   WALKING MASCOT (karakter berjalan masuk/keluar)
   ============================================================ */
.walk-mascot {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    z-index: 9995;
    pointer-events: none;
    overflow: visible;
}
.walk-mascot.hidden { display: none; }
.walk-char {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 52px;
    height: 68px;
    pointer-events: auto;
    cursor: pointer;
    animation: walk-idle 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}
@keyframes walk-idle {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-3px); }
}
.walk-inner {
    width: 100%;
    height: 100%;
    animation: walk-bob 0.45s ease-in-out infinite;
}
.walk-char svg { width: 100%; height: 100%; display: block; }
.walk-label {
    position: absolute;
    bottom: 74px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    text-shadow:
        -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000,
        -1.5px  1.5px 0 #000, 1.5px  1.5px 0 #000,
        0 0 6px rgba(0,0,0,1);
    pointer-events: none;
    z-index: 10;
    animation: walk-label-bob 1.2s ease-in-out infinite;
}
@keyframes walk-label-bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}
.walk-leg-l { animation: leg-swing 0.45s ease-in-out infinite alternate; transform-origin: 20px 42px; transform-box: view-box; }
.walk-leg-r { animation: leg-swing 0.45s ease-in-out infinite alternate-reverse; transform-origin: 28px 42px; transform-box: view-box; }
@keyframes walk-across {
    0%   { left: -60px; transform: scaleX(1); }
    45%  { left: 100%;  transform: scaleX(1); }
    46%  { left: 100%;  transform: scaleX(-1); }
    90%  { left: -60px; transform: scaleX(-1); }
    91%  { left: -60px; transform: scaleX(1); }
    100% { left: -60px; transform: scaleX(1); }
}
@keyframes walk-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}
@keyframes leg-swing {
    0%   { transform: rotate(-18deg); }
    100% { transform: rotate(18deg); }
}
.walk-flag { animation: flag-wave 1.1s ease-in-out infinite; transform-box: view-box; transform-origin: 34px 6px; }
@keyframes flag-wave {
    0%, 100% { transform: skewX(0deg) scaleX(1); }
    25% { transform: skewX(6deg) scaleX(0.97); }
    50% { transform: skewX(-4deg) scaleX(1.02); }
    75% { transform: skewX(5deg) scaleX(0.98); }
}

/* ============================================================
   DRIBBLE SCENE (Messi melewati 4 pemain Brasil)
   ============================================================ */
.dribble-scene {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    pointer-events: none;
}
.dribble-scene.play {
    display: block;
    pointer-events: auto;
}
.dribble-scene.hidden { display: none !important; }

.dribble-pitch {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.10), transparent 62%),
        repeating-linear-gradient(180deg, #1f8a45 0 9%, #1a7a3c 9% 18%);
    animation: pitch-in .3s ease-out;
}
@keyframes pitch-in {
    from { opacity: 0; transform: scale(1.04); }
    to   { opacity: 1; transform: scale(1); }
}
.dribble-pitch::before {
    content: '';
    position: absolute;
    inset: 5% 6%;
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 10px;
}
.dribble-pitch::after {
    content: '';
    position: absolute;
    left: 6%;
    right: 6%;
    top: 50%;
    height: 2px;
    background: rgba(255,255,255,0.35);
}
.pitch-circle {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22vmin;
    height: 22vmin;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 50%;
}

.bra-player {
    position: absolute;
    width: clamp(34px, 8.5vmin, 62px);
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 6px 8px rgba(0,0,0,0.35));
    animation: bra-block 1.2s ease-in-out infinite;
}
.bra-player svg { width: 100%; height: auto; display: block; }
.bra-player.bp1 { left: 26%; top: 82%; animation-delay: 0s; }
.bra-player.bp2 { left: 70%; top: 74%; animation-delay: .4s; }
.bra-player.bp3 { left: 24%; top: 62%; animation-delay: .8s; }
.bra-player.bp4 { left: 74%; top: 52%; animation-delay: 1.2s; }
.bra-player.bp5 { left: 28%; top: 40%; animation-delay: 1.6s; }
.bra-player.bp6 { left: 72%; top: 30%; animation-delay: 2.0s; }
.bra-player.bp7 { left: 50%; top: 16%; animation-delay: 2.4s; }
@keyframes bra-block {
    0%, 100% { transform: translate(-50%, -50%) rotate(-6deg) scale(1); }
    45%      { transform: translate(-50%, -50%) rotate(6deg) scale(1.06); }
    70%      { transform: translate(-50%, -50%) rotate(-6deg) scale(1); }
}

.messi-runner {
    position: absolute;
    left: 50%;
    top: 92%;
    width: clamp(42px, 10vmin, 74px);
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.4));
    animation: messi-dribble 12s cubic-bezier(0.42, 0.0, 0.58, 1.0) forwards;
}

/* Tiang gawang (goal mouth) */
.goal-mouth {
    position: absolute;
    left: 50%;
    top: 1%;
    width: clamp(90px, 26vmin, 180px);
    height: clamp(40px, 12vmin, 80px);
    transform: translateX(-50%);
    border: 3px solid #ffffff;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.18), transparent);
    box-shadow: 0 0 18px rgba(255,255,255,0.35);
    pointer-events: none;
}
.goal-mouth::before,
.goal-mouth::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 3px;
    height: 100%;
    background: #ffffff;
}
.goal-mouth::before { left: 0; }
.goal-mouth::after { right: 0; }

.goal-text {
    position: absolute;
    left: 50%;
    top: 14%;
    transform: translateX(-50%) scale(0.4);
    font-size: clamp(28px, 9vmin, 64px);
    font-weight: 900;
    color: #FFD700;
    letter-spacing: 2px;
    text-shadow:
        -3px -3px 0 #000, 3px -3px 0 #000,
        -3px  3px 0 #000, 3px  3px 0 #000,
        0 0 18px rgba(255,215,0,0.9);
    opacity: 0;
    pointer-events: none;
    animation: goal-pop 12s ease-out forwards;
}
@keyframes goal-pop {
    0%, 82%  { opacity: 0; transform: translateX(-50%) scale(0.4); }
    84%      { opacity: 1; transform: translateX(-50%) scale(1.35); }
    88%      { opacity: 1; transform: translateX(-50%) scale(1.0); }
    96%      { opacity: 1; transform: translateX(-50%) scale(1.1); }
    100%     { opacity: 1; transform: translateX(-50%) scale(1.0); }
}
.messi-runner svg.messi-svg { width: 100%; height: auto; display: block; }
.messi-label {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    color: #ffffff;
    font-size: clamp(11px, 2.6vmin, 15px);
    font-weight: 800;
    white-space: nowrap;
    text-shadow:
        -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000,
        -1.5px  1.5px 0 #000, 1.5px  1.5px 0 #000,
        0 0 8px rgba(0,0,0,0.9);
    pointer-events: none;
}
.dribble-ball {
    position: absolute;
    right: -18%;
    bottom: -4%;
    width: 34%;
    animation: ball-bounce .28s ease-in-out infinite alternate;
}
.dribble-ball svg {
    width: 100%;
    height: auto;
    display: block;
    animation: ball-spin .5s linear infinite;
}
@keyframes ball-bounce {
    from { transform: translateY(0); }
    to   { transform: translateY(-22%); }
}
@keyframes ball-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes messi-dribble {
    0%   { left: 50%; top: 92%; transform: translate(-50%, -50%) rotate(0deg); }
    8%   { left: 30%; top: 80%; transform: translate(-50%, -50%) rotate(-10deg); }
    16%  { left: 70%; top: 68%; transform: translate(-50%, -50%) rotate(10deg); }
    24%  { left: 28%; top: 56%; transform: translate(-50%, -50%) rotate(-10deg); }
    32%  { left: 72%; top: 44%; transform: translate(-50%, -50%) rotate(10deg); }
    40%  { left: 30%; top: 34%; transform: translate(-50%, -50%) rotate(-10deg); }
    48%  { left: 68%; top: 26%; transform: translate(-50%, -50%) rotate(10deg); }
    56%  { left: 34%; top: 18%; transform: translate(-50%, -50%) rotate(-8deg); }
    64%  { left: 60%; top: 12%; transform: translate(-50%, -50%) rotate(6deg); }
    72%  { left: 50%; top: 8%;  transform: translate(-50%, -50%) rotate(0deg); }
    80%  { left: 50%; top: 6%;  transform: translate(-50%, -50%) scale(1.05) rotate(0deg); }
    83%  { left: 50%; top: 6%;  transform: translate(-50%, -50%) scale(1.0) rotate(0deg); }
    86%  { left: 50%; top: 6%;  transform: translate(-50%, -50%) scale(1.2) rotate(0deg); }
    90%  { left: 50%; top: 6%;  transform: translate(-50%, -50%) scale(1.0) rotate(0deg); }
    93%  { left: 50%; top: 6%;  transform: translate(-50%, -50%) scale(1.15) rotate(0deg); }
    100% { left: 50%; top: 6%;  transform: translate(-50%, -50%) scale(1.0) rotate(0deg); }
}

.dribble-hint {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    font-weight: 600;
    background: rgba(0,0,0,0.4);
    padding: 5px 12px;
    border-radius: 999px;
    pointer-events: none;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .walk-mascot { height: 90px; overflow: visible; }
    .walk-char { width: 40px; height: 52px; bottom: 4px; }
    .walk-label { font-size: 11px; bottom: 58px; z-index: 10; }
}
@media (max-width: 480px) {
    .fight-scene { width: 160px; height: 70px; }
    .fighter { width: 44px; height: 58px; }
}

@media (max-width: 480px) {
    .chat-mascot-wrap {
        bottom: 84px;
        right: 12px;
    }
    .chat-mascot {
        width: 52px;
        height: 52px;
    }
    .chat-mascot-bubble {
        max-width: 180px;
        font-size: 12px;
    }
}

/* ============================================================
   FLOATING BUTTON
   ============================================================ */
.chat-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5), 0 0 0 0 rgba(99, 102, 241, 0.5);
    z-index: 9998;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chat-pulse 2.5s infinite;
}
.chat-widget-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 14px 34px rgba(99, 102, 241, 0.7);
    animation: none;
}
.chat-widget-btn.hidden { display: none; }
@keyframes chat-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(99,102,241,0.5), 0 0 0 0 rgba(99,102,241,0.5); }
    50%      { box-shadow: 0 8px 24px rgba(99,102,241,0.5), 0 0 0 12px rgba(99,102,241,0); }
}

.chat-widget-btn .chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0a0e1a;
    animation: badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chat-widget-btn .chat-badge.hidden { display: none; }
@keyframes badge-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* ============================================================
   PANEL CHAT
   ============================================================ */
.chat-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 130px);
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(99,102,241,0.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #e5e7eb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}
.chat-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-panel-header {
    padding: 16px 18px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.chat-panel-header .avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.chat-panel-header .info {
    flex: 1;
    min-width: 0;
}
.chat-panel-header .title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-panel-header .subtitle {
    font-size: 11.5px;
    color: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
@keyframes chat-dot-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}
.chat-panel-header .close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.chat-panel-header .close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.08);
}

/* ============================================================
   CHAT BODY
   ============================================================ */
.chat-body {
    flex: 1 1 0;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(15, 23, 42, 0.5);
    scroll-behavior: smooth;
}
.chat-body::-webkit-scrollbar { width: 8px; }
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.4);
    border-radius: 5px;
}

/* ============================================================
   CHAT BODY WRAP + SCROLL BUTTONS
   ============================================================ */
.chat-body-wrap {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-scroll-btn {
    position: absolute;
    right: 8px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.85);
    backdrop-filter: blur(8px);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: all 0.2s;
    opacity: 0.85;
}
.chat-scroll-btn:hover { opacity: 1; transform: scale(1.08); }
.chat-scroll-btn:active { transform: scale(0.95); }
.chat-scroll-up { top: 8px; }
.chat-scroll-down { bottom: 8px; }

.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    animation: msg-in 0.25s ease;
}
@keyframes msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg.admin {
    align-self: flex-start;
    background: rgba(148, 163, 184, 0.15);
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-bottom-left-radius: 4px;
    position: relative;
}
.chat-msg.admin::before {
    content: '🧑‍💼 Deon';
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    opacity: 0.85;
}

/* ============================================================
   SYSTEM / AI MESSAGE BUBBLE
   ============================================================ */
.chat-msg.system {
    align-self: flex-start;
    background: rgba(99, 102, 241, 0.1);
    color: #e5e7eb;
    border: 1px solid rgba(99, 102, 241, 0.3);
    font-size: 13px;
    text-align: left;
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    font-style: normal;
    position: relative;
    line-height: 1.55;
}
.chat-msg.system::before {
    content: '🤖 AI Assistant';
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: #a5b4fc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    opacity: 0.85;
}
.chat-msg.system a {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px 2px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #c4b5fd;
    text-decoration: none;
    font-weight: 600;
    font-size: 12.5px;
    border-radius: 999px;
    transition: all 0.15s ease;
    word-break: break-all;
}
.chat-msg.system a:hover {
    background: rgba(99, 102, 241, 0.35);
    border-color: #818cf8;
    color: #fff;
    transform: translateY(-1px);
}
.chat-msg.system strong,
.chat-msg.system b {
    color: #fff;
    font-weight: 700;
}
.chat-msg.system code {
    background: rgba(99, 102, 241, 0.2);
    color: #c4b5fd;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Courier New', monospace;
    font-size: 12.5px;
    letter-spacing: 1px;
}
.chat-msg.system s {
    opacity: 0.6;
    color: var(--text-dim);
}

/* ============================================================
   MESSAGE TIME
   ============================================================ */
.chat-msg .time {
    display: block;
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

/* ============================================================
   CHAT FORM
   ============================================================ */
.chat-form {
    padding: 12px;
    background: rgba(17, 24, 39, 0.95);
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}
.chat-form input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.8);
    border: 1.5px solid rgba(99, 102, 241, 0.25);
    border-radius: 20px;
    color: #fff;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}
.chat-form input[type="text"]:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: rgba(15, 23, 42, 0.95);
}
.chat-form input[type="text"]::placeholder {
    color: var(--text-muted);
}
.chat-form button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}
.chat-form button:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}
.chat-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* [FIX] Tombol attach khusus — beda dari tombol kirim */
.chat-form .chat-attach-btn {
    background: rgba(99, 102, 241, 0.15);
    border: 1.5px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    box-shadow: none;
}
.chat-form .chat-attach-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: #6366f1;
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

/* ============================================================
   ATTACH PREVIEW
   ============================================================ */
.chat-attach-preview {
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.08);
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}
.chat-attach-preview .attach-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    overflow: hidden;
    flex-shrink: 0;
}
.chat-attach-preview .attach-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.chat-attach-preview .attach-info { flex: 1; min-width: 0; }
.chat-attach-preview .attach-fname {
    color: #e5e7eb;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-attach-preview .attach-fsize {
    color: var(--text-dim);
    font-size: 11px;
}
.chat-attach-preview .attach-remove {
    background: transparent;
    border: none;
    color: #f87171;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    flex-shrink: 0;
}

/* ============================================================
   START SCREEN
   ============================================================ */
.chat-start {
    flex: 1 1 0;
    min-height: 0;
    padding: 30px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
}
.chat-start .big-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.4);
    margin-bottom: 6px;
}
.chat-start h3 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}
.chat-start p {
    font-size: 12.5px;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0 0 8px;
}
.chat-start input[type="text"] {
    width: 100%;
    padding: 11px 14px;
    background: rgba(15, 23, 42, 0.8);
    border: 1.5px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    color: #fff;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    text-align: center;
    transition: all 0.2s;
}
.chat-start input[type="text"]:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.chat-start .start-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}
.chat-start .start-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(99, 102, 241, 0.6);
}
.chat-start .start-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================================
   RESPONSIVE (HP)
   ============================================================ */
/* Cegah pull-to-refresh saat chat terbuka di HP */
body.chat-open {
    overflow: hidden;
    overscroll-behavior: none;
    position: fixed;
    width: 100%;
    height: 100%;
}

@media (max-width: 480px) {
    .chat-widget-btn {
        width: 54px;
        height: 54px;
        font-size: 22px;
        bottom: 18px;
        right: 18px;
    }
    .chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }
    .chat-panel-header { border-radius: 0; padding-top: 20px; }
}

/* ============================================================
   STATUS DOT DI HEADER WIDGET
   ============================================================ */
.chat-panel-header .subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-panel-header .subtitle::before { display: none; }

.chat-panel-header .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}
.chat-panel-header .status-dot.online {
    background: #34d399;
    box-shadow: 0 0 6px #34d399;
    animation: chat-dot-pulse 2s infinite;
}
.chat-panel-header .status-dot.busy {
    background: #fbbf24;
    box-shadow: 0 0 6px #fbbf24;
}
.chat-panel-header .status-dot.offline {
    background: #94a3b8;
    box-shadow: none;
}

/* ============================================================
   TOAST NOTIFICATION — Modern
   ============================================================ */
.chat-toast-wrap {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: calc(100vw - 40px);
}

.chat-toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 380px;
    padding: 14px 16px;
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #e5e7eb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 13.5px;
    line-height: 1.5;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    position: relative;
    overflow: hidden;
}
.chat-toast.show {
    transform: translateX(0);
    opacity: 1;
}
.chat-toast.hide {
    transform: translateX(120%);
    opacity: 0;
}

.chat-toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #6366f1;
}
.chat-toast.error::before   { background: #ef4444; }
.chat-toast.warning::before { background: #fbbf24; }
.chat-toast.success::before { background: #34d399; }
.chat-toast.info::before    { background: #6366f1; }

.chat-toast .toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1.2;
}
.chat-toast .toast-body {
    flex: 1;
    min-width: 0;
}
.chat-toast .toast-title {
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    margin-bottom: 2px;
}
.chat-toast .toast-msg {
    font-size: 12.5px;
    color: var(--text-dim);
    word-wrap: break-word;
    white-space: pre-line;
}
.chat-toast .toast-close {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s;
}
.chat-toast .toast-close:hover {
    color: #fff;
}
.chat-toast .toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: rgba(99, 102, 241, 0.6);
    animation: toast-progress linear forwards;
}
.chat-toast.error .toast-progress   { background: rgba(239, 68, 68, 0.7); }
.chat-toast.warning .toast-progress { background: rgba(251, 191, 36, 0.7); }
.chat-toast.success .toast-progress { background: rgba(52, 211, 153, 0.7); }

@keyframes toast-progress {
    from { width: 100%; }
    to   { width: 0%; }
}

@media (max-width: 480px) {
    .chat-toast-wrap {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    .chat-toast {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
}

/* ============================================================
   TYPING INDICATOR
   ============================================================ */
.typing-indicator {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 12px 14px !important;
    max-width: 72px !important;
    min-height: auto !important;
}
.typing-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typing-bounce 1.2s infinite;
}
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ============================================================
   BOT MENU
   ============================================================ */
.chat-msg.system .bot-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
}
.bot-menu-btn {
    padding: 7px 12px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #c4b5fd;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}
.bot-menu-btn:hover {
    background: rgba(99, 102, 241, 0.35);
    border-color: #818cf8;
    color: #fff;
    transform: translateY(-1px);
}
.bot-menu-btn:active { transform: translateY(0); }

/* ============================================================
   ATTACHMENT (di bubble)
   ============================================================ */
.chat-msg .attachment-img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    border-radius: 8px;
    margin-top: 6px;
    cursor: zoom-in;
    background: rgba(0,0,0,0.2);
}
.chat-msg .attachment-pdf {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    margin-top: 6px;
    color: inherit;
    text-decoration: none;
    font-size: 12px;
}
.chat-msg .attachment-pdf:hover { background: rgba(0,0,0,0.35); }

/* Link di bubble user & admin */
.chat-msg.user a,
.chat-msg.admin a {
    color: #c4b5fd;
    text-decoration: underline;
    word-break: break-all;
    font-weight: 600;
}
.chat-msg.user a:hover,
.chat-msg.admin a:hover {
    color: #e9d5ff;
}

/* Link di bubble admin (background ungu) — warna kontras */
.chat-msg.admin a {
    color: #fff;
    text-decoration: underline;
}
.chat-msg.admin a:hover {
    color: #e9d5ff;
}

/* Link → tombol di bubble chat */
.chat-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 10px;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transition: all 0.2s;
    word-break: normal;
}
.chat-link-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.6);
    color: #fff !important;
}

/* ============================================================
   QUICK COMMANDS (user chat)
   ============================================================ */
.chat-quickcmds {
    display: none;
    gap: 6px;
    padding: 8px 12px 0;
    flex-wrap: wrap;
    background: rgba(17, 24, 39, 0.95);
    border-top: 1px solid rgba(99, 102, 241, 0.15);
    flex-shrink: 0;
}
.quick-cmd-btn {
    padding: 5px 10px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 999px;
    color: #a5b4fc;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.quick-cmd-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
    color: #fff;
}
.slash-menu {
    position: absolute;
    bottom: 110px;
    left: 12px;
    right: 12px;
    background: #1e293b;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 200;
    display: none;
}
.slash-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.slash-item:hover { background: rgba(99,102,241,0.15); color: #fff; }

/* ============================================================
   [NEW] INPUT WA DI START SCREEN
   ============================================================ */
.chat-start input[type="tel"] {
    width: 100%;
    padding: 11px 14px;
    background: rgba(15, 23, 42, 0.8);
    border: 1.5px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    color: #fff;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    text-align: center;
    transition: all 0.2s;
}
.chat-start input[type="tel"]:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.chat-start input::placeholder {
    color: var(--text-muted);
}

/* ============================================================
   EMOJI PICKER (user chat)
   ============================================================ */
.emoji-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.15);
    border: 1.5px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: none;
}
.emoji-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: #6366f1;
    color: #fff;
    transform: scale(1.05);
}
.emoji-picker {
    position: absolute;
    bottom: 60px;
    right: 12px;
    background: #1e293b;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    display: none;
    z-index: 200;
    max-width: 280px;
}
.emoji-picker.show { display: block; }
.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
}
.emoji-picker-grid button {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
    color: #fff;
}
.emoji-picker-grid button:hover { background: rgba(99,102,241,0.15); }
