/**
 * WEC WhatsApp Chat Plugin Styles - FWS Integration
 * Version: 1.0.0
 * Author: Ogün ÖZTÜRK
 */

/* FWS - Floating Widget System için özel sınıflar */
.wec-contact-container {
    position: fixed;
    z-index: 9999;
}

/* Mobil düzen - banner şeklinde alt kısımda */
@media (max-width: 768px) {
    .wec-contact-container {
        bottom: 0;
        left: 0;
        width: 100%;
        display: flex;
        flex-direction: row;
    }
    
    .wec-whatsapp-container {
        position: relative !important;
        flex: 0 0 40% !important; /* WhatsApp 40% */
        order: 1 !important;
    }
    
    .wec-contact-button {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 8px !important;
        color: #fff !important;
        text-decoration: none !important;
        font-weight: bold !important;
        transition: all 0.3s ease !important;
        gap: 8px !important;
        position: relative !important;
        cursor: pointer !important;
        border: none !important;
        outline: none !important;
        min-height: 60px !important;
        width: 100% !important;
    }
    
    .wec-contact-button i {
        margin-right: 6px !important;
        font-size: 18px !important;
    }
    
    .wec-button-phone {
        background-color: #b18745 !important;
        order: 2 !important;
        flex: 0 0 40% !important; /* Telefon 40% */
    }
    
    .wec-button-whatsapp {
        background-color: #0fb64e !important;
        position: relative !important;
    }
    
    .wec-button-instagram {
        background: #d6249f !important;
        background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%) !important;
        order: 3 !important;
        flex: 0 0 20% !important; /* Instagram 20% */
    }
    
    .wec-button-instagram .wec-button-texts {
        display: none !important;
    }
    
    .wec-button-instagram i {
        margin-right: 0 !important;
        font-size: 24px !important;
    }
    
    .wec-button-texts {
        display: flex !important;
        flex-direction: column !important;
        text-align: center !important;
    }
    
    .wec-button-mini-text {
        font-size: 11px !important;
        font-weight: 400 !important;
        line-height: 1.2 !important;
    }
    
    .wec-button-head {
        font-size: 13px !important;
        font-weight: 600 !important;
        line-height: 1.2 !important;
    }
    
    /* Mobil bildirim badge - WhatsApp butonunun üstünde */
    .wec-notification-badge {
        position: absolute !important;
        top: -12px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        background-color: #ff4444 !important;
        color: white !important;
        border-radius: 50% !important;
        width: 20px !important;
        height: 20px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 11px !important;
        font-weight: bold !important;
        z-index: 1000 !important;
        border: 2px solid white !important;
        animation: wecBadgePulse 2s infinite !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* WhatsApp chat kutusu mobilde tam ekran */
    .wec-whatsapp-chat-box {
        position: fixed !important;
        bottom: 60px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: none !important;
        max-height: 80vh !important;
        background-color: #fff !important;
        border-radius: 15px 15px 0 0 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3) !important;
        overflow: hidden !important;
        display: none !important; /* Başlangıçta gizli */
        flex-direction: column !important;
        z-index: 10001 !important;
    }
    
    .wec-whatsapp-container.wec-open .wec-whatsapp-chat-box {
        display: flex !important; /* Açıldığında görünür */
        animation: wecSlideUp 0.4s ease-out !important;
    }
    
    @keyframes wecSlideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    /* Mobil chat header */
    .wec-chat-header {
        background-color: #00a884 !important;
        color: white !important;
        padding: 15px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        border-top-left-radius: 15px !important;
        border-top-right-radius: 15px !important;
    }
    
    .wec-header-content {
        display: flex !important;
        align-items: center !important;
    }
    
    .wec-doctor-avatar {
        width: 40px !important;
        height: 40px !important;
        border-radius: 50% !important;
        margin-right: 10px !important;
        border: 2px solid white !important;
        background-color: #fff !important;
        overflow: hidden !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    .wec-doctor-avatar img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    .wec-doctor-info {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .wec-doctor-name {
        font-weight: bold !important;
        font-size: 16px !important;
    }
    
    .wec-status {
        font-size: 13px !important;
        opacity: 0.9 !important;
    }
    
    .wec-chat-body {
        flex-grow: 1 !important;
        padding: 15px !important;
        overflow-y: auto !important;
        background-color: #e5ddd5 !important;
        min-height: 100px !important;
        max-height: 300px !important;
    }
    
    .wec-message {
        background-color: #dcf8c6 !important;
        padding: 10px !important;
        border-radius: 8px !important;
        margin-bottom: 10px !important;
        max-width: 80% !important;
        word-wrap: break-word !important;
        box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13) !important;
    }
    
    .wec-message.wec-received {
        background-color: #fff !important;
        margin-right: auto !important;
    }
    
    .wec-message-time {
        display: block !important;
        font-size: 10px !important;
        color: #888 !important;
        text-align: right !important;
        margin-top: 5px !important;
    }
    
    .wec-chat-footer {
        display: flex !important;
        padding: 10px !important;
        background-color: #f0f0f0 !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
    
    #wec-whatsapp-input {
        flex-grow: 1 !important;
        padding: 12px !important;
        border: 1px solid #ddd !important;
        border-radius: 20px !important;
        outline: none !important;
        font-size: 16px !important;
        margin-right: 10px !important;
    }
    
    #wec-send-button {
        background-color: #25d366 !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        width: 44px !important;
        height: 44px !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        cursor: pointer !important;
        font-size: 18px !important;
        transition: background-color 0.2s ease-in-out !important;
    }
    
    #wec-send-button:hover {
        background-color: #1da851 !important;
    }
    
    /* Mobil chat kutusu için kapatma butonu */
    .wec-chat-close-btn {
        background: none !important;
        border: none !important;
        color: white !important;
        font-size: 20px !important;
        cursor: pointer !important;
        padding: 5px !important;
        z-index: 10 !important;
        width: 30px !important;
        height: 30px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        transition: background-color 0.2s ease !important;
    }
    
    .wec-chat-close-btn:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
    }
}

/* Masaüstü düzen - sağ altta takip eden yuvarlak butonlar */
@media (min-width: 769px) {
    .wec-contact-container {
        bottom: 20px;
        right: 20px;
        display: flex;
        flex-direction: column-reverse; /* WhatsApp en üstte */
        gap: 10px;
    }
    
    .wec-whatsapp-container {
        position: relative;
    }
    
    .wec-button-texts {
        display: none;
    }
    
    .wec-contact-button {
        width: 70px;
        height: 70px;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #fff !important;
        text-decoration: none;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
        font-size: 30px;
    }
    
    .wec-contact-button i {
        font-size: 28px;
        z-index: 2;
        position: relative;
    }
    
    .wec-contact-button:before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 50%;
        transform: scale(0);
        transition: all 0.5s ease;
    }
    
    .wec-contact-button:hover:before {
        transform: scale(1.5);
    }
    
    .wec-contact-button:hover {
        transform: translateY(-5px);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
        color: #fff;
    }
    
    .wec-button-phone {
        background-color: #b18745;
        animation: wecPulseBlue 2s infinite;
    }
    
    .wec-button-whatsapp {
        background-color: #0fb64e;
        animation: wecPulseGreen 2s infinite;
        position: relative;
    }
    
    .wec-button-instagram {
        background: #d6249f;
        background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
        animation: wecPulsePurple 2s infinite;
    }
    
    /* WhatsApp bildirim badge */
    .wec-notification-badge {
        position: absolute !important;
        top: -8px !important;
        right: -8px !important;
        background-color: #ff4444 !important;
        color: white !important;
        border-radius: 50% !important;
        width: 24px !important;
        height: 24px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 12px !important;
        font-weight: bold !important;
        z-index: 100 !important;
        border: 2px solid white !important;
        animation: wecBadgePulse 2s infinite !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    }
    
    @keyframes wecBadgePulse {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.1); }
    }
    
    @keyframes wecPulseBlue {
        0% {
            box-shadow: 0 0 0 0 rgba(177, 135, 69, 0.7);
        }
        70% {
            box-shadow: 0 0 0 10px rgba(177, 135, 69, 0);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(177, 135, 69, 0);
        }
    }
    
    @keyframes wecPulseGreen {
        0% {
            box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
        }
        70% {
            box-shadow: 0 0 0 10px rgba(37, 211, 102, 0);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
        }
    }
    
    @keyframes wecPulsePurple {
        0% {
            box-shadow: 0 0 0 0 rgba(250, 90, 70, 0.7);
        }
        70% {
            box-shadow: 0 0 0 10px rgba(250, 90, 70, 0);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(250, 90, 70, 0);
        }
    }
    
    /* WhatsApp Chat Box Styles */
    .wec-whatsapp-chat-box {
        position: absolute !important;
        bottom: 80px !important;
        right: 0 !important;
        width: 350px !important;
        max-height: 500px !important;
        background-color: #fff !important;
        border-radius: 10px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
        overflow: hidden !important;
        display: none !important; /* Başlangıçta gizli */
        flex-direction: column !important;
        z-index: 10000 !important;
    }
    
    .wec-whatsapp-container.wec-open .wec-whatsapp-chat-box {
        display: flex !important; /* Açıldığında görünür */
        animation: wecScaleIn 0.4s ease-out !important;
    }
    
    @keyframes wecScaleIn {
        from {
            transform: scaleY(0) translateY(100%);
            transform-origin: bottom;
        }
        to {
            transform: scaleY(1) translateY(0);
            transform-origin: bottom;
        }
    }
    
    .wec-chat-header {
        background-color: #00a884;
        color: white;
        padding: 15px;
        display: flex;
        align-items: center;
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
    }
    
    .wec-header-content {
        display: flex;
        align-items: center;
    }
    
    .wec-doctor-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        margin-right: 10px;
        border: 2px solid white;
        background-color: #fff;
        overflow: hidden;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .wec-doctor-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .wec-doctor-info {
        display: flex;
        flex-direction: column;
    }
    
    .wec-doctor-name {
        font-weight: bold;
        font-size: 16px;
    }
    
    .wec-status {
        font-size: 13px;
        opacity: 0.9;
    }
    
    .wec-chat-body {
        flex-grow: 1;
        padding: 15px;
        overflow-y: auto;
        background-color: #e5ddd5;
        min-height: 100px;
        max-height: 300px;
    }
    
    .wec-message {
        background-color: #dcf8c6;
        padding: 10px;
        border-radius: 8px;
        margin-bottom: 10px;
        max-width: 80%;
        word-wrap: break-word;
        box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    }
    
    .wec-message.wec-received {
        background-color: #fff;
        margin-right: auto;
    }
    
    .wec-message-time {
        display: block;
        font-size: 10px;
        color: #888;
        text-align: right;
        margin-top: 5px;
    }
    
    .wec-chat-footer {
        display: flex;
        padding: 10px;
        background-color: #f0f0f0;
        border-bottom-left-radius: 10px;
        border-bottom-right-radius: 10px;
    }
    
    #wec-whatsapp-input {
        flex-grow: 1;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 20px;
        outline: none;
        font-size: 14px;
        margin-right: 10px;
    }
    
    .wec-chat-footer input[type="text"] {
        color: #000 !important;
    }
    
    /* Daha güçlü CSS selector - diğer sitelerin CSS'ini ezmek için */
    .wec-whatsapp-chat-box .wec-chat-footer input[type="text"]#wec-whatsapp-input {
        color: #000 !important;
        background-color: #fff !important;
        border: 1px solid #ddd !important;
    }
    
    #wec-send-button {
        background-color: #25d366;
        color: white;
        border: none;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        font-size: 18px;
        transition: background-color 0.2s ease-in-out;
    }
    
    #wec-send-button:hover {
        background-color: #1da851;
    }
    
    /* Chat açık durumda WhatsApp butonunun değişimi */
    .wec-whatsapp-container.wec-open .wec-button-whatsapp {
        background-color: #10374B;
    }
    
    .wec-whatsapp-container.wec-open .wec-button-whatsapp i.fa-whatsapp {
        opacity: 0;
        transform: scale(0);
    }
    
    .wec-whatsapp-container.wec-open .wec-button-whatsapp i.fa-times {
        opacity: 1;
        transform: scale(1);
    }
    
    .wec-button-whatsapp i.fa-times {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
        transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    }
    
    .wec-whatsapp-container.wec-open .wec-button-whatsapp i.fa-times {
        transform: translate(-50%, -50%) scale(1);
    }
    
    .wec-button-whatsapp i.fa-whatsapp {
        transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    }
    
    /* Bildirim badge'ini chat açıkken gizle */
    .wec-whatsapp-container.wec-open .wec-notification-badge {
        opacity: 0 !important;
        transform: scale(0) !important;
        transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out !important;
    }
}

/* Responsive tasarım iyileştirmeleri */
@media (max-width: 480px) {
    .wec-contact-button {
        padding: 6px !important;
        min-height: 55px !important;
    }
    
    .wec-contact-button i {
        font-size: 16px !important;
    }
    
    .wec-button-mini-text {
        font-size: 10px !important;
    }
    
    .wec-button-head {
        font-size: 12px !important;
    }
    
    .wec-button-instagram i {
        font-size: 20px !important;
    }
    
    .wec-whatsapp-chat-box {
        max-height: 75vh !important;
        border-radius: 12px 12px 0 0 !important;
        bottom: 55px !important;
    }
    
    .wec-chat-header {
        padding: 12px !important;
    }
    
    .wec-doctor-name {
        font-size: 14px !important;
    }
    
    .wec-status {
        font-size: 12px !important;
    }
    
    .wec-chat-body {
        padding: 12px !important;
        max-height: 250px !important;
    }
    
    .wec-chat-footer {
        padding: 8px !important;
    }
    
    #wec-whatsapp-input {
        font-size: 16px !important; /* iOS zoom önleme */
        padding: 8px 12px !important;
    }
    
    #wec-send-button {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
}

@media (max-width: 360px) {
    .wec-contact-button {
        padding: 4px !important;
        min-height: 50px !important;
    }
    
    .wec-contact-button i {
        font-size: 14px !important;
        margin-right: 4px !important;
    }
    
    .wec-button-mini-text {
        font-size: 9px !important;
    }
    
    .wec-button-head {
        font-size: 11px !important;
    }
    
    .wec-button-instagram i {
        font-size: 18px !important;
    }
    
    .wec-whatsapp-chat-box {
        max-height: 70vh !important;
        bottom: 50px !important;
    }
}

/* Animasyon keyframes */
@keyframes wecBadgePulse {
    0%, 100% { 
        transform: translateX(-50%) scale(1); 
    }
    50% { 
        transform: translateX(-50%) scale(1.1); 
    }
}

/* Desktop için badge animasyonu */
@media (min-width: 769px) {
    @keyframes wecBadgePulse {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.1); }
    }
}

/* Mobil için ek animasyonlar */
@media (max-width: 768px) {
    .wec-whatsapp-container.wec-open .wec-button-whatsapp {
        background-color: #10374B !important;
    }
    
    .wec-whatsapp-container.wec-open .wec-button-whatsapp i.fa-whatsapp {
        opacity: 0 !important;
        transform: scale(0) !important;
    }
    
    .wec-whatsapp-container.wec-open .wec-button-whatsapp i.fa-times {
        opacity: 1 !important;
        transform: translate(-50%, -50%) scale(1) !important;
    }
    
    .wec-whatsapp-container.wec-open .wec-notification-badge {
        opacity: 0 !important;
        transform: translateX(-50%) scale(0) !important;
    }
    
    .wec-button-whatsapp i.fa-times {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(0) !important;
        opacity: 0 !important;
        transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out !important;
        z-index: 10 !important;
    }
    
    .wec-button-whatsapp i.fa-whatsapp {
        position: relative !important;
        z-index: 5 !important;
        transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out !important;
    }
    
    .wec-notification-badge {
        transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out !important;
    }
    
    /* Mobilde buton içindeki text'leri gizle çarpı açıkken */
    .wec-whatsapp-container.wec-open .wec-button-texts {
        opacity: 0 !important;
        transition: opacity 0.3s ease-in-out !important;
    }
}