﻿/* انیمیشن‌ها */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ویجت چت‌بات */
#chatbot-widget {
    position: fixed;
    bottom: 27px;
    left: 50px;
    z-index: 1000;
}

/* دکمه اصلی */
.chatbot-button {
    width: 63px;
    height: 63px;
    border-radius: 50%;
    background: #f11b23;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    animation: fadeInUp 0.5s ease, pulse 2s infinite;
}

    .chatbot-button:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
    }

    .chatbot-button::before {
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        opacity: 0.3;
        animation: ripple 2s infinite;
    }

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.avatar-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    position: relative;
    z-index: 1;
}

/* Tooltip */
.tooltip {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-40%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chatbot-button:hover .tooltip {
    opacity: 1;
    animation: fadeInDown 0.3s ease;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #333;
}

/* پنل انتخاب */
.chatbot-options {
    position: absolute;
    bottom: 90px;
    left: 0;
    width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
    animation: slideInRight 0.3s ease;
}

.option-header {
    background: #57585a;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .option-header h3 {
        font-size: 16px;
        font-weight: 600;
        color: white;
        margin-bottom: 0px;
    
    }

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

    .close-btn:hover {
        transform: rotate(90deg);
    }

.option-buttons {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

    .option-btn:hover {
        background: #f11b23;
        color: white;
        border-color: #f11b23;
        transform: translateY(-2px);
    }

    .option-btn .icon {
        font-size: 24px;
    }

/* پنل‌های اصلی */
.chatbot-panel {
    position: absolute;
    bottom: 90px;
    left: 0;
    width: 400px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInRight 0.3s ease;
}

.panel-header {
    background: #57585a;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .panel-header h3 {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 0px;
        color: white;
    }

.panel-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* فرم محاسبه سریع */
.form-group {
    margin-bottom: 15px;
    animation: fadeInUp 0.5s ease backwards;
}

    .form-group:nth-child(1) {
        animation-delay: 0.1s;
    }

    .form-group:nth-child(2) {
        animation-delay: 0.2s;
    }

    .form-group:nth-child(3) {
        animation-delay: 0.3s;
    }

    .form-group label {
        display: block;
        margin-bottom: 5px;
        font-weight: 600;
        color: #333;
        font-size: 14px;
    }

.form-control {
    width: 100%;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

    .form-control:focus {
        outline: none;
        border-color: #57585a;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #ed1b23;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease 0.4s backwards;
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }

    .btn-primary:active {
        transform: translateY(0);
    }

/* لودینگ */
.ai-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* نتیجه */
.result-box {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-right: 4px solid #57585a;
    animation: fadeInUp 0.5s ease;
}

    .result-box h4 {
        color: #57585a;
        margin-bottom: 10px;
        font-size: 16px;
    }

    .result-box p {
        margin: 5px 0;
        font-size: 14px;
        color: #333;
    }

/* پنل چت */
.chat-messages {
    height: 380px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    animation: slideInRight 0.3s ease;
}

    .message.user {
        align-self: flex-end;
        background: linear-gradient(135deg, #57585a 0%, #764ba2 100%);
        color: white;
        border-bottom-right-radius: 4px;
    }

    .message.bot {
        align-self: flex-start;
        background: #f8f9fa;
        color: #333;
        border-bottom-left-radius: 4px;
        border: 1px solid #e9ecef;
    }

    .message.typing {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        padding: 15px;
    }

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

    .typing-indicator span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #57585a;
        animation: typing 1.4s infinite;
    }

        .typing-indicator span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-top: 2px solid #e9ecef;
}

.chat-input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

    .chat-input:focus {
        outline: none;
        border-color: #57585a;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }

.btn-send {
    padding: 10px 20px;
    background: #ed1b23;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .btn-send:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }

    .btn-send:active {
        transform: translateY(0);
    }

    .btn-send:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* Helper classes */
.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #57585a;
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #764ba2;
    }

/* Responsive */
@media (max-width: 768px) {
    .chatbot-panel {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
    }

    .chatbot-options {
        width: 280px;
    }

    .container h1 {
        font-size: 1.8rem;
    }
}

/* صدا */
.sound-wave {
    display: inline-block;
    width: 4px;
    height: 20px;
    background: #57585a;
    margin: 0 2px;
    animation: sound 0.8s infinite ease-in-out;
}

    .sound-wave:nth-child(2) {
        animation-delay: 0.2s;
    }

    .sound-wave:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes sound {
    0%, 100% {
        height: 10px;
    }

    50% {
        height: 20px;
    }
}
/* Select2 Custom Styles */
/*.select2-container--default .select2-selection--single {
    height: 45px;
    padding: 8px 12px;
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 28px;
        color: #fff;
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 43px;
    }

.select2-dropdown {
    background: #57585a;
    border: 1px solid #f01b24;
    border-radius: 8px;
}

.select2-results__option {
    padding: 10px 12px;
    color: #fff;
}

.select2-results__option--highlighted {
    background: #f01b24 !important;
}

.select2-results__group {
    background: #f01b24;
    color: #fff;
    padding: 8px 12px;
    font-weight: bold;
}

.select2-search--dropdown .select2-search__field {
    background: #2a2a3e;
    border: 1px solid #f01b24;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
}*/

/* City Option */
.city-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.city-name {
    font-weight: 500;
}

.city-province {
    font-size: 11px;
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Results */
.result-box h4 {
    color: #f01b24;
    margin-bottom: 15px;
}

.result-details {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    color: #333;
}

    .result-details p {
        margin: 8px 0;
    }

.result-alts {
    margin-top: 15px;
}

    .result-alts h5 {
        color: #aaa;
        margin-bottom: 10px;
    }

.alt-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin-bottom: 5px;
}

.result-error {
    text-align: center;
    padding: 20px;
    color: #dc3545;
}

.loading-box {
    text-align: center;
    padding: 20px;
}
/* Select2 Dark Theme */
.select2-container {
    width: 100% !important;
}

/*.select2-container--default .select2-selection--single {
    height: 45px;
    padding: 8px 12px;
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        color: #000;
        line-height: 26px;
        padding-left: 0;
    }

    .select2-container--default .select2-selection--single .select2-selection__placeholder {
        color: rgba(255, 255, 255, 0.5);
    }

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 43px;
        right: auto;
        left: 8px;
    }

    .select2-container--default .select2-selection--single .select2-selection__clear {
        margin-left: 10px;
    }

.select2-dropdown {
    background: #57585a;
    border: 1px solid #f01b24;
    border-radius: 8px;
}

.select2-search--dropdown {
    padding: 10px;
}

    .select2-search--dropdown .select2-search__field {
        background: #2a2a3e;
        border: 1px solid #f01b24;
        color: #fff;
        padding: 10px;
        border-radius: 6px;
        outline: none;
    }

        .select2-search--dropdown .select2-search__field:focus {
            border-color: #764ba2;
        }

.select2-results {
    background: #57585a;
}

.select2-results__option {
    padding: 12px 15px;
    color: #fff;
}

.select2-results__option--highlighted[aria-selected] {
    background: #f01b24 !important;
}

.select2-results__option[aria-selected=true] {
    background: rgba(102, 126, 234, 0.3);
}

.select2-results__message {
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 20px;
}*/
/* Swap Button */
.swap-container {
    text-align: center;
    margin: 15px 0;
}
#ai-calc-btn:hover {
    background-color: #57585a !important;
    border-color: #57585a !important;
}
#ai-calc-btn:focus {
    background-color: #57585a !important;
    border-color: #57585a !important;
}
.btn-swap {
    background: #f01b24;
    border: none;
    color: #fff;
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

    .btn-swap:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    }

    .btn-swap:active {
        transform: translateY(0);
    }