/* Основной контейнер виджета */
#support-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: height 0.5s ease, width 0.5s ease, border-radius 0.5s ease, opacity 0.5s ease;
    overflow: hidden;
}

/* Заголовок виджета */
.widget-header {
    background: #3b82f6;
    color: #ffffff;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    height: 40px;
    box-sizing: border-box;
}

.widget-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.widget-header i.widget-icon {
    margin-right: 8px;
    font-size: 18px;
}

#toggle-widget {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s ease;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    display: none; /* По умолчанию скрыта */
}

#toggle-widget i {
    font-size: 16px;
}

#support-widget.widget-expanded #toggle-widget {
    display: flex; /* Показываем кнопку только в разжатом состоянии */
}

#support-widget.widget-collapsed #toggle-widget {
    display: none; /* Скрываем кнопку в свёрнутом состоянии */
}

#toggle-widget:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.3);
}

/* Тело виджета */
.widget-body {
    padding: 20px;
    display: none;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

/* Состояния виджета */
#support-widget.widget-collapsed {
    width: 60px !important;
    height: 60px !important;
    opacity: 0.9;
    background: #3b82f6 !important;
    border-radius: 50% !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

#support-widget.widget-collapsed .widget-header {
    width: 100%;
    height: 100%;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
}

#support-widget.widget-collapsed .widget-header h3 {
    display: none;
}

#support-widget.widget-collapsed .widget-header i.widget-icon {
    display: flex !important;
    margin: 0;
    font-size: 24px;
    color: #ffffff;
}

#support-widget.widget-collapsed .widget-body {
    display: none;
    animation: slideUp 0.5s ease;
    height: 0;
    overflow: hidden;
}

#support-widget.widget-expanded {
    width: 320px !important;
    height: auto !important;
    opacity: 1;
    border-radius: 12px !important;
}

#support-widget.widget-expanded .widget-body {
    display: block;
    animation: slideDown 0.5s ease;
}

/* Анимация разворачивания */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Анимация сворачивания */
@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Стили для формы */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2937;
    background: #ffffff;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Кнопка отправки */
button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    box-sizing: border-box;
}

button[type="submit"]:hover {
    background: #1e40af;
}

button[type="submit"]:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Стили для reCAPTCHA */
.g-recaptcha {
    margin-bottom: 16px;
    transform: scale(0.95);
    transform-origin: 0 0;
}

/* Адаптивность */
@media (max-width: 600px) {
    #support-widget {
        width: 90%;
        max-width: 320px;
        right: 5%;
        bottom: 15px;
    }

    .g-recaptcha {
        transform: scale(0.80);
        transform-origin: 0 0;
    }

    #support-widget.widget-collapsed {
        width: 50px !important;
        height: 50px !important;
    }

    #support-widget.widget-collapsed .widget-header i.widget-icon {
        font-size: 20px;
    }

    #toggle-widget {
        width: 20px;
        height: 20px;
    }

    #toggle-widget i {
        font-size: 14px;
    }

    .widget-header {
        height: 40px;
        padding: 10px 16px;
    }
}
