@import url("../../theme.css");

/* ===================== TOPO ===================== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 500;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 16px rgba(0, 96, 184, 0.25);
    transition: box-shadow 0.25s ease;
}
.top-bar.is-scrolled {
    box-shadow: 0 8px 22px rgba(0, 30, 70, 0.35);
}

.top-bar-main {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    transition: padding 0.25s ease;
}
.top-bar.is-scrolled .top-bar-main {
    padding: 11px 20px;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}
.icon-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(1.06);
}

.btn-voltar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.35);
    transition: background 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}
.btn-voltar:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateX(-2px);
}

.hero-title { flex: 1; text-align: center; min-width: 180px; }
h1 {
    color: #fff;
    font-size: 1.5em;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.hero-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85em;
    margin-top: 3px;
    font-weight: 400;
}

.theme-toggle .fa-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .fa-sun { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .fa-moon { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .fa-sun { display: block; }
}

/* ===================== ATALHOS RÁPIDOS (ESTILO ABAS) ===================== */
.quick-nav {
    display: flex;
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 4px;
    margin: 0 0 22px;
    padding: 0 0 10px;
    border-bottom: 1px solid var(--border);
}

.quick-nav a {
    flex: 0 0 auto;
    padding: 4px 12px 6px;
    color: var(--text-muted);
    font-size: 0.74em;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.quick-nav a:hover {
    color: var(--text);
}
.quick-nav a.is-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.quick-nav a.is-empty {
    opacity: 0.5;
}

/* ===================== CONTAINER GERAL ===================== */
.page-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 26px 20px 0;
}

/* Campo de pesquisa */
.search-container { margin: 0 0 26px; }
.search-box { position: relative; max-width: 480px; margin: 0 auto; }
.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-input {
    width: 100%;
    padding: 13px 40px 13px 42px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.95em;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.25s ease, color 0.25s ease;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--border);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease, color 0.2s ease;
}
.search-clear:hover { background: var(--primary); color: #fff; }
.results-count {
    text-align: center;
    margin-top: 10px;
    font-size: 0.82em;
    color: var(--text-muted);
    min-height: 1.2em;
}

/* ===================== SEÇÕES ===================== */
section {
    background: var(--surface);
    margin: 0 0 26px;
    padding: 26px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    scroll-margin-top: 90px;
    transition: background 0.25s ease, border-color 0.25s ease;
    animation: fadeInUp 0.45s ease both;
}

section h2 {
    position: relative;
    font-size: 1.2em;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.2px;
    text-transform: uppercase;
    margin: 0 0 20px;
    padding: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
section h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 56px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}
section h2 i { color: var(--primary); font-size: 0.85em; }
.h2-note {
    font-size: 0.5em;
    color: var(--text-muted);
    text-transform: none;
    font-weight: 600;
    letter-spacing: 0;
}

/* Banner/logo da adquirente */
.brand-cover { display: flex; justify-content: center; margin: 0 0 24px; }
.brand-cover img {
    width: 100%;
    max-width: 320px;
    background: var(--logo-bg);
    border-radius: var(--radius-sm);
    padding: 14px;
    box-shadow: var(--shadow);
    cursor: zoom-in;
    transition: transform 0.25s ease;
}
.brand-cover img:hover { transform: scale(1.03); }

/* Seções ainda sem material cadastrado */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
    padding: 6px 0 4px;
    line-height: 1.5;
}
section:has(.empty-state) {
    border-style: dashed;
}
section:has(.empty-state) h2 {
    margin-bottom: 14px;
    opacity: 0.85;
}

/* ===================== GRID DE PASSOS ===================== */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 18px;
}

.step-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 14px 16px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.step-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}
.step-card:hover, .step-card:focus-visible {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}
.step-card:hover::before, .step-card:focus-visible::before { transform: scaleX(1); }
.step-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.step-num {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.7em;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.step-tile {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--logo-bg);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.step-tile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}
.step-card:hover .step-tile img { transform: scale(1.06); }

/* Fallback para imagem que não carregou (link externo fora do ar, arquivo renomeado, etc.) */
.step-tile.img-broken img { visibility: hidden; }
.step-tile.img-broken::after {
    content: 'Imagem indisponível';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    font-size: 0.66em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

.brand-cover.img-broken img { display: none; }
.brand-cover.img-broken::after {
    content: 'Logo indisponível';
    display: block;
    padding: 30px 40px;
    background: var(--logo-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.3px;
    text-align: center;
}

.step-title {
    font-size: 0.82em;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.2px;
}
.step-caption {
    font-size: 0.74em;
    color: var(--text-muted);
    text-align: center;
    margin-top: 6px;
    line-height: 1.45;
}

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

/* ===================== LIGHTBOX ===================== */
.image-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--modal-backdrop);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 70px 76px;
    animation: fadeIn 0.2s ease;
}
.image-overlay.is-open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

#expandedImage {
    max-width: 100%;
    max-height: 100%;
    background: var(--logo-bg);
    padding: 14px;
    box-sizing: border-box;
    display: block;
    border-radius: var(--radius-sm);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.close-button {
    position: fixed;
    top: 18px;
    right: 22px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.close-button:hover { background: rgba(255, 255, 255, 0.25); }

.nav-button {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.nav-button:hover { background: rgba(255, 255, 255, 0.25); }
.nav-button.prev { left: 18px; }
.nav-button.next { right: 18px; }

/* ===================== SCROLL TO TOP ===================== */
.scroll-to-top-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 46px;
    height: 46px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.1em;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-hover);
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 400;
}
.scroll-to-top-button:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

/* ===================== RESPONSIVIDADE ===================== */
@media (max-width: 768px) {
    h1 { font-size: 1.2em; }
    .hero-subtitle { font-size: 0.75em; }
    section { padding: 20px 16px; scroll-margin-top: 80px; }
    .steps-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
    .image-overlay { padding: 60px 16px; }
    .nav-button { width: 40px; height: 40px; font-size: 18px; }
    .nav-button.prev { left: 6px; }
    .nav-button.next { right: 6px; }
    .quick-nav a { font-size: 0.7em; padding: 6px 9px 8px; }
}

@media (max-width: 480px) {
    .top-bar-main { padding: 12px 14px; }
    .btn-voltar span { display: none; }
    .steps-grid { grid-template-columns: repeat(2, 1fr); }
}
