/* ================================================
   cs/style.css — Grid Survival Customer Service
   Tema: selaras dengan main website theme
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --brand:       #9b59b6;
    --brand-2:     #1abc9c;
    --brand-dark:  #7d3c98;
    --c-green:     #2ecc71;
    --c-red:       #e74c3c;
    --c-yellow:    #f1c40f;
    --bg:          #1a1d2e;
    --surface:     #252840;
    --surface2:    #1e2139;
    --border:      rgba(155,89,182,0.25);
    --text:        #ecf0f1;
    --muted:       #aaa;
    --bot-bubble:  #252840;
    --user-bubble: #9b59b6;
    --shadow:      0 4px 24px rgba(155,89,182,0.15);
    --shadow-lg:   0 8px 40px rgba(155,89,182,0.25);
    --border-r:    16px;
    --border-r-sm: 10px;
    --font-title:  'Fredoka One', cursive;
    --font-body:   'Nunito', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 6px; }

/* ── TOP BAR ── */
.topbar {
    background: var(--surface);
    border-bottom: 3px solid var(--brand);
    box-shadow: 0 4px 16px rgba(155,89,182,0.2);
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.topbar-back {
    width: 36px; height: 36px;
    border: 2px solid var(--border);
    background: var(--surface2);
    border-radius: var(--border-r-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--brand);
    font-size: 1.1em;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
    flex-shrink: 0;
    font-weight: 700;
}
.topbar-back:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

.topbar-avatar {
    width: 40px; height: 40px;
    border-radius: var(--border-r-sm);
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(155,89,182,0.35);
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.topbar-info { flex: 1; min-width: 0; }
.topbar-name {
    font-family: var(--font-title);
    font-size: 1.05rem;
    color: var(--text);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-status {
    font-size: 0.78rem;
    color: var(--c-green);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}
.status-dot {
    width: 7px; height: 7px;
    background: var(--c-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-btn {
    width: 36px; height: 36px;
    border: 1.5px solid var(--border);
    background: var(--surface2);
    border-radius: var(--border-r-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text);
    transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
    flex-shrink: 0;
}
.topbar-btn svg { display: block; pointer-events: none; }
.topbar-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.topbar-btn.off { opacity: 0.35; }
.topbar-btn#btn-report-top { color: var(--brand); border-color: var(--brand); }
.topbar-btn#btn-report-top:hover { background: var(--brand); color: #fff; }

/* ── CHAT AREA ── */
.chat-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    min-height: 0;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.date-sep {
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    position: relative;
}
.date-sep::before, .date-sep::after {
    content: '';
    position: absolute;
    top: 50%; width: 30%;
    height: 1px;
    background: var(--border);
}
.date-sep::before { left: 0; }
.date-sep::after  { right: 0; }

/* Message row */
.msg-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    animation: msgSlide 0.3s ease-out both;
}
.msg-row.user { flex-direction: row-reverse; }

.msg-avatar {
    width: 34px; height: 34px;
    border-radius: var(--border-r-sm);
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(155,89,182,0.25);
}
.msg-avatar img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.msg-row.user .msg-avatar { display: none; }

.msg-content { max-width: 72%; display: flex; flex-direction: column; gap: 4px; }
.msg-row.user .msg-content { align-items: flex-end; }

.msg-name {
    font-size: 0.73rem;
    color: var(--muted);
    font-weight: 700;
    padding: 0 4px;
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: var(--border-r);
    font-size: 0.93rem;
    line-height: 1.6;
    word-break: break-word;
    box-shadow: var(--shadow);
    position: relative;
}
.msg-row.bot .msg-bubble {
    background: var(--bot-bubble);
    color: var(--text);
    border-bottom-left-radius: 4px;
    border: 2px solid var(--border);
}
.msg-row.user .msg-bubble {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 0.7rem;
    color: var(--muted);
    padding: 0 4px;
}

/* Typing indicator */
.typing-row { display: flex; gap: 10px; align-items: flex-end; }
.typing-bubble {
    background: var(--bot-bubble);
    border: 2px solid var(--border);
    border-radius: var(--border-r);
    border-bottom-left-radius: 4px;
    padding: 14px 18px;
    display: flex;
    gap: 5px;
    align-items: center;
    box-shadow: var(--shadow);
}
.typing-bubble span {
    width: 7px; height: 7px;
    background: var(--brand);
    border-radius: 50%;
    animation: typDot 1.2s ease-in-out infinite;
    opacity: 0.5;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

/* Quick replies */
.quick-section {
    padding: 0 0 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.quick-chip {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 7px 16px;
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--brand);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(155,89,182,0.1);
}
.quick-chip:hover {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(155,89,182,0.3);
}

/* ── REPORT CARDS ── */
.report-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 4px 0 12px;
}
.report-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--border-r);
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    box-shadow: var(--shadow);
}
.report-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand);
}
.report-card-icon { font-size: 1.6em; display: block; margin-bottom: 6px; }
.report-card-label { font-family: var(--font-title); font-size: 0.95rem; color: var(--text); display: block; }
.report-card-sub   { font-size: 0.74rem; color: var(--muted); display: block; margin-top: 2px; font-weight: 600; }

/* ── INPUT AREA WRAP ── */
.input-area-wrap {
    flex-shrink: 0;
    background: var(--surface);
    border-top: 3px solid var(--border);
}

/* ── INPUT BAR ── */
.input-bar {
    padding: 10px 16px 16px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.input-bar textarea {
    flex: 1;
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: var(--border-r);
    padding: 11px 16px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text);
    outline: none;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    line-height: 1.5;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input-bar textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(155,89,182,0.15);
}
.input-bar textarea::placeholder { color: var(--muted); }

.send-btn {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    border: none;
    border-radius: var(--border-r-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 1.1em;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-shadow: 0 4px 14px rgba(155,89,182,0.4);
}
.send-btn:hover { transform: scale(1.07); box-shadow: 0 6px 20px rgba(155,89,182,0.5); }
.send-btn:active { transform: scale(0.97); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── REPORT MODAL ── */
.modal-bg {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-bg.open { display: flex; }

.modal-card {
    background: var(--surface);
    border: 3px solid var(--border);
    border-radius: var(--border-r);
    padding: 28px;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalPop 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.modal-icon {
    width: 44px; height: 44px;
    border-radius: var(--border-r-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4em;
    flex-shrink: 0;
}
.modal-icon.bug   { background: rgba(231,76,60,0.15); }
.modal-icon.saran { background: rgba(241,196,15,0.15); }
.modal-title-text {
    font-family: var(--font-title);
    font-size: 1.15rem;
    color: var(--text);
}
.modal-close {
    margin-left: auto;
    width: 32px; height: 32px;
    border: 2px solid var(--border);
    background: var(--surface2);
    border-radius: 8px;
    cursor: pointer;
    color: var(--muted);
    font-size: 1em;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.modal-close:hover { background: rgba(231,76,60,0.2); color: var(--c-red); border-color: var(--c-red); }

/* Type toggle */
.type-toggle {
    display: flex;
    background: var(--surface2);
    border-radius: var(--border-r-sm);
    padding: 4px;
    gap: 4px;
    margin-bottom: 20px;
    border: 2px solid var(--border);
}
.type-btn {
    flex: 1;
    padding: 9px;
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    color: var(--muted);
    transition: all 0.2s;
}
.type-btn.active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 8px rgba(155,89,182,0.3);
}

/* Form fields */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.field select,
.field input,
.field textarea {
    width: 100%;
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: var(--border-r-sm);
    padding: 11px 14px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    resize: vertical;
    appearance: none;
}
.field select:focus,
.field input:focus,
.field textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(155,89,182,0.15);
}
.field select option { background: var(--surface); }

.submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--brand);
    border: 3px solid var(--brand);
    border-radius: var(--border-r-sm);
    color: #fff;
    font-family: var(--font-title);
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
    box-shadow: 0 4px 14px rgba(155,89,182,0.35);
    margin-top: 6px;
    letter-spacing: 0.5px;
}
.submit-btn:hover { background: #e91e8c; border-color: #e91e8c; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(233,30,140,0.4); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Success state */
.modal-success {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 0 8px;
    text-align: center;
}
.modal-success.show { display: flex; }
.success-icon {
    width: 64px; height: 64px;
    border-radius: var(--border-r);
    background: rgba(46,204,113,0.15);
    border: 2px solid rgba(46,204,113,0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8em;
}
.success-title { font-family: var(--font-title); font-size: 1.1rem; color: var(--text); }
.success-msg { font-size: 0.87rem; color: var(--muted); line-height: 1.6; font-weight: 600; }

/* ── ANIMATIONS ── */
@keyframes msgSlide {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes typDot {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50%       { transform: translateY(-4px); opacity: 1; }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}
@keyframes modalPop {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 500px) {
    .report-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
    .modal-card { padding: 20px; border-radius: var(--border-r-sm); }
}

/* ── LIHAT SEMUA GAME BAR ── */
.see-all-bar {
    display: flex;
    justify-content: center;
    padding: 8px 16px 4px;
    background: var(--bg);
}
.see-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    padding: 8px 20px;
    border-radius: 999px;
    text-decoration: none;
    transition: opacity 0.18s, transform 0.18s;
}
.see-all-btn:hover { opacity: 0.88; transform: translateY(-1px); }

/* ── TTS REPLAY BTN ── */
.msg-meta { display:flex; align-items:center; gap:8px; margin-top:4px; }
.msg-time { font-size:0.72rem; color:var(--muted); }
.tts-replay {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.5;
    padding: 0;
    line-height: 1;
    transition: opacity 0.15s;
}
.tts-replay:hover { opacity: 1; }

/* ── TICKET BOX ── */
.ticket-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 14px;
    background: var(--surface);
    border: 1.5px solid var(--brand);
    border-radius: 10px;
    padding: 12px 20px;
}
.ticket-label {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.ticket-number {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--brand);
    letter-spacing: 1.5px;
}
.ticket-note {
    font-size: 0.72rem;
    color: var(--muted);
    text-align: center;
}

/* ── ATTACH BUTTON ── */
.attach-btn {
    width: 44px; height: 44px;
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: var(--border-r-sm);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--muted);
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.attach-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ── UPLOAD PREVIEW BAR (above input) ── */
.upload-preview-bar {
    background: var(--surface2);
    border-bottom: 2px solid var(--border);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}
.upload-preview-inner {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}
.preview-item {
    position: relative;
    width: 56px; height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}
.preview-item img {
    width: 100%; height: 100%; object-fit: cover;
}
.preview-video-icon {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    color: var(--brand);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 4px;
    text-align: center;
    line-height: 1.2;
}
.preview-remove {
    position: absolute; top: 2px; right: 2px;
    width: 18px; height: 18px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 0.65rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}
.upload-clear-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.upload-clear-btn:hover { background: rgba(231,76,60,0.15); color: var(--c-red); border-color: var(--c-red); }

/* ── BUBBLE MEDIA (gambar/video dalam chat bubble) ── */
.bubble-media {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.bubble-img {
    width: 140px; height: 100px;
    object-fit: cover;
    border-radius: 10px;
    cursor: zoom-in;
    border: 2px solid rgba(255,255,255,0.1);
    transition: transform 0.15s;
}
.bubble-img:hover { transform: scale(1.03); }
.bubble-video {
    width: 220px;
    max-height: 150px;
    border-radius: 10px;
    background: #000;
}

/* ── LIGHTBOX ── */
.lightbox {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.lightbox img {
    max-width: 100%; max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.7);
}
.lb-close {
    position: absolute; top: 16px; right: 16px;
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.lb-close:hover { background: rgba(231,76,60,0.7); }

/* ── MODAL UPLOAD ── */
.modal-upload-area {
    background: var(--surface2);
    border: 2px dashed var(--border);
    border-radius: var(--border-r-sm);
    padding: 14px;
    text-align: center;
}
.modal-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--brand);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 6px 0;
    transition: opacity 0.15s;
}
.modal-upload-label:hover { opacity: 0.75; }
.modal-upload-label span { color: var(--muted); font-weight: 600; }
.modal-upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
}
.preview-item-sm {
    position: relative;
    width: 52px; height: 52px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}
.preview-item-sm img { width: 100%; height: 100%; object-fit: cover; }
.preview-video-icon-sm {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.55rem; font-weight: 700;
    color: var(--brand);
    padding: 4px;
    text-align: center;
}

/* ── REPORT CARD ICON (SVG) ── */
.report-card-icon-svg {
    display: block;
    margin-bottom: 8px;
    color: var(--brand);
}
