/**
 * Apologética Cristã - Styles
 * Desenvolvido por B20 Conteúdo Digital
 * https://www.b20.com.br
 */

/* ===== CSS VARIABLES ===== */
:root {
    /* Paleta Sapphire & Azure */
    --primary-color: #0F52BA;
    --secondary-color: #0066CC;
    --accent-color: #1E90FF;
    --surface-color: #87CEEB;
    --text-color: #1a1a1a;

    /* Variações automáticas */
    --primary-hover: #0a3d8f;
    --primary-light: #e6f0ff;
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-muted: #6c757d;
    --text-secondary: #495057;
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

    /* Layout */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --spacing-unit: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-secondary: 'Roboto Slab', Georgia, serif;

    /* Z-index layers */
    --z-header: 1000;
    --z-modal: 2000;
    --z-toast: 3000;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0a0e1a;
        --bg-secondary: #151b2e;
        --surface-color: #1e2538;
        --text-color: #e8eaed;
        --text-secondary: #b8bcc4;
        --text-muted: #8a8f98;
        --border-color: #2d3548;
        --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    }
}

body.dark-mode {
    --bg-color: #0a0e1a;
    --bg-secondary: #151b2e;
    --surface-color: #1e2538;
    --text-color: #e8eaed;
    --text-secondary: #b8bcc4;
    --text-muted: #8a8f98;
    --border-color: #2d3548;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

body.light-mode {
    --primary-color: #0F52BA;
    --secondary-color: #0066CC;
    --accent-color: #1E90FF;
    --surface-color: #87CEEB;
    --text-color: #1a1a1a;
    --primary-hover: #0a3d8f;
    --primary-light: #e6f0ff;
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-muted: #6c757d;
    --text-secondary: #495057;
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: clamp(14px, 2.5vw, 16px);
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-top: 60px;
    padding-bottom: 70px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-secondary);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h2 {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* ===== HEADER ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: calc(60px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    box-shadow: var(--shadow-md);
    z-index: var(--z-header);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

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

.header-logo i {
    font-size: 24px;
    color: var(--primary-color);
}

.header-logo h1 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--text-color);
}

@media (max-width: 767px) {
    .header-logo h1 {
        font-size: 1rem;
    }
}

/* Desktop Navigation */
.desktop-nav {
    display: none;
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
        gap: 4px;
        align-items: center;
    }

    .desktop-nav .nav-link {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        border-radius: var(--border-radius-sm);
        color: var(--text-color);
        font-size: 0.9rem;
        font-weight: 500;
        transition: var(--transition);
        white-space: nowrap;
    }

    .desktop-nav .nav-link i {
        font-size: 1.1rem;
    }

    /* Hide text label on smaller desktops/tablets to prevent overflow */
    .desktop-nav .nav-link span {
        display: none;
    }

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

/* Show full navigation on larger screens */
@media (min-width: 1100px) {
    .desktop-nav {
        gap: 8px;
    }

    .desktop-nav .nav-link {
        padding: 8px 16px;
    }

    .desktop-nav .nav-link span {
        display: inline-block;
    }
}

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

/* ===== BUTTONS ===== */
.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    font-size: 18px;
}

.btn-icon:hover {
    background: var(--bg-secondary);
}

.btn-icon:active {
    transform: scale(0.95);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
}

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

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

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

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

@media (min-width: 768px) {
    .bottom-nav {
        display: none !important;
    }
}

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

.nav-item i {
    font-size: 20px;
    transition: transform 0.2s ease;
}

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

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

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

@media (min-width: 768px) {
    .container {
        padding: 24px;
        max-width: 720px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }
}

/* ===== SECTIONS ===== */
.section {
    display: none;
    min-height: calc(100vh - 130px);
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

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

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

.section-header {
    margin-bottom: 32px;
    text-align: center;
}

.section-header h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.section-header h2 i {
    color: var(--primary-color);
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ===== HERO ===== */
.hero {
    text-align: center;
    padding: 48px 0;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--primary-color);
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 48px 0;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== CATEGORIES GRID ===== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 48px 0;
}

.category-card {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.category-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.category-card i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.category-card h3 {
    color: var(--text-color);
    margin-bottom: 12px;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

/* ===== FILTER TABS ===== */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    min-height: 44px;
}

.filter-tab:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.filter-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ===== CONTENT GRID ===== */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.content-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
}

.content-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.content-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.content-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    flex: 1;
}

.content-card-favorite {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    padding: 4px;
    min-width: 32px;
    min-height: 32px;
}

.content-card-favorite:hover {
    color: #e74c3c;
    transform: scale(1.1);
}

.content-card-favorite.active {
    color: #e74c3c;
}

.content-card-category {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.content-card-excerpt {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

/* ===== SEARCH OVERLAY ===== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: calc(var(--z-modal) - 100);
    display: flex;
    align-items: flex-start;
    padding-top: 80px;
    animation: fadeIn 0.2s ease;
}

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

.search-header {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.search-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1.1rem;
    font-family: var(--font-primary);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-results {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.search-hint {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.search-result-item {
    padding: 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.search-result-item:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.search-result-title {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.search-result-excerpt {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-color);
    z-index: 1;
}

.modal-header h2 {
    flex: 1;
    margin: 0;
    padding-right: 16px;
}

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

.modal-body {
    padding: 24px;
}

.modal-body h3 {
    color: var(--primary-color);
    margin-top: 24px;
    margin-bottom: 12px;
}

.modal-body p {
    line-height: 1.8;
    margin-bottom: 16px;
}

.modal-body ul,
.modal-body ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.modal-body li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.modal-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-secondary);
}

/* ===== FAQ ===== */
.faq-section {
    margin-top: 64px;
    padding-top: 48px;
    border-top: 2px solid var(--border-color);
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 32px;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    margin-bottom: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    border-color: var(--primary-color);
}

.faq-question {
    width: 100%;
    padding: 20px;
    background: var(--bg-secondary);
    border: none;
    text-align: left;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    min-height: 60px;
}

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

.faq-icon {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

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

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-answer:not([hidden]) {
    padding: 20px;
    max-height: 500px;
}

.faq-answer p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 64px 24px;
}

.empty-state i {
    margin-bottom: 24px;
}

.empty-state h3 {
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-color);
    color: var(--bg-color);
    padding: 16px 24px;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: var(--z-toast);
    max-width: 90%;
    text-align: center;
}

@media (min-width: 768px) {
    .toast {
        bottom: 24px;
    }
}

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

/* ===== FOOTER ===== */
.app-footer {
    text-align: center;
    padding: 32px 16px;
    margin-top: 64px;
    border-top: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.app-footer p {
    margin-bottom: 8px;
}

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

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

/* ===== UTILITIES ===== */
.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;
}

[hidden] {
    display: none !important;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 767px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== LOADING SCREEN ===== */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#loading-screen img {
    width: 100px;
    height: auto;
    margin-bottom: 20px;
    animation: logoPulse 2s ease-in-out infinite;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-secondary);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes logoPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}