/* Live Chat System Styles */

/* Chat Button - Floating in bottom right */
#live-chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 1000;
    transition: all 0.3s ease;
}

#live-chat-btn::before {
    content: 'Chatta med oss';
    position: absolute;
    right: 70px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

#live-chat-btn:hover::before {
    opacity: 1;
}

#live-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

#live-chat-btn.offline {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

#live-chat-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Window */
#live-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 550px;
    max-height: calc(100vh - 150px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

#live-chat-window.active {
    display: flex;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chat-header .close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.chat-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

/* Chat Body */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
}

/* Initial Form */
.chat-initial-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-initial-form label {
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 4px;
    display: block;
}

.chat-initial-form input,
.chat-initial-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-initial-form input:focus,
.chat-initial-form textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-initial-form button {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-initial-form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.chat-initial-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Waiting State */
.chat-waiting {
    text-align: center;
    padding: 40px 20px;
}

.chat-waiting .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.chat-waiting h4 {
    font-size: 18px;
    color: #334155;
    margin: 0 0 8px;
}

.chat-waiting p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* Chat Messages */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.chat-message.support {
    align-items: flex-start;
}

.chat-message.customer {
    align-items: flex-end;
    align-self: flex-end;
}

.chat-message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.support .chat-message-bubble {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

.chat-message.customer .chat-message-bubble {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.chat-message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    padding: 0 4px;
}

.chat-message-sender {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
    padding: 0 4px;
}

/* Chat Input */
.chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-input-form {
    display: flex;
    gap: 8px;
}

.chat-input-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.chat-input-form input:focus {
    outline: none;
    border-color: #3b82f6;
}

.chat-input-form button {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-input-form button:hover {
    transform: translateY(-1px);
}

.chat-input-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* End Chat Button */
.end-chat-btn {
    background: transparent;
    color: #ef4444;
    padding: 8px 12px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.end-chat-btn:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* Rating Stars */
.chat-rating {
    text-align: center;
    padding: 30px 20px;
}

.chat-rating h4 {
    font-size: 18px;
    color: #334155;
    margin: 0 0 20px;
}

.rating-stars {
    display: flex;
    gap: 8px;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 20px;
}

.rating-stars i {
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
}

.rating-stars i:hover,
.rating-stars i.active {
    color: #fbbf24;
    transform: scale(1.1);
}

.rating-submit {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.rating-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.rating-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Offline Message */
.chat-offline {
    text-align: center;
    padding: 40px 20px;
}

.chat-offline i {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.chat-offline h4 {
    font-size: 18px;
    color: #334155;
    margin: 0 0 8px;
}

.chat-offline p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* Responsive */
@media (max-width: 640px) {
    #live-chat-window {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    #live-chat-btn {
        left: 16px;
        bottom: 16px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.error-message {
    color: #ef4444;
    font-size: 13px;
    margin-top: 4px;
}

.success-message {
    color: #10b981;
    font-size: 13px;
    margin-top: 4px;
}

