/**
 * Customer Support Center - CSS
 * Flutterwave-inspired layout
 * Version 1.0.0
 */

/* ── CSS Variables ─────────────────────────────────────────── */
.sc-plugin-wrap {
    --sc-brand: #F5A623;
    --sc-brand-dark: #D4881A;
    --sc-brand-light: #FFF8EC;
    --sc-text: #111827;
    --sc-text-muted: #6B7280;
    --sc-border: rgba(0,0,0,0.1);
    --sc-bg: #ffffff;
    --sc-bg2: #F9FAFB;
    --sc-bg3: #F3F4F6;
    --sc-radius: 12px;
    --sc-radius-sm: 8px;
    --sc-shadow: 0 4px 24px rgba(0,0,0,0.12);
    --sc-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    width: 420px;
    max-width: 100%;
    height: 620px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.16);
    background: #ffffff;
    position: relative;
}

/* ── HEADER ────────────────────────────────────────────────── */
.sc-header {
    background: #F5A623;
    padding: 20px 20px 34px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.sc-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.sc-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sc-logo-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}
.sc-logo-name {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}
.sc-header-actions {
    display: flex;
    gap: 6px;
}
.sc-hdr-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 14px;
}
.sc-greeting {
    color: #fff;
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 4px;
}
.sc-subline {
    color: rgba(255,255,255,0.85);
    font-size: 13px;
}

/* ── SEARCH ─────────────────────────────────────────────────── */
.sc-search-overlap {
    margin: -20px 16px 0;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}
.sc-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 11px 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.sc-search-box svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #9CA3AF;
}
.sc-search-box input {
    border: none;
    background: transparent;
    flex: 1;
    font-size: 14px;
    color: #111827;
    outline: none;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}
.sc-search-box input::placeholder { color: #6B7280; }
.sc-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 100;
    max-height: 260px;
    overflow-y: auto;
}
.sc-search-result-item {
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}
.sc-search-result-item:last-child { border-bottom: none; }
.sc-search-result-item:hover { background: #F9FAFB; }
.sc-search-result-item .sc-res-cat { font-size: 11px; color: #6B7280; margin-left: auto; }

/* ── NAV TABS ────────────────────────────────────────────────── */
.sc-nav-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 0 12px;
    margin-top: 28px;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
    background: #ffffff;
    z-index: 9;
}
.sc-nav-tabs::-webkit-scrollbar { display: none; }
.sc-nav-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 12px;
    font-size: 12px;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    cursor: pointer;
    color: #6B7280;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}
.sc-nav-tab svg { width: 13px; height: 13px; }
.sc-nav-tab.active {
    color: #D4881A;
    border-bottom-color: #F5A623;
    font-weight: 500;
}
.sc-nav-tab:hover:not(.active) { color: #111827; }

/* ── SCREENS ─────────────────────────────────────────────────── */
.sc-screen { display: none; }
/* Non-chat screens: fill remaining space and scroll */
.sc-screen.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
/* Chat screen overrides */
.sc-screen-chat { display: none; flex-direction: column; }
.sc-screen-chat.active { display: flex; flex: 1; min-height: 0; }
/* Voice screen overrides */
.sc-screen-voice { display: none; }
.sc-screen-voice.active { display: flex; flex-direction: column; align-items: center; flex: 1; overflow-y: auto; min-height: 0; }

/* ── BODY / SHARED ───────────────────────────────────────────── */
.sc-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.sc-section-title {
    font-size: 10px;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}
.sc-footer-note {
    text-align: center;
    padding: 12px 0 4px;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin-top: 12px;
    font-size: 12px;
    color: #6B7280;
}
.sc-link {
    color: #D4881A;
    cursor: pointer;
    font-weight: 500;
}

/* ── QUICK ACTIONS ───────────────────────────────────────────── */
.sc-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 4px;
}
.sc-quick-action {
    background: #F9FAFB;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.sc-quick-action:hover {
    border-color: #F5A623;
    box-shadow: 0 0 0 1px #F5A623;
}
.sc-qa-icon {
    font-size: 20px;
    margin-bottom: 5px;
}
.sc-qa-label {
    font-size: 11px;
    font-weight: 500;
    color: #111827;
    line-height: 1.3;
}

/* ── CATEGORY GRID ───────────────────────────────────────────── */
.sc-category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.sc-category-card {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transition: border-color 0.15s;
}
.sc-category-card:hover { border-color: #F5A623; }
.sc-cat-img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #FFF8EC;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.sc-cat-info { flex: 1; min-width: 0; }
.sc-cat-name { font-size: 12px; font-weight: 500; color: #111827; margin-bottom: 2px; }
.sc-cat-count { font-size: 10px; color: #6B7280; }
.sc-cat-arrow { color: #6B7280; font-size: 14px; margin-top: 2px; }

/* ── POPULAR ARTICLES ────────────────────────────────────────── */
.sc-popular-articles { margin-bottom: 4px; }
.sc-article-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
}
.sc-article-item:last-child { border-bottom: none; }
.sc-article-title { font-size: 13px; color: #111827; flex: 1; }
.sc-article-arrow { font-size: 14px; color: #6B7280; margin-left: 8px; }

/* ── CHAT SCREEN ─────────────────────────────────────────────── */
.sc-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.sc-agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #FFF8EC;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #D4881A;
    position: relative;
    flex-shrink: 0;
}
.sc-online-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
    position: absolute;
    bottom: 0;
    right: 0;
}
.sc-agent-info { flex: 1; }
.sc-agent-name { font-size: 13px; font-weight: 500; color: #111827; }
.sc-agent-status { font-size: 11px; color: #6B7280; }
.sc-chat-hdr-actions { display: flex; gap: 6px; }
.sc-chat-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #F5A623;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    color: #fff;
}

.sc-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
.sc-welcome-msg { display: flex; flex-direction: column; align-items: flex-start; }
.sc-welcome-bubble {
    background: #F9FAFB;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    padding: 10px 14px;
    font-size: 13px;
    color: #111827;
    max-width: 70%;
    line-height: 1.5;
}
.sc-msg-time {
    font-size: 10px;
    color: #6B7280;
    margin-top: 3px;
    padding: 0 2px;
}

/* Chat messages */
.sc-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.sc-msg.sc-msg-agent { justify-content: flex-start; }
.sc-msg.sc-msg-customer { justify-content: flex-end; }
.sc-msg.sc-msg-system { justify-content: center; }
.sc-msg-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #FFF8EC;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #D4881A;
}
.sc-msg-inner { max-width: 70%; }
.sc-msg-bubble {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}
.sc-msg.sc-msg-agent .sc-msg-bubble {
    background: #F9FAFB;
    color: #111827;
    border-bottom-left-radius: 4px;
}
.sc-msg.sc-msg-customer .sc-msg-bubble {
    background: #F5A623;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.sc-msg.sc-msg-system .sc-msg-bubble {
    background: transparent;
    color: #6B7280;
    font-size: 11px;
    font-style: italic;
}
.sc-msg.sc-msg-customer .sc-msg-time { text-align: right; }
.sc-msg-attachment a {
    color: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}
.sc-msg-attachment a:hover { text-decoration: underline; }

/* Typing indicator */
.sc-typing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 0 16px 8px;
    flex-shrink: 0;
}
/* Avatar beside the typing dots — fixed 28px circle, never grows */
.sc-typing-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;   /* prevent flex from shrinking it */
    min-height: 28px;
    border-radius: 50%;
    overflow: hidden;  /* clips the img to the circle */
    background: #FFF8EC;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #D4881A;
    flex-shrink: 0;
}
.sc-typing-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.sc-typing-dots {
    background: #F9FAFB;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    padding: 10px 14px;
    display: flex;
    gap: 4px;
    align-items: center;
}
.sc-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6B7280;
    animation: scTypeBounce 1.2s infinite;
}
.sc-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.sc-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes scTypeBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* CSAT / ended banners */
.sc-chat-ended-banner {
    padding: 10px 16px;
    background: #F9FAFB;
    text-align: center;
    font-size: 12px;
    color: #6B7280;
    border-top: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.sc-csat-prompt {
    padding: 12px 16px;
    text-align: center;
    border-top: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.sc-csat-prompt p { font-size: 12px; color: #6B7280; margin-bottom: 8px; }
.sc-csat-emojis { display: flex; gap: 10px; justify-content: center; font-size: 22px; }
.sc-csat-emojis span { cursor: pointer; transition: transform 0.15s; }
.sc-csat-emojis span:hover { transform: scale(1.2); }

/* Chat input */
.sc-chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.sc-attach-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    color: #6B7280;
    display: flex;
    align-items: center;
}
.sc-chat-input-bar input {
    flex: 1;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    background: #F9FAFB;
    color: #111827;
    outline: none;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    transition: border-color 0.15s;
}
.sc-chat-input-bar input:focus { border-color: #F5A623; }

/* Auto-expanding textarea — collapsed by default, grows on focus/input */
.sc-chat-input-bar textarea#sc-chat-input {
    flex: 1;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    background: #F9FAFB;
    color: #111827;
    outline: none;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    transition: border-color 0.15s, height 0.15s ease;
    resize: none;
    overflow: hidden;
    line-height: 1.45;
    height: 36px;           /* collapsed: visually one line */
    max-height: 120px;
    display: block;
}
.sc-chat-input-bar textarea#sc-chat-input:focus {
    border-color: #F5A623;
}
/* Back button hover state in pre-chat overlay */
#sc-prechat-back:hover { background: #f3f4f6 !important; }
.sc-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #F5A623;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.sc-send-btn:hover { background: #D4881A; }
.sc-send-btn svg { width: 15px; height: 15px; }
.sc-send-btn:disabled { background: #D1D5DB; cursor: not-allowed; }

.sc-restart-bar {
    padding: 10px 16px;
    border-top: 1px solid rgba(0,0,0,0.1);
    text-align: center;
    flex-shrink: 0;
}
.sc-restart-btn {
    background: #10B981;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}

/* ── VOICE SCREEN ────────────────────────────────────────────── */
.sc-voice-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 20px 20px;
    width: 100%;
}
.sc-call-state-label {
    font-size: 10px;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 20px;
}
.sc-call-avatar-ring {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid #F5A623;
    padding: 4px;
    margin-bottom: 14px;
    transition: box-shadow 0.3s;
}
.sc-call-avatar-ring.ringing {
    animation: scRingPulse 1.5s infinite;
}
@keyframes scRingPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,166,35,0.4); }
    50% { box-shadow: 0 0 0 14px rgba(245,166,35,0); }
}
.sc-call-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #FFF8EC;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 600;
    color: #D4881A;
}
.sc-call-agent-name {
    font-size: 18px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 4px;
}
.sc-call-status { font-size: 12px; color: #6B7280; margin-bottom: 6px; }
.sc-call-timer {
    font-size: 26px;
    font-weight: 500;
    color: #111827;
    font-variant-numeric: tabular-nums;
    margin-bottom: 20px;
}
.sc-queue-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: #F9FAFB;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}
.sc-queue-text { font-size: 12px; color: #6B7280; }
.sc-queue-badge {
    background: #FFF8EC;
    color: #D4881A;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 12px;
}
.sc-callback-link {
    font-size: 12px;
    color: #D4881A;
    cursor: pointer;
    text-decoration: underline;
    margin-bottom: 20px;
}
.sc-call-controls {
    display: flex;
    gap: 14px;
    margin-bottom: 20px;
}
.sc-call-ctrl {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}
.sc-call-ctrl-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #F9FAFB;
    border: 1px solid rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    transition: background 0.15s;
}
.sc-call-ctrl-btn:hover { background: #F3F4F6; }
.sc-call-ctrl-btn.active {
    background: #FFF8EC;
    border-color: #F5A623;
}
.sc-call-ctrl-label { font-size: 10px; color: #6B7280; }
.sc-call-cta { margin-bottom: 10px; }
.sc-start-call-btn {
    background: #F5A623;
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    transition: background 0.15s;
}
.sc-start-call-btn:hover { background: #D4881A; }
.sc-end-call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #EF4444;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.sc-end-call-btn svg { width: 24px; height: 24px; }
.sc-post-call-csat {
    text-align: center;
    width: 100%;
}
.sc-post-call-csat p { font-size: 13px; color: #6B7280; margin-bottom: 10px; }

/* ── TICKET SCREEN ───────────────────────────────────────────── */
.sc-ticket-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.sc-ticket-tab {
    flex: 1;
    padding: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    background: #F9FAFB;
    color: #6B7280;
    font-size: 13px;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    cursor: pointer;
    transition: all 0.15s;
}
.sc-ticket-tab.active {
    background: #F5A623;
    color: #fff;
    border-color: #F5A623;
    font-weight: 500;
}

/* Form */
.sc-form-group { margin-bottom: 14px; }
.sc-form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
    margin-bottom: 5px;
}
.sc-form-control {
    width: 100%;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    background: #ffffff;
    color: #111827;
    outline: none;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.sc-form-control:focus { border-color: #F5A623; }
textarea.sc-form-control { min-height: 80px; resize: vertical; }

/* Chips */
.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-chip {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    border: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
    background: #ffffff;
    color: #6B7280;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    transition: all 0.15s;
}
.sc-chip.selected {
    background: #F5A623;
    color: #fff;
    border-color: #F5A623;
}

.sc-submit-btn {
    width: 100%;
    background: #F5A623;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.15s;
}
.sc-submit-btn:hover { background: #D4881A; }
.sc-submit-btn:disabled { background: #D1D5DB; cursor: not-allowed; }

.sc-ticket-success {
    text-align: center;
    padding: 24px 16px;
    background: #F9FAFB;
    border-radius: 8px;
    margin-top: 14px;
}

/* Ticket list */
.sc-ticket-list { display: flex; flex-direction: column; }
.sc-ticket-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
}
.sc-ticket-item:last-child { border-bottom: none; }
.sc-ticket-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #F9FAFB;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}
.sc-ticket-info { flex: 1; min-width: 0; }
.sc-ticket-subject { font-size: 13px; font-weight: 500; color: #111827; }
.sc-ticket-meta { font-size: 11px; color: #6B7280; margin-top: 2px; }
.sc-ticket-status {
    font-size: 10px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
    flex-shrink: 0;
}
.sc-status-open    { background: #FEF3C7; color: #92400E; }
.sc-status-pending { background: #DBEAFE; color: #1E40AF; }
.sc-status-resolved{ background: #D1FAE5; color: #065F46; }
.sc-status-closed  { background: #F3F4F6; color: #374151; }

/* ── KB SCREEN ───────────────────────────────────────────────── */
.sc-kb-category {
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}
.sc-kb-cat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #F9FAFB;
    cursor: pointer;
    user-select: none;
}
.sc-kb-cat-icon { font-size: 15px; }
.sc-kb-cat-name { flex: 1; font-size: 13px; font-weight: 500; color: #111827; }
.sc-kb-cat-count { font-size: 11px; color: #6B7280; }
.sc-kb-cat-toggle { font-size: 12px; color: #6B7280; }
.sc-kb-articles { padding: 0 14px; background: #ffffff; }
.sc-kb-article {
    padding: 9px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-size: 13px;
    color: #D4881A;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sc-kb-article:last-child { border-bottom: none; }
.sc-kb-article:hover { color: #F5A623; }

.sc-suggest-box {
    background: #F9FAFB;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    margin-top: 12px;
}
.sc-suggest-box p { font-size: 13px; color: #6B7280; margin-bottom: 10px; }
.sc-link-btn {
    background: none;
    border: 1px solid #F5A623;
    color: #D4881A;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    cursor: pointer;
    transition: background 0.15s;
}
.sc-link-btn:hover { background: #FFF8EC; }

/* ── ARTICLE VIEWER ──────────────────────────────────────────── */
.sc-screen-article { display: none; }
.sc-screen-article.active { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
.sc-article-header {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}
.sc-back-btn {
    background: none;
    border: none;
    font-size: 13px;
    color: #D4881A;
    cursor: pointer;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    padding: 0;
}
.sc-back-btn:hover { text-decoration: underline; }
#sc-article-content .sc-article-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
    display: block;
}
#sc-article-content .sc-article-body {
    font-size: 13px;
    color: #111827;
    line-height: 1.7;
}
#sc-article-content .sc-article-category {
    font-size: 11px;
    color: #6B7280;
    margin-bottom: 8px;
    display: block;
}

/* ── LOADING / EMPTY ─────────────────────────────────────────── */
.sc-loading {
    text-align: center;
    color: #6B7280;
    font-size: 13px;
    padding: 24px;
}
.sc-empty {
    text-align: center;
    color: #6B7280;
    font-size: 13px;
    padding: 16px;
}

/* ── FLOATING LAUNCHER ───────────────────────────────────────── */
.sc-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}
.sc-launcher-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #F5A623;
    color: #fff;
    border: none;
    border-radius: 28px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    transition: transform 0.15s, box-shadow 0.15s;
}
.sc-launcher-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.sc-launcher-badge {
    background: #EF4444;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ── AGENT DASHBOARD ─────────────────────────────────────────── */
.sc-agent-dashboard {
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    max-width: 1100px;
    margin: 0 auto;
}
.sc-agent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    flex-wrap: wrap;
    gap: 10px;
}
.sc-agent-header h2 { font-size: 20px; font-weight: 600; margin: 0; }
.sc-agent-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.sc-stat-badge {
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    color: #374151;
}
.sc-agent-status-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}
.sc-agent-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 16px;
}
@media (max-width: 680px) {
    .sc-agent-layout { grid-template-columns: 1fr; }
}
.sc-sessions-panel, .sc-agent-chat-panel {
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}
.sc-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #F9FAFB;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}
.sc-panel-header h3 { font-size: 13px; font-weight: 600; margin: 0; }
.sc-panel-header button {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: #6B7280;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
}
.sc-sessions-list, .sc-tickets-panel, .sc-voice-queue-panel {
    max-height: 200px;
    overflow-y: auto;
}
.sc-session-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
    transition: background 0.1s;
}
.sc-session-item:hover, .sc-session-item.active { background: #FFF8EC; }
.sc-session-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #FFF8EC;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #D4881A;
    flex-shrink: 0;
    overflow: hidden;
}
.sc-session-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sc-session-info { flex: 1; min-width: 0; }
.sc-session-name { font-size: 13px; font-weight: 500; color: #111827; }
.sc-session-preview { font-size: 11px; color: #6B7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-session-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.sc-session-time { font-size: 10px; color: #6B7280; }
.sc-unread-badge {
    background: #F5A623;
    color: #fff;
    border-radius: 50%;
    width: 17px;
    height: 17px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.sc-queue-item, .sc-agent-ticket-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-size: 12px;
}
.sc-queue-item:last-child, .sc-agent-ticket-item:last-child { border-bottom: none; }
.sc-callback-badge {
    background: #DBEAFE;
    color: #1E40AF;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

.sc-agent-messages {
    min-height: 340px;
    max-height: 340px;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sc-no-session {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6B7280;
    font-size: 13px;
}
.sc-agent-typing {
    padding: 6px 14px;
    font-size: 11px;
    color: #6B7280;
    font-style: italic;
    border-top: 1px solid rgba(0,0,0,0.1);
}
.sc-agent-reply-bar {
    padding: 10px 14px;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.sc-agent-reply-bar textarea {
    flex: 1;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    outline: none;
    resize: none;
    background: #ffffff;
    color: #111827;
    transition: border-color 0.15s;
}
.sc-agent-reply-bar textarea:focus { border-color: #F5A623; }
.sc-agent-reply-bar button {
    background: #F5A623;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
    cursor: pointer;
    white-space: nowrap;
}
.sc-agent-reply-bar button:hover { background: #D4881A; }

/* ── Language selector ─────────────────────────────────────── */
.sc-lang-wrap {
    display: flex;
    align-items: center;
    gap: 3px;
    position: relative;
}
.sc-lang-icon {
    font-size: 14px;
    line-height: 1;
    pointer-events: none;
    flex-shrink: 0;
}
.sc-lang-select {
    border: none;
    background: rgba(255,255,255,0.2);
    color: #ffffff;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    max-width: 100px;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}
.sc-lang-select option {
    background: #1a1a2e;
    color: #ffffff;
}
.sc-lang-select:hover {
    background: rgba(255,255,255,0.3);
}

/* Agent dashboard language selector (light background) */
.sc-agent-lang-wrap {
    margin-left: auto;
}
.sc-agent-lang-wrap .sc-lang-select {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}
.sc-agent-lang-wrap .sc-lang-select option {
    background: #ffffff;
    color: #111827;
}
.sc-agent-lang-wrap .sc-lang-icon {
    color: #6b7280;
}

/* ── Canvas position variants ──────────────────────────────── */
.sc-canvas-right  { margin-left: auto; margin-right: 0; }
.sc-canvas-left   { margin-left: 0; margin-right: auto; }
.sc-canvas-center { margin-left: auto; margin-right: auto; }

/* ── Floating panel animation ──────────────────────────────── */
@keyframes scSlideUp {
    0%   { opacity: 0; transform: translateY(28px) scale(0.96); }
    60%  { opacity: 1; transform: translateY(-4px)  scale(1.01); }
    80%  { transform: translateY(2px)  scale(0.995); }
    100% { opacity: 1; transform: translateY(0)     scale(1); }
}
@keyframes scSlideDown {
    from { opacity: 1; transform: translateY(0)    scale(1); }
    to   { opacity: 0; transform: translateY(24px) scale(0.97); }
}

#sc-floating-panel {
    transform-origin: bottom right;
    animation-duration: 0.30s;
    animation-fill-mode: both;
    animation-timing-function: ease-out;
}
#sc-floating-panel.sc-panel-open,
#sc-trigger-panel.sc-panel-open {
    animation-name: scSlideUp;
}
#sc-floating-panel.sc-panel-close,
#sc-trigger-panel.sc-panel-close {
    animation-name: scSlideDown;
    animation-timing-function: ease-in;
    animation-duration: 0.18s;
}

/* Floating panel and custom-trigger panel inner widget */
#sc-floating-panel .sc-plugin-wrap,
#sc-trigger-panel .sc-plugin-wrap {
    border-radius: 16px;
    box-shadow: none;
    max-width: 100%;
    margin: 0;
    width: 100%;
    height: 620px;
    max-height: 82vh;
}

/* Floating button hide/show transition */
#sc-floating-btn {
    transition: opacity 0.18s ease, transform 0.18s ease;
}
#sc-floating-btn.sc-btn-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.85);
}

/* Custom icon inside launcher button */
.sc-launcher-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

/* ── Mobile canvas layout ──────────────────────────────────── */
/* Full-width, bottom-anchored, flat bottom corners on mobile  */
@media (max-width: 480px) {
    .sc-plugin-wrap {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;           /* dynamic viewport height avoids address-bar overlap */
        max-height: 100dvh;
        border-radius: 16px 16px 0 0; /* top corners kept, bottom flat */
        margin: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        box-shadow: 0 -4px 24px rgba(0,0,0,0.14);
    }
    /* Floating panel also goes full-width bottom on mobile */
    #sc-floating-panel,
    #sc-trigger-panel {
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        transform: none !important;
        border-radius: 16px 16px 0 0 !important;
    }
    #sc-floating-panel .sc-plugin-wrap,
    #sc-trigger-panel .sc-plugin-wrap {
        border-radius: 16px 16px 0 0;
        height: 100dvh;
        max-height: 100dvh;
    }
}


/*** support chat language select ***/
.sc-lang-select{color:black !important}
.sc-nav-tab.active,.sc-link,.sc-kb-cat-name,.sc-kb-article,.sc-lnk,.sc-admin-nav-item.active,.sc-add-cat-btn,.sc-export-btn:hover{color:#fff !important}
.sc-drp-btn.active{color:#fff !important}
.sc-activity-avatar{color:#fffcf9 !important}
/* sc-admin-panel layout moved to agent-dashboard.css */
#sc-view-tickets .sc-admin-table-wrap .sc-filter-bar,
#sc-view-voice .sc-admin-table-wrap .sc-filter-bar,
#sc-view-chats .sc-admin-table-wrap .sc-filter-bar{flex-wrap:nowrap}
#sc-kb-cat-list .sc-kb-cat-name{color:#c9c4c4 !important}
#sc-kb-cat-list .sc-kb-cat-name .active{color:#fff !important}
#sc-view-chats .sc-filter-bar .sc-export-btn{padding:12px 20px 12px 0}
#sc-chats-search-btn{padding:12px 17px}
#sc-bulk-action{width:116px}
#sc-bulk-apply-btn,
#sc-view-tickets .sc-filter-bar .sc-export-btn{padding-top:12px;padding-bottom:12px}
#sc-view-tickets .sc-filter-bar .sc-export-btn{padding-right:20px}
