/* Telegram Chat Widget Styles */

.telegram-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.telegram-widget__button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    box-shadow: 0 4px 20px rgba(34, 158, 217, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
}

.telegram-widget__button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(34, 158, 217, 0.5);
}

.telegram-widget__button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.telegram-widget__button .telegram-widget__close-icon {
    display: none;
}

.telegram-widget__button.is-open .telegram-widget__chat-icon {
    display: none;
}

.telegram-widget__button.is-open .telegram-widget__close-icon {
    display: block;
}

.telegram-widget__tooltip {
    position: absolute;
    right: 70px;
    bottom: 10px;
    background: #333;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.telegram-widget__tooltip::before {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 14px;
    border: 8px solid transparent;
    border-left-color: #333;
}

.telegram-widget__button:hover .telegram-widget__tooltip {
    opacity: 1;
    visibility: visible;
}

.telegram-widget__chat {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.telegram-widget__chat.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.telegram-widget__chat-header {
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    color: white;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.telegram-widget__chat-header-icon {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.telegram-widget__chat-header-icon svg {
    width: 18px;
    height: 18px;
    fill: #0088cc;
}

.telegram-widget__chat-header-text h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.telegram-widget__chat-header-text p {
    margin: 2px 0 0;
    font-size: 11px;
    opacity: 0.9;
}

.telegram-widget__chat-body {
    padding: 12px;
    background: #f5f7fa;
}

.telegram-widget__chat-message {
    background: white;
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    font-size: 12px;
    line-height: 1.4;
    color: #333;
}

.telegram-widget__chat-message p {
    margin: 0 0 6px;
}

.telegram-widget__chat-message p:last-child {
    margin-bottom: 0;
}

.telegram-widget__chat-button {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    color: white;
    text-decoration: none;
    text-align: center;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.telegram-widget__chat-button:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.telegram-widget__chat-button svg {
    width: 14px;
    height: 14px;
    fill: white;
}

/* Responsive */
@media (max-width: 480px) {
    .telegram-widget {
        bottom: 16px;
        right: 16px;
    }

    .telegram-widget__button {
        width: 52px;
        height: 52px;
    }

    .telegram-widget__button svg {
        width: 24px;
        height: 24px;
    }

    .telegram-widget__chat {
        width: calc(100vw - 32px);
        right: 0;
        left: 0;
        margin: 0 auto;
    }
}

/* Pulse animation for button */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 158, 217, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(34, 158, 217, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 158, 217, 0);
    }
}

.telegram-widget__button:not(.is-open) {
    animation: pulse 2s infinite;
}

/* Close button in header */
.telegram-widget__close-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.telegram-widget__close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.telegram-widget__close-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Tabs */
.telegram-widget__tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tab-button {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    background: rgba(0, 136, 204, 0.1);
    border: 1px solid rgba(0, 136, 204, 0.3);
    border-radius: 8px;
    color: #0088cc;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-button:hover {
    background: rgba(0, 136, 204, 0.2);
    border-color: rgba(0, 136, 204, 0.5);
}

.tab-button.active {
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    border-color: transparent;
    color: white;
}

.tab-button:focus {
    outline: 2px solid rgba(0, 136, 204, 0.5);
    outline-offset: 2px;
}

/* Form */
.telegram-widget__form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #e0e0e0;
}

.form-group input,
.form-group textarea {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0088cc;
    background: rgba(255, 255, 255, 0.08);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group input.error,
.form-group textarea.error {
    border-color: #ff4444;
}

.error-message {
    font-size: 11px;
    color: #ff4444;
    min-height: 14px;
}

.telegram-widget__submit-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    margin-top: 8px;
}

.telegram-widget__submit-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: scale(1.02);
}

.telegram-widget__submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.telegram-widget__submit-btn .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Feedback messages */
.telegram-widget__feedback {
    margin-bottom: 12px;
}

.feedback-message {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

.feedback-message.success {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.feedback-message.error {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #f44336;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .telegram-widget__chat {
        width: calc(100vw - 32px);
        max-width: none;
    }

    .telegram-widget__tabs {
        gap: 6px;
    }

    .tab-button {
        padding: 10px 8px;
        font-size: 11px;
    }

    .form-group input,
    .form-group textarea {
        min-height: 44px;
        padding: 12px;
    }

    .telegram-widget__submit-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}
