/* ========================================
   COHAB CURITIBA - PROGRAMA ESCRITURA NA MÃO
   Tema: Verde/Azul Institucional
======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #003B73 0%, #001A33 100%);
    color: #333;
    line-height: 1.6;
}

/* HEADER */
.header {
    background: #ffffff;
    padding: 10px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 4px solid #1a5a3a;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    text-align: center;
}

.cohab-logo-img {
    height: 45px;
    width: auto;
}

/* CHAT CONTAINER */
.chat-container {
    display: flex;
    justify-content: center;
    padding: 10px;
    /* Reduzido de 30px 20px */
    min-height: calc(100vh - 140px);
    /* Ajustado */
}

.chat-box {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 1000px;
    /* Bem mais largo */
    height: 80vh;
    /* Altura responsiva ocupando 80% da tela */
    min-height: 600px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    gap: 15px;
    font-size: 1.1rem;
    /* Aumentado para legibilidade */
}

/* INIT MESSAGE */
.init-message-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.init-message {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #1a5a3a, #2d7a4e);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(26, 90, 58, 0.3);
    font-size: 14px;
}

/* Images inside bubbles */
.bubble img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
    margin: 4px 0;
}

/* Allow bubbles with images to be wider */
.message.bot .bubble:has(img) {
    max-width: 95%;
    /* Aumentado de 80% */
    padding: 8px;
    /* Menos padding para aproveitar espaço */
}

.logos-footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 15px;
    margin-top: 8px;
    padding: 10px;
    background: white;
    border-radius: 12px;
}

.logos-footer img {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

.user-msg-indicator {
    position: absolute;
    right: 15px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

/* MESSAGES */
.message {
    display: flex;
    margin: 12px 0;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

/* AVATAR */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

/* CHAT BUBBLES */
.bubble {
    padding: 14px 18px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 15px;
}

.message.bot .bubble {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message.user .bubble {
    background: linear-gradient(135deg, #1a5a3a, #2d7a4e);
    color: white;
    border-bottom-right-radius: 4px;
}

/* TYPING INDICATOR */
.typing-bubble {
    display: flex;
    gap: 6px;
    padding: 14px 20px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.typing-bubble .dot {
    width: 8px;
    height: 8px;
    background: #1a5a3a;
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}

.typing-bubble .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-bubble .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }
}

/* INPUT AREA */
.input-area {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
}

#userInput {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
}

#userInput:focus {
    border-color: #1a5a3a;
}

#sendButton {
    background: linear-gradient(135deg, #1a5a3a, #2d7a4e);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#sendButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(26, 90, 58, 0.4);
}

/* BUTTONS */
.button-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-start;
}

.option-btn {
    background: #1a5a3a;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.option-btn:hover {
    background: #0d3d2a;
    transform: translateY(-2px);
}

/* FOOTER */
/* FOOTER */
.cohab-footer {
    width: 100%;
    background: #ffffff;
    margin-top: auto;
}

/* Linha divisória elegante */
.footer-divider {
    height: 4px;
    background: linear-gradient(90deg, #1a5a32 0%, #2d8a4e 50%, #1a5a32 100%);
    width: 100%;
}

/* Container principal - Layout de 3 colunas */
.footer-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Coluna esquerda - COHAB */
.footer-col-left {
    flex: 1;
    min-width: 180px;
}

.footer-logo-main {
    height: 50px;
    width: auto;
    margin-bottom: 8px;
}

.footer-tagline {
    font-size: 11px;
    color: #555;
    line-height: 1.3;
    margin: 0;
}

/* Coluna central - Informações */
.footer-col-center {
    flex: 2;
    min-width: 280px;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    padding: 0 25px;
}

.footer-program-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a5a32;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-program-desc {
    font-size: 12px;
    color: #666;
    margin: 0 0 12px 0;
}

.footer-contact-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-contact-info span {
    font-size: 11px;
    color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.footer-contact-info i {
    color: #1a5a32;
    width: 14px;
}

/* Coluna direita - Parceiros */
.footer-col-right {
    flex: 1;
    min-width: 180px;
}

.footer-partners-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 10px 0;
}

.footer-partners-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.footer-partners-logos img:first-child {
    height: 85px;
    width: auto;
}

.footer-partners-logos img:last-child {
    height: 65px;
    width: auto;
}

/* Barra inferior */
.footer-bottom {
    background: #1a5a32;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    font-size: 11px;
}

.footer-bottom span {
    opacity: 0.9;
}

.footer-lgpd {
    opacity: 0.7 !important;
}

/* Responsivo para mobile - mantém horizontal, só reduz tamanhos */
@media (max-width: 768px) {
    .footer-main {
        flex-direction: row;
        padding: 12px 15px;
        gap: 10px;
    }

    .footer-col {
        min-width: auto;
    }

    .footer-col-left {
        flex: 0.8;
    }

    .footer-logo-main {
        height: 35px;
    }

    .footer-tagline {
        font-size: 8px;
        display: none;
    }

    .footer-col-center {
        flex: 1.5;
        padding: 0 10px;
        border-left: 1px solid #e0e0e0;
        border-right: 1px solid #e0e0e0;
    }

    .footer-program-title {
        font-size: 11px;
    }

    .footer-program-desc {
        font-size: 9px;
        margin-bottom: 6px;
    }

    .footer-contact-info {
        gap: 2px;
    }

    .footer-contact-info span {
        font-size: 8px;
    }

    .footer-col-right {
        flex: 1;
    }

    .footer-partners-label {
        font-size: 8px;
        margin-bottom: 5px;
    }

    .footer-partners-logos {
        gap: 8px;
    }

    .footer-partners-logos img:first-child {
        height: 55px;
    }

    .footer-partners-logos img:last-child {
        height: 42px;
    }

    .footer-bottom {
        flex-direction: row;
        gap: 15px;
        padding: 8px 15px;
        font-size: 9px;
    }
}

.footer-small {
    font-size: 11px;
    opacity: 0.7;
}

/* CRITICAL: Force inline elements to stay inline */
.bubble strong,
.bubble b,
.bubble em,
.bubble i,
.bubble span {
    display: inline !important;
    float: none !important;
}

.bubble {
    white-space: normal !important;
}

/* Styled DIVS IN MESSAGES */
.message.bot div[style] {
    max-width: 100%;
    display: block;
}

.bubble br {
    display: inline;
    content: " ";
}

.bubble br::after {
    content: "\A";
    white-space: pre;
}

/* ============================================
   MODAL DE DOCUMENTO/PIX
============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content.documento-modal {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 1100px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: linear-gradient(135deg, #1a5a3a, #2d7a4e);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.2rem;
    margin: 0;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* PDF Preview Area */
.pdf-preview-area {
    flex: 1.5;
    background: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    border-right: 1px solid #e0e0e0;
}

.pdf-loading {
    text-align: center;
    color: #666;
}

.pdf-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: #1a5a3a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.pdf-frame {
    width: 100%;
    height: 100%;
    border: none;
    min-height: 500px;
}

/* PIX Area */
.pix-area {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #fafafa;
    max-width: 400px;
}

.pix-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1a5a3a;
}

.pix-header h3 {
    margin: 0;
    color: #1a5a3a;
}

.pix-icon {
    font-size: 1.5rem;
}

.pix-qr-container {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#pixQrCode {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

#pixQrCode img,
#pixQrCode canvas {
    max-width: 180px !important;
    max-height: 180px !important;
}

.pix-valor {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1a5a3a;
    margin: 10px 0 0 0;
}

.pix-code-section {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pix-code-label {
    font-weight: bold;
    color: #333;
    margin: 0 0 10px 0;
    font-size: 0.9rem;
}

.pix-code-box {
    background: #f0f0f0;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    word-break: break-all;
    color: #333;
    max-height: 80px;
    overflow-y: auto;
    border: 1px solid #ddd;
    margin-bottom: 10px;
}

.copy-pix-btn {
    width: 100%;
    background: #1a5a3a;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.copy-pix-btn:hover {
    background: #2d7a4e;
    transform: translateY(-2px);
}

.copy-pix-btn.copied {
    background: #28a745;
}

.pix-security {
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    padding: 8px;
    background: #e8f5e9;
    border-radius: 8px;
}

.pix-timer {
    text-align: center;
    background: #fff3cd;
    padding: 10px;
    border-radius: 8px;
    color: #856404;
    font-weight: bold;
}

/* Modal Footer */
.modal-footer {
    padding: 16px 24px;
    background: #f5f5f5;
    display: flex;
    gap: 15px;
    justify-content: center;
    border-top: 1px solid #e0e0e0;
}

.btn-download {
    background: #0d47a1;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-download:hover {
    background: #1565c0;
}

.btn-prosseguir {
    background: #1a5a3a;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-prosseguir:hover {
    background: #2d7a4e;
}

/* Responsive Modal */
@media (max-width: 900px) {
    .modal-overlay {
        padding: 10px;
    }

    .modal-content.documento-modal {
        max-height: 95vh;
    }

    .modal-body {
        flex-direction: column;
    }

    /* PDF área compacta em mobile */
    .pdf-preview-area {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        min-height: 200px;
        max-height: 250px;
        flex: none;
    }

    .pdf-frame {
        min-height: 200px;
    }

    .pix-area {
        max-width: 100%;
        flex: 1;
    }

    .modal-footer {
        flex-direction: column;
        padding: 12px 16px;
    }

    .btn-download,
    .btn-prosseguir {
        width: 100%;
        padding: 14px;
    }
}

/* Telas muito pequenas (celulares) */
@media (max-width: 480px) {
    .modal-overlay {
        padding: 0;
    }

    .modal-content.documento-modal {
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    /* ESCONDER PDF no celular - mostrar apenas PIX */
    .pdf-preview-area {
        display: none !important;
    }

    /* Mostrar botões de documento no mobile */
    .mobile-doc-buttons {
        display: flex !important;
    }

    .pix-area {
        max-width: 100%;
        flex: 1;
        padding: 15px;
    }

    .modal-body {
        flex-direction: column;
    }

    .pix-area {
        padding: 15px;
        gap: 12px;
    }

    .pix-qr-container {
        padding: 10px;
    }

    #pixQrCode img,
    #pixQrCode canvas {
        max-width: 140px !important;
        max-height: 140px !important;
    }

    .pix-valor {
        font-size: 1.3rem;
    }

    .pix-code-text {
        font-size: 10px;
        padding: 8px;
    }

    .pix-timer {
        padding: 8px;
        font-size: 0.9rem;
    }

    .modal-footer {
        gap: 10px;
    }
}

/* Botões de documento para mobile - escondidos por padrão */
.mobile-doc-buttons {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    padding: 0 10px;
}

.doc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-doc-btn {
    background: linear-gradient(135deg, #1a5a32, #2d7a4d);
    color: white;
}

.view-doc-btn:hover {
    background: linear-gradient(135deg, #155028, #247040);
}

.download-doc-btn {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.download-doc-btn:hover {
    background: #e8e8e8;
}