:root {
    --primary: #4a90e2;
    --primary-dark: #357abd;
    --secondary: #fdfaf5;
    --accent: #e67e22;
    --text-main: #34495e;
    --text-muted: #7f8c8d;
    --bg-main: #f0f4f8;
    --card-bg: #ffffff;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --border-radius: 16px;
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-main);
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)), url('assets/sky_bg.png');
    background-size: cover;
    background-position: center bottom;
    background-attachment: fixed;
    z-index: -1;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 120px; /* Espaço para o banner fixo */
    display: flex;
    flex-direction: column;
}

/* Banner de Doação */
.donation-banner {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    margin: 0;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    overflow: hidden;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 1000;
}

.donation-image {
    width: 80px;
    min-width: 80px;
}

.donation-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.donation-content {
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.donation-content h2 {
    font-size: 0.75rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 2px;
    line-height: 1.1;
}

.donation-content p {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.donation-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    width: fit-content;
    margin-bottom: 6px;
    transition: transform 0.2s;
}

.donation-btn:hover {
    transform: scale(1.05);
}

/* Logo Central */
.main-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.dove-icon {
    width: 230px;
    filter: drop-shadow(0 5px 15px rgba(255, 255, 255, 0.8));
}

.main-logo h1 {
    font-size: 2.5rem;
    font-weight: 400;
    color: #2c3e50;
    letter-spacing: -1px;
}

.main-logo h1 span {
    font-weight: 800;
    color: var(--primary);
}

/* Home Screen */
.home-screen {
    padding: 0 20px;
    animation: fadeIn 0.5s ease;
}

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

/* Seções como Master Cards */
.consultar-section, .message-section {
    background: #fdfaf5;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}

.section-title {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: #2c3e50;
}

.section-title i {
    margin-right: 10px;
    color: var(--accent);
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(0,0,0,0.1);
    margin-left: 15px;
}

/* Espalhar "sparkles" no título da mensagem */
.title-sparkles {
    font-size: 0.8rem;
    color: var(--accent);
    margin-left: 8px;
    opacity: 0.7;
}

/* Mode Cards Refined */
.mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mode-card {
    padding: 15px 10px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Card Offline: Bege/Amarelo */
#card-offline {
    background-color: #f9f2e7;
}

/* Card IA: Azul */
#card-online {
    background-color: #dbeef9;
}

.mode-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.card-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
    background: none;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-info h3 {
    font-size: 0.8rem;
    font-weight: 700;
    color: #5d4037;
    margin-bottom: 8px;
    min-height: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-info p {
    font-size: 0.65rem;
    line-height: 1.2;
}

.card-info .subtitle {
    font-weight: 600;
    color: #8d6e63;
    padding-top: 5px;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 2px;
}

.card-info .desc {
    color: var(--text-muted);
}

/* Message Card Refined */
.message-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 220px;
}

.message-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 100%);
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    color: white;
}

.main-quote {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 10px;
    font-style: italic;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.quote-source {
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.3);
    margin-bottom: 15px;
}

.quote-source p {
    font-size: 0.75rem;
    opacity: 0.9;
}

.full-msg-btn {
    background: #fdfaf5;
    color: #2c3e50;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    align-self: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.full-msg-btn:hover {
    background: white;
    transform: translateY(-2px);
}

/* Active View (Chat/Search) */
.active-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 20px;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { transform: translateY(100vh); }
    to { transform: translateY(0); }
}

.view-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--primary);
    cursor: pointer;
    margin-right: 15px;
}

.view-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #2c3e50;
}

.hidden {
    display: none !important;
}

/* Results and Chat bubbles */
.results-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px;
}

.chat-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 75px;
}

.chat-messages {
    scroll-behavior: smooth;
}

.chat-bubble {
    display: flex;
    max-width: 90%;
    gap: 10px;
}

.chat-bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-text {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.chat-bubble.ia .chat-text {
    background: white;
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.chat-bubble.user .chat-text {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-ia-icon, .chat-user-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chat-ia-icon { color: var(--primary); }
.chat-user-icon { color: var(--text-muted); }

/* Input Bar (Styled for Chat Mode) */
.chat-input-area {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    display: flex;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 900;
    border-radius: 0 0 20px 20px;
}

.chat-input-area input {
    flex: 1;
    border: 1px solid rgba(0,0,0,0.1);
    padding: 12px 20px;
    border-radius: 25px;
    outline: none;
    font-size: 16px;
    font-family: var(--font-main);
}

/* Hide contact FAB when chat/search view is active */
.contact-fab.fab-hidden {
    display: none !important;
}

.chat-input-area button {
    background: var(--primary);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Result Cards (Offline Search) */
.result-card {
    background: white;
    padding: 18px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    animation: cardFadeIn 0.3s ease both;
}

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

.result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

.result-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-book i {
    margin-right: 5px;
}

.result-content {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Offline Search Box */
.search-box {
    background: white;
    padding: 12px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.search-box input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 1rem;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 62, 80, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-box {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: var(--border-radius);
    padding: 40px 30px;
    position: relative;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f1f2f6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
}

.modal-book {
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.modal-chapter {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 10px 0 25px 0;
    color: #2c3e50;
}

/* Media Queries para Mobile - Compactação Total */
@media (max-width: 600px) {
    .app-container {
        padding-bottom: 110px;
    }

    .main-logo {
        margin: 10px 0;
        gap: 10px;
    }

    .dove-icon {
        width: 230px;
    }

    .main-logo h1 {
        font-size: 2rem;
    }

    .consultar-section, .message-section {
        padding: 15px 20px;
        margin-bottom: 12px;
    }

    .section-title {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .mode-cards {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 8px;
    }

    .mode-card {
        padding: 15px 18px;
        flex-direction: row;
        align-items: center;
        text-align: left;
        gap: 18px;
    }

    .card-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 0px;
    }
    
    .card-info h3 {
        font-size: 1.3rem;
        margin-bottom: 4px;
        justify-content: flex-start;
    }

    .card-info p {
        font-size: 1rem;
    }

    .message-card {
        height: 180px; 
    }

    .main-quote {
        font-size: 1.1rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        margin-bottom: 4px;
    }

    .quote-source {
        padding-top: 5px;
        margin-bottom: 8px;
        border-top: 1px solid rgba(255,255,255,0.2);
    }

    .quote-source p {
        font-size: 0.85rem;
    }

    .full-msg-btn {
        padding: 6px 18px;
        font-size: 0.8rem;
    }

    .donation-banner {
        height: 80px;
    }

    .donation-image {
        width: 60px;
        min-width: 60px;
    }

    .chat-input-area {
        top: 55px;
        padding: 8px 15px;
    }

    .chat-input-area input {
        font-size: 1rem;
    }
}
/* Fix overflow no banner de doação mobile */
@media (max-width: 600px) {
    .donation-content { padding: 6px 10px !important; }
    .donation-content h2 { font-size: 0.85rem !important; margin-bottom: 1px !important; line-height: 1 !important; }
    .donation-content p { font-size: 0.75rem !important; margin-bottom: 3px !important; }
    .donation-btn { padding: 4px 12px !important; font-size: 0.75rem !important; margin-bottom: 4px !important; }
}

/* PIX Modal Styles Refined */
.pix-modal {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 20px !important;
}

.pix-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

.pix-logo-small {
    width: 40px;
    height: auto;
    filter: drop-shadow(0 2px 5px rgba(50, 181, 164, 0.2));
}

.pix-title-inline {
    font-size: 1.3rem;
    font-weight: 800;
    color: #32b5a4;
    margin: 0;
}

.pix-qr-container {
    background: #ffffff;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
    border: 1px solid #eee;
    width: fit-content;
}

.pix-qr-code {
    width: 160px; /* Reduzido para mobile */
    height: 160px;
    object-fit: contain;
    display: block;
    margin: 0 auto 5px auto;
}

.qr-hint {
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
    margin: 0;
}

.copy-btn {
    background: #32b5a4;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(50, 181, 164, 0.4);
    width: 100%;
    max-width: 250px;
    margin-bottom: 10px;
}

.copy-btn:hover {
    background: #289486;
    transform: translateY(-2px);
}

.copy-success-message {
    margin-bottom: 15px;
    color: #32b5a4;
    font-weight: 700;
    font-size: 0.85rem;
    min-height: 1.2em;
}

.pix-code-container {
    width: 100%;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px dashed #ccc;
    word-break: break-all;
}

.pix-code-box {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    color: #666;
}

.pix-message-end {
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.5;
    margin-top: 5px;
    padding: 10px;
    background: rgba(50, 181, 164, 0.05);
    border-radius: 8px;
    font-style: italic;
    text-align: left;
}

/* ─────────────────────────────────────────────────────────────
   FLOATING CONTACT BUTTON (FAB)
   ───────────────────────────────────────────────────────────── */

.contact-fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 1100;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    transition: all 0.3s ease;
    animation: fabPulse 2s infinite;
    overflow: hidden;
}

.contact-fab .fab-label {
    display: none;
}

.contact-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
    animation: none;
    width: auto;
    border-radius: 28px;
    padding: 0 20px;
    gap: 8px;
}

.contact-fab:hover .fab-label {
    display: inline;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

@keyframes fabPulse {
    0% { box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5); }
    50% { box-shadow: 0 6px 30px rgba(102, 126, 234, 0.8), 0 0 0 10px rgba(102, 126, 234, 0.1); }
    100% { box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5); }
}

/* ─────────────────────────────────────────────────────────────
   CONTACT MODAL
   ───────────────────────────────────────────────────────────── */

.contact-modal {
    text-align: left;
    padding: 30px 25px !important;
    max-width: 480px;
}

.contact-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.contact-header-icon {
    font-size: 1.5rem;
    color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #2c3e50;
    margin: 0;
}

.contact-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    padding-left: 57px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group label i {
    color: #667eea;
    font-size: 0.75rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: var(--font-main);
    color: var(--text-main);
    transition: all 0.3s ease;
    background: #f8fafc;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #a0aec0;
}

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

.contact-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 25px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    margin-top: 5px;
}

.contact-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.contact-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.contact-submit-btn.sending {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
    box-shadow: 0 4px 15px rgba(113, 128, 150, 0.3);
}

.contact-feedback {
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 5px;
}

.contact-feedback.success {
    background: rgba(72, 187, 120, 0.1);
    color: #2f855a;
    border: 1px solid rgba(72, 187, 120, 0.2);
}

.contact-feedback.error {
    background: rgba(245, 101, 101, 0.1);
    color: #c53030;
    border: 1px solid rgba(245, 101, 101, 0.2);
}

/* Contact Modal Mobile */
@media (max-width: 600px) {
    .contact-fab {
        bottom: 90px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 1.1rem;
    }

    .contact-fab:hover {
        width: 50px;
        border-radius: 50%;
        padding: 0;
    }

    .contact-fab:hover .fab-label {
        display: none;
    }

    .contact-modal {
        padding: 20px 18px !important;
    }

    .contact-subtitle {
        padding-left: 0;
        margin-top: 5px;
    }

    .form-group input,
    .form-group textarea {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .contact-submit-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}
