/**
 * Chat Widget Styles
 * 
 * @package WooCommerce_Live_Chat_JSON
 * @since 1.0.0
 */

/* ==========================================================================
   Chat Widget Container
   ========================================================================== */

.wlc-chat-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;
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --shadow-light: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-heavy: 0 8px 24px rgba(0,0,0,0.2);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.wlc-chat-widget * {
    box-sizing: border-box;
}

/* Position variants */
.wlc-position-bottom-right {
    bottom: 24px;
    right: 24px;
}

.wlc-position-bottom-left {
    bottom: 24px;
    left: 24px;
}

/* ==========================================================================
   Chat Button (Minimized State)
   ========================================================================== */

.wlc-chat-button {
    width: 56px;
    height: 56px;
    background: #237b14 !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
    position: relative;
    border: none;
    outline: none;
}

.wlc-chat-button:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-heavy);
    background: #237b14 !important;
}

.wlc-chat-button:active {
    transform: scale(0.98);
}

.wlc-chat-button.wlc-hidden {
    display: none;
}

.wlc-chat-icon {
    width: 24px;
    height: 24px;
    color: white;
}

.wlc-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger-color);
    color: white;
    border-radius: 10px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    padding: 0 4px;
    box-shadow: var(--shadow-light);
    border: 2px solid white;
}

/* ==========================================================================
   Chat Window
   ========================================================================== */

.wlc-chat-window {
    width: 360px;
    height: 560px;
    max-height: calc(100vh - 80px);
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-heavy);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 480px) {
    .wlc-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    
    .wlc-chat-widget {
        bottom: 0;
        right: 0;
        left: 0;
    }
    
    .wlc-chat-header {
        padding: 12px 16px;
    }
    
    .wlc-header-title h3 {
        font-size: 15px;
    }
    
    .wlc-messages-container {
        padding: 12px;
    }
    
    .wlc-chat-input {
        padding: 12px;
    }
    
    .wlc-message-textarea {
        min-height: 40px;
        padding: 10px 14px;
    }
    
    .wlc-btn-send {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 768px) {
    .wlc-chat-window {
        width: 340px;
        height: 520px;
    }
    
    .wlc-chat-header {
        padding: 14px 18px;
    }
    
    .wlc-messages-container {
        padding: 14px;
    }
}

@media (max-width: 1024px) {
    .wlc-chat-window {
        width: 350px;
        height: 540px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .wlc-chat-widget {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .wlc-chat-widget {
        --primary-color: #4dabf7;
        --primary-hover: #339af0;
        --secondary-color: #adb5bd;
        --light-color: #212529;
        --dark-color: #f8f9fa;
        --border-color: #495057;
    }
    
    .wlc-message-received .wlc-message-bubble {
        background: #343a40;
        color: #f8f9fa;
        border-color: #495057;
    }
    
    .wlc-welcome-screen {
        background: #212529;
    }
    
    .wlc-form-input {
        background: #343a40;
        border-color: #495057;
        color: #f8f9fa;
    }
    
    .wlc-message-textarea {
        background: #343a40;
        border-color: #495057;
        color: #f8f9fa;
    }
}

/* ==========================================================================
   Chat Header
   ========================================================================== */

.wlc-chat-header {
    background: #2c2c2c;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wlc-header-content {
    flex: 1;
    min-width: 0;
}

.wlc-header-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: white !important;
}

.wlc-header-subtitle {
    margin: 0px 0px 0px 0px;
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wlc-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.wlc-status-online {
    background: var(--success-color);
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
    animation: pulse 2s infinite;
}

.wlc-status-offline {
    background: var(--secondary-color);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

.wlc-header-actions {
    display: flex;
    /* gap: 4px; */
    flex-shrink: 0;
}

.wlc-btn-icon {
    /* background: rgba(255, 255, 255, 0.1); */
    border: none;
    color: white;
    /* width: 28px; */
    height: 28px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.wlc-btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

.wlc-btn-icon:active {
    transform: scale(0.95);
}

.wlc-btn-icon svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Welcome Screen
   ========================================================================== */

.wlc-welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.wlc-welcome-content {
    width: 100%;
    max-width: 280px;
}

.wlc-welcome-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.wlc-welcome-icon svg {
    width: 32px;
    height: 32px;
}

.wlc-welcome-content h3 {
    margin: 0 0 8px;
    font-size: 20px;
    color: #2c3e50;
}

.wlc-welcome-content p {
    margin: 0 0 24px;
    color: #7f8c8d;
    font-size: 14px;
}

.wlc-welcome-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wlc-form-group {
    text-align: left;
}

.wlc-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.wlc-form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.wlc-form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #95a5a6;
}

.wlc-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.wlc-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.wlc-btn-primary:active {
    transform: translateY(0);
}

.wlc-btn-block {
    width: 100%;
}

/* ==========================================================================
   Chat Messages
   ========================================================================== */

.wlc-chat-messages {
    flex: 1;
    overflow: hidden;
    background: var(--light-color);
    position: relative;
}

.wlc-messages-container {
    background-color: #565656 !important;
    height: 100%;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.wlc-messages-container::-webkit-scrollbar {
    width: 4px;
}

.wlc-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.wlc-messages-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.wlc-messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.wlc-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wlc-message-sent {
    align-self: flex-end;
    align-items: flex-end;
}

.wlc-message-received {
    align-self: flex-start;
    align-items: flex-start;
}

.wlc-message-bubble {
    padding: 12px 16px;
    border-radius: var(--border-radius-lg);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.wlc-message-sent .wlc-message-bubble {
    background: #237b14;
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-light);
}

.wlc-message-received .wlc-message-bubble {
    background: rgb(0, 0, 0);
    color: rgb(255, 255, 255);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
}

.wlc-message-meta {
    font-size: 11px;
    color: var(--secondary-color);
    margin-top: 4px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wlc-message-sender {
    font-weight: 500;
}

.wlc-message-time {
    opacity: 0.8;
}

.wlc-system-message {
    text-align: center;
    padding: 10px 16px;
    background: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
    border-radius: var(--border-radius);
    font-size: 12px;
    margin: 8px auto;
    border: 1px solid rgba(0, 123, 255, 0.2);
}

/* ==========================================================================
   Chat Input
   ========================================================================== */

.wlc-chat-input {
    padding: 16px;
    background: #2c2c2c;
    border-top: 1px solid var(--border-color);
}

.wlc-message-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 0px !important;
}

.wlc-message-textarea {
    flex: 1;
    /* padding: 12px 16px; */
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 44px;
    transition: var(--transition);
    outline: none;
    background: white;
}

.wlc-message-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.wlc-message-textarea::placeholder {
    color: var(--secondary-color);
}

.wlc-btn-send {
    width: 44px;
    height: 44px;
    background: #1d1d1d !important;
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    outline: none;
}

.wlc-btn-send:hover {
    background: #232323 !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.wlc-btn-send:active {
    transform: translateY(0);
}

.wlc-btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wlc-btn-send svg {
    width: 18px;
    height: 18px;
}

.wlc-chat-footer {
    /* margin-top: 12px; */
    text-align: center;
    display: none;
}

.wlc-btn-text {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 12px;
    cursor: pointer;
    padding: 6px 12px;
    transition: var(--transition);
    border-radius: var(--border-radius);
    outline: none;
}

.wlc-btn-text:hover {
    color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

/* ==========================================================================
   Loading & Empty States
   ========================================================================== */

.wlc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--secondary-color);
}

.wlc-empty-state {
    text-align: center;
    padding: 40px;
    color: var(--secondary-color);
}

.wlc-empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.wlc-empty-state h3 {
    margin: 0 0 8px;
    color: var(--dark-color);
    font-size: 16px;
    font-weight: 600;
}

.wlc-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* ==========================================================================
   Additional Modern Features
   ========================================================================== */

/* Typing indicator */
.wlc-typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    margin: 8px 0;
    max-width: 80px;
}

.wlc-typing-dots {
    display: flex;
    gap: 4px;
}

.wlc-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--secondary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.wlc-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.wlc-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Message status indicators */
.wlc-message-status {
    font-size: 10px;
    opacity: 0.7;
    margin-left: 4px;
}

.wlc-message-status.sent {
    color: var(--secondary-color);
}

.wlc-message-status.delivered {
    color: var(--primary-color);
}

.wlc-message-status.read {
    color: var(--success-color);
}

/* Improved welcome screen */
.wlc-welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    background: var(--light-color);
}

.wlc-welcome-content {
    width: 100%;
    max-width: 280px;
}

.wlc-welcome-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    background: #237b14 !important;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-medium);
}

.wlc-welcome-icon svg {
    width: 24px;
    height: 24px;
}

.wlc-welcome-content h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--dark-color);
    font-weight: 600;
}

.wlc-welcome-content p {
    margin: 0 0 20px;
    color: var(--secondary-color);
    font-size: 14px;
    line-height: 1.4;
}

.wlc-welcome-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wlc-form-group {
    text-align: left;
}

.wlc-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: white;
    outline: none;
}

.wlc-form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.wlc-form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--secondary-color);
}

.wlc-btn-primary {
    background: #237b14 !important;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.wlc-btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.wlc-btn-primary:active {
    transform: translateY(0);
}

.wlc-btn-block {
    width: 100%;
}

