/* ==========================================================================
   Portal de Obituário SBS - Folha de Estilos Pública (public.css)
   Tom: Sóbrio, respeitoso, acolhedor, rápido e legível (Mobile First)
   ========================================================================== */

:root {
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-subtle: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-subtle: #cbd5e1;
    
    --primary: #1e3a5f;
    --primary-hover: #152943;
    --primary-light: #e0e7ff;
    
    --accent: #b45309; /* Bronze sóbrio */
    --accent-bg: #fef3c7;
    
    --status-active-bg: #dcfce7;
    --status-active-text: #166534;
    
    --status-private-bg: #f3e8ff;
    --status-private-text: #6b21a8;
    
    --status-updated-bg: #e0f2fe;
    --status-updated-text: #0369a1;

    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

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

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

/* -------------------------------------------------------------
   Header & Navegação
   ------------------------------------------------------------- */
.site-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), #334155);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    font-weight: 700;
}

.brand-info h1 {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.brand-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-nav a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.header-nav a:hover {
    color: var(--primary);
    text-decoration: none;
}

.btn-radio-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.btn-radio-mode:hover {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

/* -------------------------------------------------------------
   Hero / Barra de Busca e Filtros
   ------------------------------------------------------------- */
.filter-hero {
    background: linear-gradient(180deg, #ffffff 0%, var(--bg-subtle) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
}

.filter-container {
    max-width: 1200px;
    margin: 0 auto;
}

.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: 2px solid var(--primary);
    border-color: var(--primary);
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.search-loading-badge {
    position: absolute;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
    pointer-events: none;
    z-index: 2;
    animation: fadeInBadge 0.2s ease-out;
}

.loading-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(146, 64, 14, 0.25);
    border-top-color: #92400e;
    border-radius: 50%;
    animation: spinLoader 0.7s linear infinite;
    display: inline-block;
}

@keyframes spinLoader {
    to { transform: rotate(360deg); }
}

@keyframes fadeInBadge {
    from { opacity: 0; transform: translateY(-2px); }
    to { opacity: 1; transform: translateY(0); }
}

#public-obituaries-wrapper {
    transition: opacity 0.2s ease, filter 0.2s ease;
}

#public-obituaries-wrapper.is-searching {
    opacity: 0.45 !important;
    pointer-events: none;
    filter: grayscale(20%);
}

.btn-search {
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    padding: 0 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.15s;
}

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

.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.quick-filter-scroll {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-right: 0.25rem;
}

.filter-funeral-wrapper {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.filter-funeral-select {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-chip:hover {
    background-color: #f1f5f9;
    border-color: var(--border-subtle);
    text-decoration: none;
}

.filter-chip.active {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* -------------------------------------------------------------
   Container Principal e Listagem
   ------------------------------------------------------------- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    width: 100%;
    flex: 1;
}

.period-section {
    margin-bottom: 2.5rem;
}

.period-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.period-heading h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.period-badge {
    background-color: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
}

/* -------------------------------------------------------------
   Cards de Obituário (Projetado para 2 segundos no celular)
   ------------------------------------------------------------- */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card-obituary {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.card-obituary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.card-header-media {
    display: flex;
    align-items: center;
    padding: 1rem 1rem 0.5rem;
    gap: 1rem;
}

.card-avatar-wrapper {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--bg-subtle);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-avatar-initials {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
}

.card-titles {
    flex: 1;
    min-width: 0;
}

.card-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
    margin-bottom: 0.2rem;
}

.card-age-nickname {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0 1rem 0.75rem;
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
}

.badge-wake-active {
    background-color: var(--status-active-bg);
    color: var(--status-active-text);
}

.badge-burial-today {
    background-color: #fef08a;
    color: #854d0e;
}

.badge-private {
    background-color: var(--status-private-bg);
    color: var(--status-private-text);
}

.badge-updated {
    background-color: var(--status-updated-bg);
    color: var(--status-updated-text);
}

.card-body {
    padding: 0 1rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.ceremony-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.ceremony-icon {
    font-size: 1rem;
    line-height: 1.3;
    opacity: 0.7;
}

.ceremony-info strong {
    color: var(--text-primary);
}

/* Barra Superior no Topo do Card */
.card-topbar {
    padding: 0.75rem 1rem;
    background-color: var(--bg-subtle);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card-topbar-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    min-width: 0;
    flex-shrink: 0;
}

.card-death-moment {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.card-moment-icon {
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.85;
}

.card-moment-text {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.card-moment-time {
    color: var(--text-secondary);
    font-weight: 600;
    margin-left: 0.2rem;
}

.card-pub-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

/* Espaço da Logo da Funerária no Topo */
.card-funeral-logo-box {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    max-width: 140px;
    height: 40px;
    flex-shrink: 0;
}

.card-funeral-logo-img {
    max-height: 38px;
    max-width: 135px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
    display: block;
}

.card-obituary:hover .card-funeral-logo-img {
    transform: scale(1.05);
}

.card-funeral-brand-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 9999px;
    padding: 0.3rem 0.75rem;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.82rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
}

.card-funeral-brand-chip .card-funeral-icon {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* -------------------------------------------------------------
   Página Individual do Obituário
   ------------------------------------------------------------- */
.obituary-detail-container {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.obituary-detail-header {
    padding: 2rem 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.detail-photo-wrapper {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 1.25rem;
    overflow: hidden;
    border: 3px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-subtle);
}

.detail-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-name {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.detail-meta {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: 0.35rem;
}

.detail-residence {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.share-actions-bar {
    padding: 1rem 1.5rem;
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.btn-whatsapp-share {
    background-color: #25d366;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.15s;
}

.btn-whatsapp-share:hover {
    background-color: #1eb857;
    color: #ffffff;
    text-decoration: none;
}

.obituary-sections {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-card-box {
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.detail-card-box h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-card-box p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.35rem;
}

.detail-funeral-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background-color: #f1f5f9;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
}

/* -------------------------------------------------------------
   Alerts & Mensagens Flash
   ------------------------------------------------------------- */
.flash-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flash-alert-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.flash-alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.flash-alert-warning {
    background-color: #fef3c7;
    color: #854d0e;
    border: 1px solid #fde68a;
}

/* -------------------------------------------------------------
   Footer
   ------------------------------------------------------------- */
.site-footer {
    background-color: #0f172a;
    color: #94a3b8;
    padding: 2.5rem 1rem 1.5rem;
    border-top: 1px solid #1e293b;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .footer-container {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

.footer-brand h4 {
    color: #f8fafc;
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.footer-links h5 {
    color: #f8fafc;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.footer-links ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.footer-links a {
    color: #94a3b8;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: #ffffff;
}

.footer-bottom {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding-top: 1rem;
    border-top: 1px solid #1e293b;
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
}

/* ==========================================================================
   Responsividade Mobile Completa (Smartphones até 768px)
   Elimina qualquer sensação de aperto e otimiza toque e visualização
   ========================================================================== */
@media (max-width: 768px) {
    /* 1. Header do Portal no Mobile */
    .site-header {
        padding: 0.6rem 0;
    }

    .header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
        padding: 0.6rem 0.85rem;
    }

    .brand-wrapper {
        display: flex;
        align-items: center;
        gap: 0.65rem;
    }

    .brand-logo-icon {
        width: 36px;
        height: 36px;
        font-size: 1.15rem;
        flex-shrink: 0;
    }

    .brand-info h1 {
        font-size: 1.05rem;
        line-height: 1.25;
        font-weight: 800;
    }

    .brand-info p {
        font-size: 0.72rem;
        color: #64748b;
    }

    .header-nav {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        border-top: 1px solid var(--border-color);
        padding-top: 0.5rem;
    }

    .header-nav a {
        padding: 0.35rem 0.65rem;
        font-size: 0.82rem;
        font-weight: 600;
        color: #334155;
        background-color: var(--bg-subtle);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
    }

    .header-nav a:hover {
        background-color: #e2e8f0;
        color: #0f172a;
    }

    .btn-radio-mode {
        background-color: #e0f2fe !important;
        border-color: #bae6fd !important;
        color: #0284c7 !important;
    }

    /* 2. Hero de Busca e Filtros Rápidos */
    .filter-hero {
        padding: 0.85rem 0.85rem 1rem;
    }

    .search-bar {
        display: flex;
        gap: 0.4rem;
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .search-input {
        padding: 0.65rem 0.85rem;
        font-size: 0.95rem;
    }

    .btn-search {
        padding: 0.65rem 1.1rem;
        font-size: 0.9rem;
        font-weight: 700;
        flex-shrink: 0;
    }

    .quick-filters {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
        width: 100%;
        align-items: stretch;
    }

    .quick-filter-scroll {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 3px;
        width: 100%;
    }

    .quick-filter-scroll::-webkit-scrollbar {
        display: none;
    }

    .filter-label {
        font-size: 0.82rem;
        font-weight: 700;
        color: #64748b;
        white-space: nowrap;
        flex-shrink: 0;
        margin-right: 0.2rem;
    }

    .filter-chip {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 0.4rem 0.85rem;
        font-size: 0.82rem;
        font-weight: 600;
    }

    .filter-funeral-wrapper {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .filter-funeral-wrapper form {
        width: 100%;
    }

    .filter-funeral-select {
        width: 100% !important;
        padding: 0.6rem 0.85rem !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
        border: 1px solid var(--border-color) !important;
        background-color: #ffffff !important;
        box-shadow: var(--shadow-sm);
    }

    /* 3. Conteúdo Principal e Cards de Falecimento */
    .main-content {
        padding: 1rem 0.85rem 3rem;
    }

    .period-section {
        margin-bottom: 1.75rem;
    }

    .period-heading {
        margin-bottom: 0.85rem;
        gap: 0.5rem;
    }

    .period-heading h2 {
        font-size: 1.25rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card-obituary {
        border-radius: var(--radius-md);
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }

    .card-topbar {
        padding: 0.65rem 0.85rem;
        gap: 0.5rem;
    }

    .card-topbar-left {
        font-size: 0.82rem;
    }

    .card-fh-logo {
        max-height: 32px;
        max-width: 95px;
    }

    .card-body {
        padding: 0.85rem;
        gap: 0.75rem;
    }

    .avatar-circle {
        width: 44px;
        height: 44px;
        font-size: 0.95rem;
    }

    .deceased-name {
        font-size: 1.15rem;
        line-height: 1.25;
    }

    .deceased-meta {
        font-size: 0.85rem;
        margin-top: 0.15rem;
    }

    .card-events {
        font-size: 0.85rem;
        line-height: 1.45;
        gap: 0.45rem;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
}

