/* SmartSupport Pro - Frontend Styles */

:root {
    --ss-primary: #0073aa;
    --ss-primary-dark: #005a87;
    --ss-text: #333;
    --ss-text-light: #666;
    --ss-border: #ddd;
    --ss-bg: #fff;
    --ss-bg-light: #f9f9f9;
    --ss-shadow: 0 4px 12px rgba(0,0,0,0.15);
    --ss-shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
}

.smartsupport-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.smartsupport-widget * {
    box-sizing: border-box;
}

.smartsupport-widget.smartsupport-bottom-right {
    bottom: 20px;
    right: 20px;
}

.smartsupport-widget.smartsupport-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Widget Button */
.smartsupport-widget-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color, var(--ss-primary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--ss-shadow);
    transition: all 0.3s ease;
    position: relative;
}

.smartsupport-widget-button:hover {
    transform: scale(1.1);
    box-shadow: var(--ss-shadow-lg);
}

.smartsupport-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Widget Window */
.smartsupport-widget-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--ss-bg);
    border-radius: 12px;
    box-shadow: var(--ss-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.smartsupport-bottom-right .smartsupport-widget-window {
    right: 0;
}

.smartsupport-bottom-left .smartsupport-widget-window {
    left: 0;
}

/* Header */
.smartsupport-widget-header {
    background: var(--primary-color, var(--ss-primary));
    color: #fff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.smartsupport-header-content h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.smartsupport-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

.smartsupport-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.smartsupport-close-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.smartsupport-close-btn:hover {
    opacity: 1;
}

/* Pre-chat Form */
.smartsupport-pre-chat-form {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

.smartsupport-form-content h4 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: var(--ss-text);
}

.smartsupport-form-content p {
    margin: 0 0 24px 0;
    color: var(--ss-text-light);
}

.smartsupport-form-group {
    margin-bottom: 20px;
}

.smartsupport-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--ss-text);
}

.smartsupport-form-group input,
.smartsupport-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ss-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.smartsupport-form-group input:focus,
.smartsupport-form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color, var(--ss-primary));
}

.smartsupport-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.smartsupport-btn-primary {
    background: var(--primary-color, var(--ss-primary));
    color: #fff;
}

.smartsupport-btn-primary:hover {
    background: var(--ss-primary-dark);
}

/* Messages */
.smartsupport-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--ss-bg-light);
}

.smartsupport-messages-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.smartsupport-message {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.smartsupport-message.smartsupport-message-user {
    align-self: flex-end;
    background: var(--primary-color, var(--ss-primary));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.smartsupport-message.smartsupport-message-agent {
    align-self: flex-start;
    background: #fff;
    color: var(--ss-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.smartsupport-message.smartsupport-message-system {
    align-self: center;
    background: #f0f0f0;
    color: #666;
    font-size: 13px;
    text-align: center;
    max-width: 90%;
    border-radius: 12px;
    font-style: italic;
}

.smartsupport-message.smartsupport-message-auto {
    border-left: 3px solid #3498db;
}

.smartsupport-status-dot.online {
    background: #2ecc71;
}

.smartsupport-status-dot.offline {
    background: #95a5a6;
}

.smartsupport-status-dot.away {
    background: #f39c12;
}

.smartsupport-status-dot.busy {
    background: #e74c3c;
}

.smartsupport-typing-label {
    font-size: 12px;
    color: #3498db;
    font-style: italic;
    animation: fadeInOut 1.5s infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.smartsupport-message-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.8;
}

.smartsupport-message-text {
    word-wrap: break-word;
}

.smartsupport-message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.6;
}

/* Typing Indicator */
.smartsupport-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 12px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.smartsupport-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ss-text-light);
    animation: typing 1.4s infinite;
}

.smartsupport-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.smartsupport-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/* Input Area */
.smartsupport-input-area {
    border-top: 1px solid var(--ss-border);
    background: var(--ss-bg);
    padding: 12px;
}

.smartsupport-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.smartsupport-attach-btn,
.smartsupport-send-btn {
    background: none;
    border: none;
    color: var(--ss-text-light);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.smartsupport-attach-btn:hover,
.smartsupport-send-btn:hover {
    background: var(--ss-bg-light);
    color: var(--primary-color, var(--ss-primary));
}

#smartsupport-message-input {
    flex: 1;
    border: 1px solid var(--ss-border);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    transition: border-color 0.2s;
}

#smartsupport-message-input:focus {
    outline: none;
    border-color: var(--primary-color, var(--ss-primary));
}

/* Rating Form */
.smartsupport-rating-form {
    padding: 30px;
    text-align: center;
}

.smartsupport-rating-form h4 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: var(--ss-text);
}

.smartsupport-stars {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.smartsupport-stars span {
    font-size: 36px;
    color: #ddd;
    cursor: pointer;
    transition: all 0.2s;
}

.smartsupport-stars span:hover,
.smartsupport-stars span.active {
    color: #f39c12;
    transform: scale(1.1);
}

#smartsupport-rating-comment {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ss-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 16px;
    min-height: 80px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .smartsupport-widget-window {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0;
    }
    
    .smartsupport-widget-button {
        width: 56px;
        height: 56px;
    }
}

/* Scrollbar */
.smartsupport-messages::-webkit-scrollbar {
    width: 6px;
}

.smartsupport-messages::-webkit-scrollbar-track {
    background: transparent;
}

.smartsupport-messages::-webkit-scrollbar-thumb {
    background: var(--ss-border);
    border-radius: 3px;
}

.smartsupport-messages::-webkit-scrollbar-thumb:hover {
    background: var(--ss-text-light);
}