/* FontAwesome Fixes */
#wpsac-toggle-btn i,
#wpsac-send-btn i {
    font-family: "Font Awesome 5 Free", "Font Awesome 5 Brands", FontAwesome, sans-serif !important;
    font-weight: 900;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    line-height: 1 !important;
}

#wpsac-send-btn i {
    color: white !important;
}

#wpsac-toggle-btn {
    position: fixed;
    bottom: 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 99999;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#wpsac-toggle-btn.wpsac-right {
    right: 24px;
}

#wpsac-toggle-btn.wpsac-left {
    left: 24px;
}

#wpsac-toggle-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#wpsac-toggle-btn:active {
    transform: scale(0.95);
}

#wpsac-toggle-btn .wpsac-custom-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 50%;
}

#wpsac-chat-widget {
    position: fixed;
    bottom: 100px;
    width: 380px;
    height: 580px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 1px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#wpsac-chat-widget.wpsac-right {
    right: 24px;
}

#wpsac-chat-widget.wpsac-left {
    left: 24px;
}

#wpsac-chat-widget.active {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

#wpsac-chat-header {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

#wpsac-header-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#wpsac-header-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

#wpsac-header-subtitle {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
    letter-spacing: 0.2px;
}

#wpsac-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#wpsac-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* Contact Form Styles */
#wpsac-contact-form {
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
    overflow-y: auto;
    flex: 1;
}

#wpsac-contact-form input[type="text"],
#wpsac-contact-form input[type="email"],
#wpsac-contact-form input[type="tel"] {
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 14px;
    background: white;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

#wpsac-contact-form input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    transform: translateY(-1px);
}

.wpsac-kvkk-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: white;
    border-radius: 12px;
    border: 2px solid #e8e8e8;
    transition: border-color 0.2s ease;
}

.wpsac-kvkk-group:has(input:checked) {
    border-color: #0073aa;
    background: rgba(0, 115, 170, 0.02);
}

.wpsac-kvkk-group input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #0073aa;
}

.wpsac-kvkk-group label {
    font-size: 11.5px;
    color: #555;
    line-height: 1.5;
    cursor: pointer;
    margin: 0;
}

#wpsac-start-chat-btn {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    margin-top: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#wpsac-start-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#wpsac-start-chat-btn:active {
    transform: translateY(0);
}

#wpsac-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#wpsac-chat-body::-webkit-scrollbar {
    width: 6px;
}

#wpsac-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

#wpsac-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

#wpsac-chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

.wpsac-message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: messageSlideIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wpsac-bot-message {
    background: white;
    color: #2c3e50;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #e8e8e8;
}

.wpsac-user-message {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.wpsac-admin-message {
    background: linear-gradient(135deg, #28a745 0%, #20893a 100%);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    position: relative;
}

/* Quick Replies */
#wpsac-quick-replies {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    background: white;
    border-top: 1px solid #f0f0f0;
    scrollbar-width: none;
}

#wpsac-quick-replies::-webkit-scrollbar {
    display: none;
}

.wpsac-quick-reply-btn {
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    border: 1.5px solid #e0e0e0;
    border-radius: 18px;
    padding: 8px 16px;
    font-size: 13px;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.wpsac-quick-reply-btn:hover {
    background: linear-gradient(to bottom, #f8f9fa 0%, #e9ecef 100%);
    border-color: #0073aa;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.wpsac-quick-reply-btn:active {
    transform: translateY(0);
}

#wpsac-chat-input-area {
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    background: white;
    border-top: 1px solid #f0f0f0;
    align-items: center;
}

#wpsac-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fafafa;
}

#wpsac-input:focus {
    border-color: #0073aa;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.08);
}

#wpsac-send-btn {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

#wpsac-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#wpsac-send-btn:active {
    transform: scale(0.95);
}

/* Typing indicator */
.wpsac-typing {
    font-style: italic;
    color: #888;
    font-size: 12px;
    margin-left: 10px;
    display: none;
}

@media (max-width: 480px) {
    #wpsac-chat-widget {
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        /* Dynamic viewport height for mobile */
        max-height: 100vh !important;
        max-height: 100dvh !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        border-radius: 0 !important;
        position: fixed !important;
    }

    /* Hide toggle button when chat is active on mobile */
    #wpsac-chat-widget.active~#wpsac-toggle-btn {
        display: none !important;
    }

    #wpsac-toggle-btn {
        width: 56px;
        height: 56px;
        font-size: 22px;
        bottom: 16px;
    }

    #wpsac-toggle-btn.wpsac-right {
        right: 16px;
    }

    #wpsac-toggle-btn.wpsac-left {
        left: 16px;
    }

    #wpsac-contact-form {
        padding: 24px 20px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .wpsac-kvkk-group label {
        font-size: 10.5px;
    }

    #wpsac-chat-header {
        padding: 16px 20px;
        border-radius: 0;
        flex-shrink: 0;
    }

    #wpsac-header-title {
        font-size: 16px;
    }

    #wpsac-header-subtitle {
        font-size: 11px;
    }

    #wpsac-chat-body {
        padding: 16px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .wpsac-message {
        max-width: 85%;
    }

    #wpsac-quick-replies {
        padding: 10px 12px;
        flex-shrink: 0;
    }

    .wpsac-quick-reply-btn {
        padding: 7px 14px;
        font-size: 12px;
    }

    #wpsac-chat-input-area {
        padding: 12px 16px;
        flex-shrink: 0;
        position: relative;
    }
}