/* Form-specific styles shared across all forms */
html {
    overflow-x: hidden;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    margin: 0;
    font-family: 'Poppins', sans-serif;
    color: white;
    position: relative;
    overflow-x: hidden;
}

/* Background Animation */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(214, 31, 28, 0.08) 0%, transparent 70%);
    animation: pulseBackground 15s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes pulseBackground {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.3; }
    50% { transform: scale(1.1) rotate(180deg); opacity: 0.5; }
}

/* Modal Styles */
.modal {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    animation: fadeInModal 0.3s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    margin: 2% auto;
    padding: 35px;
    border-radius: 25px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    animation: slideUpModal 0.4s ease-out;
    position: relative;
    z-index: 1;
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal h2 {
    color: #1a1a2e;
    font-size: 1.8rem;
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
}

.modal p {
    line-height: 1.8;
    margin-bottom: 15px;
    color: #444;
    font-size: 1.05rem;
}

.modal .accept-btn {
    background: linear-gradient(135deg, #d61f1c, #ff3838);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 25px;
    display: block;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(214, 31, 28, 0.3);
}

.modal .accept-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(214, 31, 28, 0.5);
}

.modal .accept-btn:active {
    transform: translateY(-1px);
}

/* Utility */
.hidden {
    display: none !important;
}

/* Chat Widget Styles */
#chat-widget {
    width: 100%;
    max-width: 750px;
    height: 85vh;
    max-height: 800px;
    background: linear-gradient(135deg, #2d2d45 0%, #1a1a2e 100%);
    border-radius: 25px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInChat 0.5s ease-out;
    margin: 30px auto;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes slideInChat {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#chat-header {
    background: linear-gradient(135deg, #2d2d45 0%, #3a3a5a 100%);
    padding: 25px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    z-index: 10;
    position: relative;
    color: #ffffff;
    border-bottom: 2px solid rgba(214, 31, 28, 0.3);
}

#chat-header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #ffffff, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    margin-top: 18px;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #d61f1c, #ff3838, #d61f1c);
    background-size: 200% 100%;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#chat-messages {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
    background: linear-gradient(180deg, #1a1a2e 0%, #2c2c44 100%);
}

#chat-messages::-webkit-scrollbar {
    width: 10px;
}

#chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #5a5a7a, #4a4a6a);
    border-radius: 5px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #6a6a8a, #5a5a7a);
}

.chat-message {
    padding: 16px 22px;
    border-radius: 20px;
    max-width: 85%;
    line-height: 1.7;
    opacity: 0;
    transform: translateY(15px);
    animation: fadeInMessage 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    word-wrap: break-word;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@keyframes fadeInMessage {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    background: linear-gradient(135deg, #5a5a7a 0%, #4a4a6a 100%);
    color: #ffffff;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.bot-message::before {
    content: '🤖';
    position: absolute;
    left: -35px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.user-message {
    background: linear-gradient(135deg, #d61f1c 0%, #ff3838 100%);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.user-message::after {
    content: '👤';
    position: absolute;
    right: -35px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.error-message {
    background: linear-gradient(135deg, #fff5f5, #ffe0e0);
    color: #d61f1c;
    border: 2px solid #d61f1c;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    animation: shakeError 0.5s;
    padding: 16px 22px;
    border-radius: 20px;
    max-width: 85%;
    box-shadow: 0 4px 15px rgba(214, 31, 28, 0.2);
    font-weight: 600;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

.typing-indicator {
    display: flex;
    gap: 8px;
    padding: 18px 24px;
    background: linear-gradient(135deg, #5a5a7a, #4a4a6a);
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    align-self: flex-start;
    max-width: 80px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.typing-dot {
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
    30% { transform: translateY(-12px); opacity: 1; }
}

.summary-message {
    background: linear-gradient(135deg, #5a5a7a 0%, #4a4a6a 100%);
    color: #ffffff;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    padding: 25px;
    border-radius: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.summary-message h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.summary-message ul {
    list-style: none;
    margin: 15px 0 0 0;
    padding: 0;
}

.summary-message li {
    margin: 12px 0;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 8px;
}

.summary-message li:hover {
    background: rgba(255, 255, 255, 0.05);
}

.summary-message li:last-child {
    border-bottom: none;
}

.summary-message li div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.summary-message strong {
    color: #ffffff;
    margin-right: 15px;
    font-weight: 600;
}

.edit-btn {
    background: linear-gradient(135deg, #d61f1c, #ff3838);
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-left: 10px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(214, 31, 28, 0.3);
}

.edit-btn:hover {
    background: linear-gradient(135deg, #ff3838, #d61f1c);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(214, 31, 28, 0.5);
}

.edit-btn:active {
    transform: translateY(0);
}

.final-submit-container {
    width: 100%;
    padding: 15px 0;
    margin-top: 15px;
}

.final-submit-btn {
    background: linear-gradient(135deg, #d61f1c, #ff3838);
    color: white;
    border: none;
    padding: 18px 35px;
    border-radius: 30px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    box-shadow: 0 6px 25px rgba(214, 31, 28, 0.4);
    position: relative;
    overflow: hidden;
}

.final-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.final-submit-btn:hover::before {
    left: 100%;
}

.final-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(214, 31, 28, 0.6);
}

.final-submit-btn:active {
    transform: translateY(-1px);
}

.final-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 3px 15px rgba(214, 31, 28, 0.2);
}


#chat-input-container {
    padding: 25px;
    background: linear-gradient(135deg, #2d2d45 0%, #252540 100%);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Botões de opção - Novo estilo integrado */
.button-options-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    margin: 18px 0;
}

.button-option {
    padding: 18px 24px;
    border: 2px solid rgba(90, 90, 122, 0.5);
    border-radius: 15px;
    background: linear-gradient(135deg, #3a3a5a 0%, #2d2d45 100%);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 14px;
}

.button-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.6s ease;
}

.button-option:hover {
    border-color: #d61f1c;
    background: linear-gradient(135deg, #4a4a6a 0%, #3a3a5a 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(214, 31, 28, 0.25);
}

.button-option:hover::before {
    left: 100%;
}

.button-option.selected {
    border-color: #ff3838;
    background: linear-gradient(135deg, #d61f1c 0%, #ff3838 100%);
    color: #ffffff;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(214, 31, 28, 0.5);
    animation: pulseSelect 0.4s ease-in-out;
}

.button-option:focus {
    outline: 3px solid rgba(214, 31, 28, 0.5);
    outline-offset: 2px;
}

.button-option:active {
    transform: translateY(0);
    transition: transform 0.1s;
}

.button-option.selected::after {
    content: '✓';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-weight: bold;
    font-size: 1.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Animação de seleção */
@keyframes pulseSelect {
    0% { 
        transform: scale(1) translateY(0); 
    }
    50% { 
        transform: scale(1.03) translateY(-2px); 
    }
    100% { 
        transform: scale(1) translateY(-2px); 
    }
}


/* Input styles */
#chat-input-container input[type="text"],
#chat-input-container input[type="tel"],
#chat-input-container input[type="file"],
#chat-input-container textarea,
#chat-input-container select {
    flex-grow: 1;
    width: 100%;
    padding: 16px 20px;
    border: 2px solid rgba(90, 90, 122, 0.3);
    border-radius: 12px;
    font-size: 1.05rem;
    font-family: inherit;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    color: #333;
    min-height: 56px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#chat-input-container input[type="text"]:focus,
#chat-input-container input[type="tel"]:focus,
#chat-input-container textarea:focus,
#chat-input-container select:focus {
    outline: none;
    border-color: #d61f1c;
    box-shadow: 0 0 0 4px rgba(214, 31, 28, 0.15);
    background: #ffffff;
}

#chat-input-container input::placeholder,
#chat-input-container textarea::placeholder {
    color: #999;
}

#chat-input-container select {
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22%23d61f1c%22%3E%3Cpath%20d%3D%22M5.293%207.293a1%201%200%20011.414%200L10%2010.586l3.293-3.293a1%201%200%20111.414%201.414l-4%204a1%201%200%2001-1.414%200l-4-4a1%201%200%20010-1.414z%22%20%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 1.3em;
    padding-right: 50px;
    cursor: pointer;
}

#chat-input-container textarea {
    min-height: 56px;
    height: 56px;
    resize: vertical;
    max-height: 180px;
}

#chat-input-container button {
    padding: 16px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #d61f1c, #ff3838);
    color: #ffffff;
    flex: 1;
    box-shadow: 0 4px 15px rgba(214, 31, 28, 0.4);
    position: relative;
    overflow: hidden;
}

#chat-input-container button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

#chat-input-container button:hover::before {
    left: 100%;
}

#chat-input-container button:hover {
    background: linear-gradient(135deg, #ff3838, #d61f1c);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(214, 31, 28, 0.5);
}

#chat-input-container button:active {
    transform: translateY(-1px);
}

#chat-input-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(214, 31, 28, 0.2);
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    margin: 12px 0;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.file-preview-icon {
    font-size: 1.8rem;
    color: #d61f1c;
}

.file-preview-name {
    font-weight: 600;
}

/* Responsive */
@media (max-width: 600px) {
    #chat-widget {
        height: calc(100vh - 20px);
        height: calc(100dvh - 20px);
        max-height: none;
        margin: 10px;
        max-width: calc(100% - 20px);
        border-radius: 20px;
        min-height: 500px;
    }

    #chat-header {
        padding: 18px 15px;
    }

    #chat-header h1 {
        font-size: 1.4rem;
    }

    #chat-messages {
        padding: 15px 12px;
        padding-bottom: 20px;
        gap: 12px;
    }

    #chat-input-container {
        padding: 15px 12px;
        position: sticky;
        bottom: 0;
        gap: 10px;
    }

    .chat-message {
        max-width: 85%;
        padding: 14px 16px;
        font-size: 1rem;
        line-height: 1.6;
    }

    .bot-message::before,
    .user-message::after {
        display: none;
    }

    .button-options-container {
        gap: 10px;
        margin: 12px 0;
    }

    .button-option {
        padding: 16px 18px;
        font-size: 1rem;
        min-height: 52px;
        text-align: left;
    }

    .modal-content {
        width: 95%;
        max-width: calc(100% - 20px);
        margin: 5vh auto;
        padding: 25px 20px;
        border-radius: 20px;
        max-height: 85vh;
        max-height: 85dvh;
    }

    .modal h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    .modal p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .final-submit-btn {
        padding: 16px 28px;
        font-size: 1.05rem;
        min-height: 52px;
    }

    /* Touch targets mínimos para mobile */
    #chat-input-container input[type="text"],
    #chat-input-container input[type="tel"],
    #chat-input-container textarea,
    #chat-input-container select {
        font-size: 16px; /* Previne zoom automático no iOS */
        min-height: 52px;
        padding: 14px 16px;
    }

    #chat-input-container button {
        min-height: 52px;
        padding: 14px 24px;
        font-size: 1rem;
    }

    .edit-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
        min-height: 36px;
    }

    .summary-message {
        padding: 20px 16px;
    }

    .summary-message h3 {
        font-size: 1.15rem;
    }

    .summary-message li {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 8px;
    }

    .summary-message li div {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .summary-message strong {
        margin-right: 0;
        margin-bottom: 5px;
    }
}

@media (min-width: 601px) {
    .button-options-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .button-option {
        text-align: center;
        padding: 18px 16px;
        justify-content: center;
    }
}

/* Melhoria para teclados virtuais */
@media (max-width: 600px) {
    body.keyboard-open #chat-widget {
        height: calc(100vh - 20px);
    }
    
    body.keyboard-open #chat-messages {
        padding-bottom: 120px;
    }
}

/* Otimização para telas muito pequenas */
@media (max-width: 360px) {
    #chat-header h1 {
        font-size: 1.2rem;
    }

    .chat-message {
        font-size: 0.95rem;
        padding: 12px 14px;
    }

    .button-option {
        font-size: 0.95rem;
        padding: 14px 16px;
    }

    #chat-input-container {
        padding: 12px 10px;
    }
}