/* ===== SITE CHAT - Styles ===== */

/* --- User Chat Layout --- */
.scwt-user-chat {
    display: flex;
    gap: 0;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    min-height: 500px;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.scwt-sidebar {
    width: 300px;
    border-right: 1px solid #e0e0e0;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

.scwt-sidebar h3 {
    padding: 16px;
    margin: 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 16px;
}

.scwt-new-conv-btn {
    margin: 12px;
    padding: 10px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.scwt-new-conv-btn:hover {
    background: #005a87;
}

.scwt-conv-list {
    flex: 1;
    overflow-y: auto;
}

.scwt-conv-item {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.scwt-conv-item:hover {
    background: #e9ecef;
}

.scwt-conv-item.active {
    background: #007cba;
    color: white;
}

.scwt-conv-item.active .scwt-conv-preview,
.scwt-conv-item.active .scwt-conv-meta {
    color: rgba(255,255,255,0.8);
}

.scwt-conv-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.scwt-conv-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.scwt-status-open { background: #28a745; }
.scwt-status-closed { background: #dc3545; }
.scwt-status-waiting { background: #ffc107; }

.scwt-conv-source {
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.6;
}

.scwt-conv-preview {
    margin: 0;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scwt-conv-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 11px;
    color: #999;
}

.scwt-badge {
    background: #dc3545;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
}

/* --- Chat Area --- */
.scwt-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.scwt-chat-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    background: #f8f9fa;
}

.scwt-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scwt-message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.scwt-message-client {
    align-self: flex-end;
    background: #007cba;
    color: white;
    border-bottom-right-radius: 4px;
}

.scwt-message-admin,
.scwt-message-system,
.scwt-message-whatsapp,
.scwt-message-telegram {
    align-self: flex-start;
    background: #f1f3f4;
    color: #333;
    border-bottom-left-radius: 4px;
}

.scwt-message-header {
    font-size: 11px;
    margin-bottom: 4px;
    opacity: 0.7;
}

.scwt-message-time {
    margin-left: 8px;
}

.scwt-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.scwt-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
}

.scwt-input-area textarea:focus {
    outline: none;
    border-color: #007cba;
}

.scwt-input-area button {
    padding: 10px 20px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
}

.scwt-input-area button:hover {
    background: #005a87;
}

/* --- Guest Form --- */
.scwt-guest-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.scwt-guest-form h2 {
    margin-top: 0;
    color: #333;
}

.scwt-guest-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
}

.scwt-guest-form input,
.scwt-guest-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

.scwt-guest-form input:focus,
.scwt-guest-form textarea:focus {
    outline: none;
    border-color: #007cba;
}

.scwt-guest-form small {
    color: #888;
    font-size: 12px;
}

.scwt-guest-form button[type="submit"] {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

/* --- Floating Widget --- */
#scwt-floating-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.scwt-floating-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #007cba;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.scwt-floating-btn:hover {
    transform: scale(1.1);
}

.scwt-proactive-bubble {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 240px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    padding: 14px 30px 14px 16px;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    animation: scwt-proactive-in 0.3s ease-out;
}

.scwt-proactive-bubble:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.24);
}

.scwt-proactive-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 13px;
    padding: 4px;
}

.scwt-proactive-close:hover {
    color: #333;
}

@keyframes scwt-proactive-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.scwt-floating-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    height: 480px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.scwt-floating-open .scwt-floating-panel {
    display: flex;
}

.scwt-floating-header {
    padding: 14px 16px;
    background: #007cba;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scwt-floating-header button {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.scwt-floating-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
}

.scwt-floating-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
}

.scwt-floating-input {
    display: flex;
    gap: 8px;
}

.scwt-floating-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
}

.scwt-floating-input button {
    padding: 10px 16px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

/* --- Admin Styles --- */
.scwt-admin .scwt-stats {
    display: flex;
    gap: 16px;
    margin: 20px 0;
}

.scwt-admin .stat-box {
    background: white;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
    min-width: 100px;
}

.scwt-admin .stat-number {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.scwt-admin .stat-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
}

.scwt-admin .stat-open .stat-number { color: #28a745; }
.scwt-admin .stat-closed .stat-number { color: #dc3545; }
.scwt-admin .stat-unread .stat-number { color: #dc3545; }

.scwt-admin .scwt-filters {
    margin: 16px 0;
}

.scwt-admin .scwt-filters .button {
    margin-right: 8px;
}

.scwt-admin .scwt-table {
    margin-top: 16px;
}

.scwt-admin .scwt-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.scwt-admin .scwt-status-open { background: #d4edda; color: #155724; }
.scwt-admin .scwt-status-closed { background: #f8d7da; color: #721c24; }
.scwt-admin .scwt-status-waiting { background: #fff3cd; color: #856404; }
.scwt-admin .scwt-status-success { background: #d4edda; color: #155724; }
.scwt-admin .scwt-status-failed { background: #f8d7da; color: #721c24; }

.scwt-admin .scwt-conv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.scwt-admin .scwt-chat-container {
    background: white;
    border-radius: 8px;
    padding: 16px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.scwt-admin .scwt-reply-box {
    display: flex;
    gap: 12px;
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.scwt-admin .scwt-reply-box textarea {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
}

.scwt-admin .scwt-reply-box button {
    padding: 12px 24px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .scwt-user-chat {
        flex-direction: column;
    }
    .scwt-sidebar {
        width: 100%;
        max-height: 200px;
    }
    .scwt-floating-panel {
        width: calc(100vw - 48px);
        right: -12px;
    }
}
