/**
 * Mensageiro de Fé - Main Styles
 * Desenvolvido por B20 Conteúdo Digital
 * https://www.b20.com.br
 */

/* CSS Variables */
:root {
    --primary-color: #635BFF;
    --secondary-color: #00D4FF;
    --accent-color: #0048E5;
    --surface-color: #FFFFFF;
    --text-color: #0A2540;
    
    --primary-hover: color-mix(in srgb, var(--primary-color) 85%, black);
    --primary-light: color-mix(in srgb, var(--primary-color) 15%, white);
    --bg-color: #ffffff;
    --text-muted: color-mix(in srgb, var(--text-color) 60%, transparent);
    --text-secondary: #666666;
    
    --border-radius: 12px;
    --spacing-unit: 8px;
    --transition: all 0.3s ease;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #121212;
        --surface-color: #1e1e1e;
        --text-color: #ffffff;
        --text-secondary: #cccccc;
        --text-muted: color-mix(in srgb, var(--text-color) 70%, transparent);
    }
}

[data-theme="dark"] {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: color-mix(in srgb, var(--text-color) 70%, transparent);
}

[data-theme="light"] {
    --bg-color: #ffffff;
    --surface-color: #FFFFFF;
    --text-color: #0A2540;
    --text-secondary: #666666;
    --text-muted: color-mix(in srgb, var(--text-color) 60%, transparent);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: clamp(14px, 2.5vw, 18px);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-top: 60px;
    padding-bottom: env(safe-area-inset-bottom);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.3rem; }

p {
    margin-bottom: calc(var(--spacing-unit) * 2);
    color: var(--text-muted);
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo-img {
    height: 38px;
    width: 38px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.3);
    object-fit: cover;
}

.header-logo h1 {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.desktop-nav {
    display: none;
    gap: 8px;
}

.desktop-nav .nav-link {
    padding: 8px 16px;
    border-radius: var(--border-radius);
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.desktop-nav .nav-link:hover,
.desktop-nav .nav-link.active {
    background: var(--primary-color);
    color: white;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* Main Content */
.app-main {
    min-height: calc(100vh - 60px);
    position: relative;
}

.container {
    padding: 16px;
    max-width: 100%;
    margin: 0 auto;
}

/* Pages */
.page {
    display: none;
    min-height: calc(100vh - 60px);
    padding: calc(var(--spacing-unit) * 3) 0;
}

.page.active {
    display: block;
    animation: fadeInUp 0.4s ease-out;
}

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

.page-header {
    text-align: center;
    margin-bottom: calc(var(--spacing-unit) * 4);
    position: relative;
}

.page-header h2 {
    color: var(--text-color);
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.btn-back {
    position: absolute;
    left: 0;
    top: 0;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.btn-back:hover {
    background: var(--primary-light);
    transform: scale(1.1);
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 4);
}

.option-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    text-align: center;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .option-card {
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(145deg, var(--surface-color), rgba(20, 20, 20, 1));
}

.option-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(99, 91, 255, 0.15);
    border-color: rgba(99, 91, 255, 0.3);
}

.option-card.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--surface-color) 0%, var(--primary-light) 100%);
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(99, 91, 255, 0.25);
}

[data-theme="dark"] .option-card.selected {
    background: linear-gradient(135deg, var(--surface-color) 0%, rgba(99, 91, 255, 0.2) 100%);
}

.option-card .icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-color), #9E99FF);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: calc(var(--spacing-unit) * 2);
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.option-card:hover .icon {
    transform: scale(1.15) rotate(-5deg);
}

.option-card .title {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: calc(var(--spacing-unit) * 1);
    font-size: 1.1rem;
}

.option-card .description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* Forms */
.form-group {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.form-input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: inherit;
    background: var(--surface-color);
    color: var(--text-color);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

.form-hint {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: calc(var(--spacing-unit) * 1);
}

/* Toggle Controls */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 4);
}

.toggle-item {
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-color);
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    position: relative;
    margin-right: 12px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: var(--transition);
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background: var(--primary-color);
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: var(--transition);
}

.toggle-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary-color);
}

.toggle-label input[type="radio"]:checked + .radio-custom::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    min-height: 48px;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--secondary-color) 85%, black);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* Page Actions */
.page-actions {
    display: flex;
    justify-content: center;
    margin-top: calc(var(--spacing-unit) * 4);
}

.page-actions .btn {
    min-width: 200px;
}

/* Message Display */
.message-display {
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 5) calc(var(--spacing-unit) * 3) calc(var(--spacing-unit) * 3);
    margin-bottom: calc(var(--spacing-unit) * 4);
    box-shadow: var(--shadow-md);
    position: relative;
    margin-top: 20px;
}

.message-display::before {
    content: '"';
    position: absolute;
    top: -25px;
    left: 20px;
    font-size: 3rem;
    line-height: 1;
    color: var(--primary-color);
    background: var(--bg-color);
    padding: 0 8px;
}

.message-text {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-color);
    text-align: center;
    margin: 0;
}

.message-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: calc(var(--spacing-unit) * 4);
}

.message-actions .btn {
    min-width: 0;
    white-space: normal;
    padding: 12px 10px;
    font-size: 0.95rem;
    width: 100%;
    margin: 0;
}

#share-message {
    grid-column: 1 / -1;
    order: -1;
    background: #25D366;
    color: white;
    font-size: 1.15rem;
    padding: 16px;
    border: none;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

#share-message:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

#generate-another {
    grid-column: 1 / -1;
    order: 10;
}

#copy-message {
    order: 1;
}

#favorite-message {
    order: 2;
}

/* History */
.history-filters {
    display: flex;
    gap: calc(var(--spacing-unit) * 1);
    margin-bottom: calc(var(--spacing-unit) * 3);
    justify-content: center;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary-color);
    color: white;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
}

.history-item {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 3);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.history-item.favorite::before {
    content: '♥';
    position: absolute;
    top: 12px;
    right: 12px;
    color: #ff4757;
    font-size: 1.2rem;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 1);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-text {
    color: var(--text-color);
    margin-bottom: calc(var(--spacing-unit) * 2);
    line-height: 1.6;
}

.history-actions {
    display: flex;
    gap: calc(var(--spacing-unit) * 1);
}

.history-actions .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    min-height: auto;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: calc(var(--spacing-unit) * 6) calc(var(--spacing-unit) * 3);
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: calc(var(--spacing-unit) * 3);
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--text-color);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

/* FAQ */
.faq-section {
    margin-top: calc(var(--spacing-unit) * 6);
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
}

.faq-item {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.faq-question {
    width: 100%;
    padding: calc(var(--spacing-unit) * 3);
    background: none;
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--primary-light);
}

.faq-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
    transition: var(--transition);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 calc(var(--spacing-unit) * 3) calc(var(--spacing-unit) * 3);
    color: var(--text-muted);
    line-height: 1.6;
}

.faq-answer[hidden] {
    display: none;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: var(--surface-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 11px;
    transition: var(--transition);
    min-width: 64px;
    font-weight: 500;
}

.nav-item i {
    font-size: 20px;
    transition: var(--transition);
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item.active i {
    transform: scale(1.15);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-color);
    color: var(--bg-color);
    padding: 12px 24px;
    border-radius: var(--border-radius);
    opacity: 0;
    transition: var(--transition);
    z-index: 2000;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-spinner {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 4);
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.loading-spinner p {
    margin: 0;
    color: var(--text-color);
    font-weight: 500;
}

/* Footer */
.app-footer {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 4) calc(var(--spacing-unit) * 2);
    text-align: center;
    border-top: 1px solid var(--border-color, #e0e0e0);
    margin-top: calc(var(--spacing-unit) * 6);
    padding-bottom: 90px; /* Compensa a Navbar mobile pra não esconder o texto */
}

.footer-links {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.footer-divider {
    color: var(--border-color);
}

.app-footer p {
    margin: calc(var(--spacing-unit) * 1) 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.b20-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.b20-link:hover {
    text-decoration: underline;
    transform: scale(1.05);
}

/* Utility Classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: calc(var(--spacing-unit) * 1) !important; }
.mb-2 { margin-bottom: calc(var(--spacing-unit) * 2) !important; }
.mb-3 { margin-bottom: calc(var(--spacing-unit) * 3) !important; }
.mb-4 { margin-bottom: calc(var(--spacing-unit) * 4) !important; }
