/**
 * Wisper — Live Chat via Telegram
 * Frontend Widget Styles
 */

#alc-widget {
    --alc-primary: #4f46e5;
    --alc-primary-dark: #4338ca;
}

#alc-widget * {
    box-sizing: border-box;
}

#alc-toggle {
    position: fixed;
    z-index: 999999;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--alc-primary), var(--alc-primary-dark));
    box-shadow: 0 10px 35px color-mix(in srgb, var(--alc-primary) 45%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease;
}

#alc-toggle::before,
#alc-toggle::after,
#alc-toggle .alc-ring {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--alc-primary) 45%, transparent);
    animation: alc-pulse 2.4s infinite;
    pointer-events: none;
}

#alc-toggle::after {
    animation-delay: .8s;
}

#alc-toggle .alc-ring {
    animation-delay: 1.6s;
}

@keyframes alc-pulse {
    0%   { transform: scale(1); opacity: .8; }
    100% { transform: scale(2); opacity: 0; }
}

#alc-toggle:hover {
    transform: scale(1.06);
}

#alc-toggle svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

#alc-toggle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

#alc-unread {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
}

#alc-minimized-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--alc-primary);
    border: 2px solid #fff;
    display: none;
    animation: alc-dot-breathe 2s ease-in-out infinite;
}

@keyframes alc-dot-breathe {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .6; transform: scale(.85); }
}

#alc-panel {
    position: fixed;
    z-index: 999999;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15,23,42,.25);
    display: none;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease;
}

#alc-panel.alc-open {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

#alc-header {
    background: linear-gradient(135deg, var(--alc-primary), var(--alc-primary-dark));
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

#alc-header img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, .22);
}

#alc-header .alc-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

#alc-header .alc-sub {
    font-size: 12px;
    opacity: .85;
    display: flex;
    align-items: center;
    gap: 5px;
}

#alc-header .alc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    display: inline-block;
}

#alc-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

#alc-header .alc-close {
    background: rgba(255, 255, 255, .16);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 1;
    transition: background .15s ease;
}

#alc-header .alc-close:hover {
    background: rgba(255, 255, 255, .28);
}

#alc-header .alc-close svg {
    width: 17px;
    height: 17px;
    fill: #fff;
    display: block;
}

#alc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f8f9fc;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alc-msg {
    max-width: 82%;
    padding: 8px 12px 6px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.alc-msg-text {
    word-break: break-word;
}

.alc-msg-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    line-height: 1;
    margin-top: 4px;
    user-select: none;
}

.alc-msg-time {
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.alc-msg-status {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -1.5px;
    margin-left: 1px;
}

.alc-msg-bot {
    align-self: flex-start;
    background: #fff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.alc-msg-bot .alc-msg-meta {
    align-self: flex-start;
    color: #94a3b8;
}

.alc-msg-user {
    align-self: flex-end;
    background: var(--alc-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.alc-msg-user .alc-msg-meta {
    align-self: flex-end;
    color: rgba(255, 255, 255, 0.72);
}

.alc-msg-user .alc-msg-status.alc-status-sent {
    color: rgba(255, 255, 255, 0.72);
}

.alc-msg-user .alc-msg-status.alc-status-read {
    color: #6ee7b7;
}

.alc-msg-specialist {
    align-self: flex-start;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-bottom-left-radius: 4px;
}

.alc-msg-specialist .alc-msg-meta {
    align-self: flex-start;
    color: #059669;
}

.alc-msg-system {
    align-self: center;
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 10px;
    text-align: center;
}

.alc-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 12px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.alc-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: alc-bounce 1.2s infinite ease-in-out;
}

.alc-typing span:nth-child(2) {
    animation-delay: .15s;
}

.alc-typing span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes alc-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30%           { transform: translateY(-4px); opacity: 1; }
}

#alc-footer {
    padding: 10px;
    border-top: 1px solid #eef0f4;
    flex-shrink: 0;
    background: #fff;
}

#alc-top-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

#alc-specialist-btn {
    flex: 1;
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    padding: 8px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

#alc-specialist-btn:hover {
    background: #d1fae5;
}

#alc-specialist-btn.alc-btn-close {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

#alc-specialist-btn.alc-btn-close:hover {
    background: #fee2e2;
}

.alc-btn-link-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: color .15s ease;
}

.alc-btn-link-close:hover {
    color: #dc2626;
    text-decoration: underline;
}

#alc-offline-banner {
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    text-align: center;
    line-height: 1.4;
}

#alc-specialist-btn:disabled,
#alc-send:disabled,
#alc-input:disabled {
    opacity: .5;
    cursor: not-allowed;
}

#alc-attach-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s ease;
}

#alc-attach-btn:hover {
    background: #f1f5f9;
}

#alc-attach-btn svg {
    width: 19px;
    height: 19px;
}

#alc-input-row {
    display: flex;
    gap: 8px;
}

#alc-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s ease;
}

#alc-input:focus {
    border-color: var(--alc-primary);
}

#alc-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--alc-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s ease;
}

#alc-send:hover {
    background: var(--alc-primary-dark);
}

#alc-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Anti-spam trap field (invisible to humans) */
.wisper-antispam-trap {
    display: none !important;
    position: absolute !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
