.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    overflow: visible;
    border: none !important;
    background-color: var(--header-accent, var(--header-bg)) !important;
    box-shadow: 0 8px 22px rgba(35, 31, 32, 0.16);
    transition: padding 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    
    /* Preenche o relógio com cor, mas mantém o layout intacto */
    border-top: env(safe-area-inset-top) solid var(--header-accent, var(--header-bg)) !important;
}

.main-header::before {
    content: "";
    position: absolute;
    top: -48px;
    left: 0;
    right: 0;
    height: 48px;
    background-color: inherit;
    z-index: -1;
}

.header-container,
.header-search-form {
    position: relative;
}

.header-icons .ph {
    color: #fff;
    cursor: pointer;
    transition: color 0.25s ease, transform 0.25s ease;
}

.header-icons .ph:hover {
    color: var(--gold-sacred);
    transform: translateY(-1px);
}

.logo-header {
    max-height: 45px;
    object-fit: contain;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.header-search-group {
    align-items: stretch;
    overflow: visible;
}

.header-search-input,
.desktop-search-input {
    height: 48px;
    padding-left: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 8px 0 0 8px !important;
    background-color: #ffffff;
    color: #231f20;
    box-shadow: none !important;
}

.header-search-input::placeholder,
.desktop-search-input::placeholder {
    color: #81756d;
}

.header-search-btn,
.desktop-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 104px;
    height: 48px;
    border: none !important;
    border-radius: 0 8px 8px 0 !important;
    background-color: var(--accent-red) !important;
    color: #fff !important;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.header-search-btn:hover,
.desktop-search-btn:hover {
    background-color: var(--accent-red-hover) !important;
    transform: translateY(-1px);
}

.header-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
}

.mobile-search-row {
    overflow: visible;
    margin-top: 12px;
    max-height: 100px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.35s ease, max-height 0.35s ease, margin-top 0.35s ease, transform 0.35s ease;
}

.mobile-search-row.search-hidden {
    overflow: hidden;
    margin-top: 0;
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
}

.mobile-sidebar {
    background-color: var(--bg-surface) !important;
    color: var(--text-body);
}

.mobile-sidebar__title {
    color: var(--text-strong);
    font-family: var(--font-inter);
    font-weight: 700;
}

.mobile-sidebar .offcanvas-header {
    border-bottom: 1px solid var(--border-soft);
}

.mobile-sidebar .nav-item {
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.mobile-sidebar .nav-item:last-child {
    border-bottom: none;
}

.mobile-sidebar .nav-link {
    padding-left: 0;
    padding-right: 0;
    color: var(--text-body) !important;
    font-size: 1.05rem;
}

.mobile-sidebar .nav-link:hover {
    color: var(--primary-catholic) !important;
}

.site-logo-dark {
    display: none;
}

body.dark-mode .site-logo-light {
    display: none;
}

body.dark-mode .site-logo-dark {
    display: inline-block;
}

body.dark-mode .main-header {
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

@media (max-width: 991px) {
    .logo-header {
        max-height: 32px;
    }

    .mobile-search-row .header-search-input {
        height: 42px;
        padding-left: 0.85rem;
    }

    .mobile-search-row .header-search-btn {
        width: 62px;
        min-width: 62px;
        height: 42px;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .d-lg-none .header-theme-toggle {
        font-size: 1.5rem !important;
    }

    .d-lg-none .header-icons .ph-list,
    .d-lg-none .header-icons .ph-moon,
    .d-lg-none .header-icons .ph-sun {
        font-size: 1.7rem !important;
    }
}

@media (min-width: 992px) {
    .main-header.header-scrolled {
        padding-top: 0.6rem !important;
        padding-bottom: 0.6rem !important;
    }

    .main-header.header-scrolled .desktop-search-input,
    .main-header.header-scrolled .desktop-search-btn {
        height: 42px !important;
    }

    .main-header.header-scrolled .logo-header {
        max-height: 38px;
    }
}

body.admin-bar .main-header {
    top: 32px !important;
}

@media screen and (max-width: 782px) {
    body.admin-bar .main-header {
        top: 46px !important;
    }
}

/* --- Push & Install Sheets --- */
.mt-push-sheet {
    position: fixed;
    bottom: -100px;
    left: 0;
    width: 100%;
    z-index: 10000;
    padding: 20px;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    pointer-events: none;
}

.mt-push-sheet.is-visible {
    bottom: 0px;
    opacity: 1;
    pointer-events: auto;
}

.mt-push-sheet__container {
    background: var(--bg-surface);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
    border: 1px solid var(--border-soft);
}

.mt-push-sheet__icon {
    font-size: 2.5rem;
    color: var(--primary-catholic);
    margin-bottom: 12px;
}

.mt-push-sheet__text h3 {
    font-family: var(--font-inter);
    font-weight: 800;
    font-size: 1.3rem;
    margin-bottom: 6px;
    color: var(--text-strong);
}

.mt-push-sheet__text p {
    font-size: 0.95rem;
    color: var(--text-body);
    margin-bottom: 20px;
    line-height: 1.4;
}

.mt-push-sheet__actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 12px;
}

.btn-push-confirm {
    background: linear-gradient(135deg, var(--primary-catholic), #6a2c91);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(75, 0, 130, 0.3);
    transition: transform 0.2s;
}

.btn-push-confirm:active {
    transform: scale(0.96);
}

.btn-push-cancel {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Tutorial iOS */
#mt-ios-guide {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mt-ios-guide-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.mt-ios-guide-content {
    position: relative;
    background: var(--bg-surface);
    width: 90%;
    max-width: 320px;
    padding: 30px;
    border-radius: 28px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    border: 1px solid var(--border-soft);
}

.mt-ios-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    color: var(--text-muted);
}

.mt-ios-guide-steps {
    margin-top: 10px;
}

.mt-ios-guide-steps h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-strong);
}

.mt-ios-guide-steps p {
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.5;
    color: var(--text-body);
}

.mt-ios-arrow {
    font-size: 2.2rem;
    color: var(--primary-catholic);
    margin-top: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-10px);}
    60% {transform: translateY(-5px);}
}

/* Desktop override */
@media (min-width: 768px) {
    .mt-push-sheet {
        bottom: 20px;
        left: 20px;
        width: 380px;
    }
}

body.dark-mode .mt-push-sheet__container,
body.dark-mode .mt-ios-guide-content {
    background: #1e1e1e;
    border-color: #333;
}
