/* Botão Flutuante de Chamados (Estilo WhatsApp)
 * bottom: acima do .tpe-back-to-top (#back-to-top), que usa bottom: 1.5rem em style.css
 * (último termo: vão entre o botão de chamado e o de topo; 24→20→16px conforme o breakpoint)
 * right: mesmo ancoramento horizontal que .tpe-back-to-top (right: 1.25rem), ajustado para
 * alinhar o centro do círculo ao do botão de topo (assume ~48px de largura na seta). */
.tpe-floating-ticket-button {
    position: fixed;
    bottom: calc(1.5rem + 48px + 24px);
    right: calc(1.25rem + 24px - 30px);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366;
    border: none;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: tpe-float-in 0.5s ease-out;
}

.tpe-floating-ticket-button:hover {
    background: #20BA5A;
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5);
    transform: scale(1.05);
}

.tpe-floating-ticket-button:active {
    transform: scale(0.95);
}

.tpe-floating-ticket-button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.75);
    outline-offset: 2px;
}

.tpe-floating-ticket-button__icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.tpe-floating-ticket-button__icon svg {
    width: 28px;
    height: 28px;
    display: block;
    flex-shrink: 0;
}

.tpe-floating-ticket-button__icon svg path {
    fill: #ffffff !important;
}

.tpe-floating-ticket-button__icon svg circle {
    fill: #25D366 !important;
}

@keyframes tpe-float-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal de Chamado */
.tpe-user-ticket-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.tpe-user-ticket-modal.is-open {
    display: flex;
}

.tpe-user-ticket-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.tpe-user-ticket-modal__content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    min-width: 320px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
    animation: tpe-modal-in 0.3s ease-out;
}

@keyframes tpe-modal-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tpe-user-ticket-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
    flex-shrink: 0;
    overflow: visible;
}

.tpe-user-ticket-modal__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    flex: 1;
}

.tpe-user-ticket-modal__close {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    color: #374151;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    margin-left: 0.75rem;
    opacity: 1;
    visibility: visible;
}

.tpe-user-ticket-modal__close:hover {
    background: #f3f4f6;
    color: #111827;
}

.tpe-user-ticket-modal__close:active {
    background: #e5e7eb;
    color: #111827;
}

.tpe-user-ticket-modal__close:focus {
    outline: 2px solid #0a6bff;
    outline-offset: 2px;
}

.tpe-user-ticket-modal__close svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
    pointer-events: none;
}

.tpe-user-ticket-modal__close-icon {
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 700;
    pointer-events: none;
}

.tpe-user-ticket-modal__body {
    padding: 1.5rem;
    min-width: 0;
    overflow-y: auto;
    flex: 1;
}

.tpe-user-ticket-form {
    width: 100%;
    min-width: 0;
}

.tpe-user-ticket-form__field {
    margin-bottom: 1.25rem;
}

.tpe-user-ticket-form__label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.tpe-user-ticket-form__select,
.tpe-user-ticket-form__textarea,
.tpe-user-ticket-form__input {
    width: 100%;
    min-width: 0;
    padding: 0.60rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.tpe-user-ticket-form__input {
    min-height: 2.75rem;
}

.tpe-user-ticket-form__input:focus {
    outline: none;
    border-color: #0a6bff;
    box-shadow: 0 0 0 3px rgba(10, 107, 255, 0.1);
}

.tpe-user-ticket-form__select {
    min-width: 250px;
    max-width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    cursor: pointer;
}

.tpe-user-ticket-form__select option {
    padding: 0.5rem;
    white-space: normal;
    word-wrap: break-word;
}

.tpe-user-ticket-form__select:focus,
.tpe-user-ticket-form__textarea:focus {
    outline: none;
    border-color: #0a6bff;
    box-shadow: 0 0 0 3px rgba(10, 107, 255, 0.1);
}

.tpe-user-ticket-form__textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.tpe-user-ticket-form__submit {
    width: 100%;
    padding: 0.875rem;
    background: #0a6bff;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tpe-user-ticket-form__submit:hover:not(:disabled) {
    background: #084ec4;
}

.tpe-user-ticket-form__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tpe-form-message {
    padding: 0.875rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.tpe-form-message--success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.tpe-form-message--error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

body.tpe-modal-open {
    overflow: hidden;
}

/* Responsividade */
@media (max-width: 768px) {
    .tpe-floating-ticket-button {
        width: 56px;
        height: 56px;
        bottom: calc(1.5rem + 48px + 20px);
        right: calc(1.25rem + 24px - 28px);
    }

    .tpe-floating-ticket-button__icon {
        width: 24px;
        height: 24px;
    }

    .tpe-user-ticket-modal__content {
        width: 95%;
        max-height: 95vh;
        min-width: 280px;
    }

    .tpe-user-ticket-modal__header,
    .tpe-user-ticket-modal__body {
        padding: 1.25rem;
    }

    .tpe-user-ticket-form__select {
        min-width: 200px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .tpe-floating-ticket-button {
        width: 52px;
        height: 52px;
        bottom: calc(1.5rem + 48px + 16px);
        right: calc(1.25rem + 24px - 26px);
    }

    .tpe-user-ticket-modal__content {
        border-radius: 8px;
        min-width: 260px;
        width: 98%;
    }

    .tpe-user-ticket-form__select {
        min-width: 180px;
        font-size: 0.9375rem;
    }

    .tpe-user-ticket-modal__body {
        padding: 1rem;
    }
}

