/* Public website student chat widget */
#sc-widget * { box-sizing: border-box; }

#sc-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99999;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#sc-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: #0d6efd;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease;
}
#sc-toggle:hover { transform: scale(1.06); }

#sc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
    display: none;
}

#sc-panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
    display: none;
    flex-direction: column;
    overflow: hidden;
}
#sc-widget.sc-open #sc-panel { display: flex; }

#sc-header {
    background: #0d6efd;
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
#sc-header .sc-title { font-weight: 600; font-size: 15px; flex: 1; }
#sc-header button {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
}

#sc-body { flex: 1; overflow-y: auto; background: #f5f6f8; }

.sc-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #8a8f98;
    padding: 12px 14px 4px;
}

.sc-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    cursor: pointer;
    border-bottom: 1px solid #eceef1;
    background: #fff;
    text-decoration: none;
    color: inherit;
}
.sc-list-item:hover { background: #f0f4ff; }
.sc-list-item .sc-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}
.sc-list-item .sc-wa-avatar {
    background: #25d366;
    font-size: 18px;
}
.sc-list-item .sc-item-body { flex: 1; min-width: 0; }
.sc-list-item .sc-item-title { font-size: 14px; font-weight: 600; color: #222; }
.sc-list-item .sc-item-preview {
    font-size: 12px; color: #77808a;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sc-delete-btn {
    border: none;
    background: transparent;
    color: #a0a6ad;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1;
}
.sc-delete-btn:hover {
    background: #ffe8e8;
    color: #dc3545;
}

#sc-messages { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.sc-msg { max-width: 80%; padding: 8px 11px; border-radius: 12px; font-size: 13px; line-height: 1.35; word-wrap: break-word; }
.sc-msg.sc-them { align-self: flex-start; background: #fff; color: #222; border: 1px solid #e6e8eb; border-bottom-left-radius: 4px; }
.sc-msg.sc-me { align-self: flex-end; background: #0d6efd; color: #fff; border-bottom-right-radius: 4px; }
.sc-msg .sc-msg-name { font-size: 11px; font-weight: 600; opacity: .8; margin-bottom: 2px; }
.sc-msg .sc-msg-time { font-size: 10px; opacity: .65; margin-top: 3px; text-align: right; }

#sc-footer { border-top: 1px solid #e6e8eb; background: #fff; padding: 8px; display: none; gap: 6px; align-items: flex-end; }
#sc-widget.sc-in-chat #sc-footer { display: flex; }
#sc-attach {
    border: none;
    background: transparent;
    color: #667781;
    width: 34px;
    height: 38px;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
}
#sc-attach:hover { color: #0d6efd; }
#sc-input { flex: 1; border: 1px solid #d5d9de; border-radius: 20px; padding: 8px 12px; font-size: 13px; resize: none; outline: none; max-height: 90px; }
#sc-send { border: none; background: #0d6efd; color: #fff; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 15px; flex-shrink: 0; }
#sc-send:disabled { opacity: .6; cursor: not-allowed; }

#sc-attach-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f0f4ff;
    border-top: 1px solid #e6e8eb;
    font-size: 12px;
    color: #333;
}
#sc-attach-preview.sc-hidden { display: none !important; }
#sc-attach-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#sc-attach-clear {
    border: none;
    background: transparent;
    color: #667781;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.sc-msg-media img,
.sc-msg-media video {
    display: block;
    max-width: 100%;
    max-height: 180px;
    border-radius: 8px;
}
.sc-msg-audio { width: 100%; max-width: 220px; margin-top: 2px; }
.sc-msg-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}
.sc-msg.sc-me .sc-msg-file { color: #fff; }
.sc-msg.sc-them .sc-msg-file { color: #0d6efd; }

#sc-name-form { padding: 16px 14px; }
#sc-name-form p { font-size: 13px; color: #555; margin: 0 0 10px; }
#sc-name-form input { width: 100%; border: 1px solid #d5d9de; border-radius: 8px; padding: 9px 11px; font-size: 13px; margin-bottom: 8px; outline: none; }
#sc-name-form button { width: 100%; border: none; background: #0d6efd; color: #fff; padding: 9px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.sc-form-error { color: #dc3545; font-size: 12px; margin: 0 0 8px; }

.sc-empty { padding: 20px 14px; text-align: center; color: #8a8f98; font-size: 13px; }
.sc-hidden { display: none !important; }
#sc-back { display: none; }
#sc-widget.sc-in-chat #sc-back { display: inline-block; }
