@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v30.0.0/dist/font-face.css');

/* تنظیمات کلی کانتینر */
#penguin-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Vazir', sans-serif;
    font-weight: 400;
    direction: rtl;
    text-align: right;
}

/* دکمه شناور - حالت اولیه کاملاً واضح */
#penguin-floating-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 62px;
    height: 62px;
    background: #8a68ad;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 10000;
    opacity: 1 !important; /* شفافیت کامل */
    visibility: visible;
    
    
    border: 2px solid #faf8f5;}

/* وقتی پنل باز است، دکمه مخفی شود */
#penguin-chat-panel.open ~ #penguin-floating-button {
    opacity: 0 !important;
    visibility: hidden;
    transform: scale(0);
}

#penguin-floating-button:hover {
    transform: translateY(-5px) scale(1.08);
}

/* تولتیپ دکمه شناور */
#penguin-tooltip {
    position: absolute;
    width: 220px;
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    display: none;
    animation: tooltipFadeIn 0.3s ease;
    z-index: 10001;
    border: 1px solid #e0e0e0;
    
        bottom: 78px;
    right: -10px;
    min-width: 250px;
    max-width: 300px;
}

#penguin-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 30px;
    width: 16px;
    height: 16px;
    background: #fff;
    transform: rotate(45deg);
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
}

.tooltip-content {
    color: #333;
    text-align: right;
    
    padding: 14px 18px;
    min-height: 58px;
    line-height: 1.9;
    font-size: 14px;
    border-radius: 16px;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* پنل چت */
#penguin-chat-panel {
    position: fixed;
    bottom: 20px;
    right: -400px;
    width: 350px;
    height: 95vh;
    background: #faf8f5;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    z-index: 9999;
}

#penguin-chat-panel.open {
    right: 20px;
}

/* هدر پنل */
#penguin-chat-header {
    background: #8a68ad;
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.penguin-admin-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.penguin-admin-info img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
}

#penguin-close-panel {
    font-size: 32px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* بخش پیام‌ها */
#penguin-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #faf8f5;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.penguin-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 15px;
    word-wrap: break-word;
}

.penguin-message.admin {
    background: #e5e5ea;
    color: #000;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

.penguin-message.user {
    background: #8a68ad;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
}

.penguin-message img {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 8px;
    cursor: zoom-in;
}

/* بخش پیام صوتی */
.audio-message {
    display: flex;
    flex-direction: column;
    width: 250px;
    max-width: 100%;
}

.audio-message audio {
    width: 100% !important;
    height: 40px;
    border-radius: 25px;
}

.audio-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.8;
    direction: ltr;
    text-align: left;
}

/* بخش ورودی متن و دکمه‌ها */
#penguin-input-area {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #fff;
    gap: 8px;
    border-top: 1px solid #eee;
}

#penguin-message-input {
    flex: 1;
    min-width: 0;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-family: 'Vazir', sans-serif;
    font-size: 14px;
    outline: none;
}

#penguin-attach-image,
#penguin-record-voice,
#penguin-send-message {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

/* استایل آیکون‌ها - خاکستری */
.penguin-icon {
    width: 22px;
    height: 22px;
    filter: invert(60%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(90%) contrast(90%);
    transition: all 0.3s ease;
}

/* چرخش دکمه ارسال */
#penguin-send-message .penguin-icon {
    transform: rotate(-135deg);
}

/* وضعیت ضبط صدا */
#penguin-record-voice.recording .penguin-icon {
    filter: invert(15%) sepia(95%) saturate(6932%) hue-rotate(358deg) brightness(95%) contrast(112%) !important;
    animation: penguin-icon-pulse 1.2s infinite ease-in-out;
}

/* دکمه تکمیل فرم تماس */
.btn-contact-form {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    font-family: 'Vazir', sans-serif;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-contact-form:hover {
    background: #138496;
    transform: translateY(-2px);
}

/* فرم اطلاعات تماس */
#penguin-contact-form {
    background: #fff;
    border-top: 1px solid #eee;
    padding: 20px;
}

.contact-form-wrapper {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.contact-form-header {
    margin-bottom: 20px;
    text-align: center;
}

.contact-form-header h4 {
    color: #8a68ad;
    margin-bottom: 8px;
    font-size: 16px;
}

.contact-form-header p {
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Vazir', sans-serif;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus, .form-group textarea:focus {
    border-color: #8a68ad;
    outline: none;
    box-shadow: 0 0 0 3px rgba(138, 104, 173, 0.1);
}

.phone-hint {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.btn-submit, .btn-skip {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-family: 'Vazir', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-submit {
    background: #8a68ad;
    color: white;
}

.btn-submit:hover {
    background: #7a5a9d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(138, 104, 173, 0.3);
}

.btn-skip {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.btn-skip:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* مدال بزرگ‌نمایی تصویر */
#penguin-image-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 20000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    cursor: zoom-out;
}

#penguin-modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

#penguin-image-modal.active #penguin-modal-content {
    transform: scale(1);
}

#penguin-modal-close {
    position: absolute;
    top: 20px; right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

/* انیمیشن پالس */
@keyframes penguin-icon-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* اسکرول بار */
#penguin-messages::-webkit-scrollbar { width: 5px; }
#penguin-messages::-webkit-scrollbar-track { background: #f1f1f1; }
#penguin-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }

/* ریسپانس موبایل */
@media (max-width: 480px){

    #penguin-chat-panel{
        width:100%;
        height:100%;
        bottom:0;
        right:-100%;
        border-radius:0;
    }

    #penguin-chat-panel.open{
        right:0;
    }


    #penguin-tooltip::after{
        right:45px;
    }
}


.penguin-branding-bar {
    background: #f0f0f0;
    color: #888;
    font-size: 0.8rem;
    text-align: center;
    padding: 4px 0;
    border-bottom: 1px solid #e5e5e5;
    letter-spacing: 0.5px;
}

.penguin-admin-info div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.penguin-admin-info strong {
    font-size: 14px;
    display: block;
}

.penguin-admin-info small {
    font-size: 11px;
    opacity: 0.9;
    font-weight: 300;
}

/* بهبود ظاهر ورودی و دکمه‌های چت کاربر */
#penguin-input-area {
    display: flex;
    align-items: center;
    padding: 12px;
    background: linear-gradient(to bottom, #f9f9f9, #ffffff);
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 25px 25px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

#penguin-message-input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid #ddd;
    border-radius: 30px;
    outline: none;
    font-size: 16px;
    background: #fff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

#penguin-message-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 8px rgba(74,144,226,0.4);
}

#penguin-input-area button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    margin-left: 10px;
    border-radius: 50%;
    transition: all 0.3s;
}

#penguin-input-area button:hover {
    background: rgba(74,144,226,0.1);
    transform: scale(1.1);
}

#penguin-send-message {
    background: #4a90e2;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(74,144,226,0.3);
}

#penguin-send-message:hover {
    background: #357ab8;
    transform: scale(1.15);
}

#penguin-send-message img {
    width: 26px;
    filter: brightness(0) invert(1);
}

/* دکمه ضبط صدا (حالت recording) */
#penguin-record-voice.recording {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}





/* بخش ورودی متن و دکمه‌ها - کاربر */
#penguin-input-area {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    gap: 12px;
    border-top: 1px solid #eee;
}

#penguin-message-input {
    flex: 1;
    min-width: 0;
    padding: 12px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-family: 'Vazir', sans-serif;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
}

#penguin-message-input:focus {
    border-color: #8a68ad;
}

#penguin-attach-image,
#penguin-record-voice {
    width: 42px;
    height: 42px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    border-radius: 50%;
    transition: all 0.3s;
}

#penguin-send-message {
    width: 42px;
    height: 42px;
    background: transparent !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    border-radius: 50%;
    transition: all 0.3s;
    box-shadow: none !important;
}

/* استایل آیکون‌ها - خاکستری در حالت عادی */
.penguin-icon {
    width: 24px;
    height: 24px;
    filter: invert(60%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(90%) contrast(90%);
    transition: all 0.3s ease;
}

/* چرخش دکمه ارسال */
#penguin-send-message .penguin-icon {
    transform: rotate(-135deg);
}

/* وضعیت هاور - بنفش پاستلی */
#penguin-attach-image:hover .penguin-icon,
#penguin-record-voice:hover .penguin-icon,
#penguin-send-message:hover .penguin-icon {
    filter: invert(50%) sepia(30%) saturate(500%) hue-rotate(230deg) brightness(95%) contrast(90%);
}

/* فقط هاور روی خود دکمه‌ها (بدون پس‌زمینه) */
#penguin-attach-image:hover,
#penguin-record-voice:hover,
#penguin-send-message:hover {
    background: transparent !important;
    transform: scale(1.1);
}

/* وضعیت ضبط صدا */
#penguin-record-voice.recording .penguin-icon {
    filter: invert(15%) sepia(95%) saturate(6932%) hue-rotate(358deg) brightness(95%) contrast(112%) !important;
    animation: penguin-icon-pulse 1.2s infinite ease-in-out;
}

#penguin-record-voice.recording {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes penguin-icon-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* بهبود ظاهر ورودی و دکمه‌های چت کاربر */
#penguin-input-area {
    display: flex;
    align-items: center;
    padding: 12px;
    background: linear-gradient(to bottom, #f9f9f9, #ffffff);
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 25px 25px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

#penguin-message-input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid #ddd;
    border-radius: 30px;
    outline: none;
    font-size: 16px;
    background: #fff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

#penguin-message-input:focus {
    border-color: #8a68ad;
    box-shadow: 0 0 0 3px rgba(138, 104, 173, 0.1);
}

#penguin-input-area button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    border-radius: 50%;
    transition: all 0.3s;
}

#penguin-input-area button:hover {
    transform: scale(1.1);
}

/* حذف پس‌زمینه آبی از دکمه ارسال */
#penguin-send-message {
    background: transparent !important;
    width: 42px !important;
    height: 42px !important;
    box-shadow: none !important;
}

#penguin-send-message:hover {
    background: transparent !important;
    transform: scale(1.1) !important;
}

#penguin-send-message img {
    width: 24px;
    filter: invert(60%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(90%) contrast(90%) !important;
}

#penguin-send-message:hover img {
    filter: invert(50%) sepia(30%) saturate(500%) hue-rotate(230deg) brightness(95%) contrast(90%) !important;
}



#penguin-floating-button{
    box-shadow: none !important;
}


@media (max-width: 480px){
    #penguin-floating-button{
        bottom: 35px !important;  /* قبلا 20 بود */
    }
}


@media (max-width: 480px) {
    #penguin-tooltip {
        right: 15px !important;
        left: 15px !important;
        bottom: 110px;
        padding: 12px;
        display: block;
        width: 60vw !important;
    }

    .tooltip-content {
        font-size: 14px;
        line-height: 1.8;
        padding: 12px;
        word-break: normal;
        white-space: normal; /* جلوگیری از شکستن اجباری کلمات */
        text-align: right;
        width: 50vw;
    }
}





/* روکش روی بخش ارسال پیام */
.penguin-input-wrapper {
    position: relative; /* والد باید ریتیو باشد */
}

.penguin-input-blocker {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: not-allowed;
    border-radius: 10px;
}

.penguin-input-blocker::after {
    content: "ابتدا فرم تماس را تکمیل کنید";
    background: #333;
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    opacity: 0;
    transition: 0.3s;
}

.penguin-input-blocker:hover::after {
    opacity: 1;
}

/* پیام سیستم (سبز وسط‌چین) */
.penguin-system-notice {
    display: block;
    width: fit-content;
    margin: 15px auto;
    padding: 8px 20px;
    background-color: #e8f5e9; /* سبز کمرنگ */
    color: #2e7d32; /* سبز پررنگ */
    border: 1px solid #c8e6c9;
    border-radius: 30px;
    font-size: 12px;
    text-align: center;
    line-height: 1.6;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
