/**
 * Estilos do shell / navegação interna da Automação WhatsApp (Fase 1).
 * Todos os seletores são escopados com .affiliz-automation-*.
 * Otimizado para celular, tablet e desktop.
 */

.affiliz-automation-shell {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 12rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.affiliz-automation-shell__mobile-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0 0 0.85rem;
    padding: 0.35rem 0;
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.affiliz-automation-shell__menu-toggle {
    flex: 0 0 auto;
    min-height: 2.5rem;
    min-width: 2.5rem;
    padding: 0.45rem 0.85rem;
    font-weight: 600;
    touch-action: manipulation;
}

.affiliz-automation-shell__mobile-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.affiliz-automation-shell__body {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    position: relative;
    width: 100%;
    min-width: 0;
}

.affiliz-automation-nav {
    flex: 0 0 15.5rem;
    max-width: 15.5rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--affiliz-automation-surface-radius, 1rem);
    background: #fff;
    padding: 0.85rem 0.75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.affiliz-automation-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0 0.25rem;
}

.affiliz-automation-nav__brand {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color, #6c757d);
}

.affiliz-automation-nav__list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-height: min(70vh, 36rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.affiliz-automation-nav__link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    min-height: 2.5rem;
    border-radius: 0.65rem;
    color: #334155;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.25;
    border: 1px solid transparent;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.affiliz-automation-nav__link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.affiliz-automation-nav__link:hover,
.affiliz-automation-nav__link:focus-visible {
    background: var(--affiliz-automation-whatsapp-soft, rgba(37, 211, 102, 0.12));
    border-color: transparent;
    color: var(--affiliz-automation-whatsapp-dark, #128c46);
    outline: none;
}

.affiliz-automation-nav__link:focus-visible {
    box-shadow: 0 0 0 0.15rem rgba(37, 211, 102, 0.35);
}

.affiliz-automation-nav__link--active,
.affiliz-automation-nav__link[aria-current='page'] {
    background: var(--affiliz-automation-whatsapp-soft, rgba(37, 211, 102, 0.12));
    border-color: var(--affiliz-automation-whatsapp-border, rgba(134, 239, 172, 0.5));
    color: var(--affiliz-automation-whatsapp-dark, #128c46);
    font-weight: 600;
}

.affiliz-automation-nav__link--active::before,
.affiliz-automation-nav__link[aria-current='page']::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 999px;
    background: var(--affiliz-automation-whatsapp-dark, #128c46);
}

.affiliz-automation-nav__link i {
    font-size: 1.05rem;
    width: 1.15rem;
    text-align: center;
    flex-shrink: 0;
}

.affiliz-automation-content {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.affiliz-automation-content__header {
    margin-bottom: 1.35rem;
}

.affiliz-automation-content__title {
    margin-top: 0.15rem;
    margin-bottom: 0.45rem !important;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.affiliz-automation-content__subtitle {
    font-size: 0.9rem;
    line-height: 1.5;
}

.affiliz-automation-shell__backdrop {
    display: none;
}

.affiliz-automation-content__body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Home */
.affiliz-automation-home {
    width: 100%;
}

.affiliz-automation-home__hero {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--affiliz-automation-surface-radius, 1rem);
    background:
        linear-gradient(135deg, rgba(37, 211, 102, 0.08), rgba(79, 110, 247, 0.05)),
        #fff;
}

.affiliz-automation-home__hero-badge {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.85rem;
    display: grid;
    place-items: center;
    background: rgba(37, 211, 102, 0.14);
    color: var(--affiliz-automation-whatsapp-dark, #128c46);
    font-size: 1.35rem;
    flex-shrink: 0;
}

.affiliz-automation-home__eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    margin: 0;
}

.affiliz-automation-home__title {
    font-family: 'Sora', 'Manrope', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0;
}

.affiliz-automation-home__lead {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #64748b;
    max-width: 40rem;
}

.affiliz-automation-home__section-head {
    margin-bottom: 0.85rem;
}

.affiliz-automation-home__section-title {
    margin: 0 0 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.affiliz-automation-home__section-sub {
    font-size: 0.85rem;
    color: #94a3b8;
}

.affiliz-automation-home-card {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    height: 100%;
    padding: 1.05rem 1.1rem;
    border: 1px solid var(--ds-border, rgba(15, 23, 42, 0.08));
    border-radius: var(--affiliz-automation-surface-radius, 1rem);
    text-decoration: none;
    color: inherit;
    background: #fff;
    box-shadow: var(--ds-shadow-card, 0 1px 2px rgba(15, 23, 42, 0.04));
    transition: border-color 180ms var(--ds-ease, ease), box-shadow 180ms var(--ds-ease, ease), transform 180ms var(--ds-ease, ease);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.affiliz-automation-home-card:hover,
.affiliz-automation-home-card:focus-visible {
    border-color: var(--ds-border-strong, rgba(15, 23, 42, 0.14));
    box-shadow: var(--ds-shadow-card-hover, 0 8px 22px rgba(18, 140, 70, 0.08));
    color: inherit;
    outline: none;
    transform: translateY(-2px);
}

.affiliz-automation-home-card:active {
    transform: scale(0.99);
}

.affiliz-automation-home-card__icon {
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    background: var(--affiliz-automation-whatsapp-soft, rgba(37, 211, 102, 0.12));
    color: var(--affiliz-automation-whatsapp-dark, #128c46);
    flex-shrink: 0;
}

.affiliz-automation-home-card__body {
    min-width: 0;
    flex: 1 1 auto;
}

.affiliz-automation-home-card__title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #0f172a;
}

.affiliz-automation-home-card__text {
    font-size: 0.85rem;
    color: var(--bs-secondary-color, #6c757d);
    line-height: 1.4;
}

.affiliz-automation-home-card__arrow {
    color: #94a3b8;
    margin-top: 0.15rem;
    transition: transform 0.18s ease, color 0.18s ease;
}

.affiliz-automation-home-card:hover .affiliz-automation-home-card__arrow {
    color: var(--affiliz-automation-whatsapp-dark, #128c46);
    transform: translateX(2px);
}

.affiliz-automation-home-overview {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 3rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: 0.75rem;
    text-decoration: none;
    color: inherit;
    background: rgba(248, 250, 252, 0.9);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.affiliz-automation-home-overview:hover,
.affiliz-automation-home-overview:focus-visible {
    background: var(--affiliz-automation-whatsapp-soft, rgba(37, 211, 102, 0.12));
    border-color: var(--affiliz-automation-whatsapp-border, rgba(134, 239, 172, 0.5));
    color: var(--affiliz-automation-whatsapp-dark, #128c46);
    outline: none;
}

.affiliz-automation-home-overview__icon {
    width: 1.85rem;
    height: 1.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.55rem;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    flex-shrink: 0;
}

.affiliz-automation-home-overview__label {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    font-size: 0.9rem;
}

.affiliz-automation-home-overview__chevron {
    color: #94a3b8;
    font-size: 0.85rem;
}

.affiliz-automation-offer-dispatch .btn {
    min-height: 2.75rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    touch-action: manipulation;
}

/* Legacy connection mount inside shell */
.affiliz-automation-legacy-connections {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.affiliz-automation-legacy-connections .automacao-whatsapp-connection {
    margin-top: 0 !important;
}

.affiliz-automation-legacy-connections .automacao-whatsapp-connection-empty {
    padding: 1.25rem 0.85rem;
}

.affiliz-automation-legacy-connections .btn {
    touch-action: manipulation;
}

/* ---------- Mobile / small tablet ---------- */
@media (max-width: 991.98px) {
    .affiliz-automation-shell__body {
        display: block;
    }

    .affiliz-automation-content__header .affiliz-automation-breadcrumb,
    .affiliz-automation-content__header .automation-breadcrumb {
        margin-bottom: 0.7rem;
    }

    .affiliz-automation-content__title {
        font-size: 1.2rem;
    }

    .affiliz-automation-content__subtitle {
        font-size: 0.85rem;
    }

    .affiliz-automation-nav {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1055;
        width: min(19rem, 88vw);
        max-width: none;
        flex: none;
        border-radius: 0;
        border: none;
        border-right: 1px solid rgba(0, 0, 0, 0.08);
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        padding: calc(0.85rem + env(safe-area-inset-top, 0px)) 0.85rem
            calc(0.85rem + env(safe-area-inset-bottom, 0px));
        box-shadow: 8px 0 28px rgba(15, 23, 42, 0.12);
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .affiliz-automation-nav--open {
        transform: translateX(0);
    }

    .affiliz-automation-nav__list {
        flex: 1 1 auto;
        max-height: none;
        padding-bottom: 0.5rem;
    }

    .affiliz-automation-nav__link {
        min-height: 2.85rem;
        padding: 0.7rem 0.8rem;
        font-size: 0.95rem;
        border-radius: 0.75rem;
    }

    .affiliz-automation-nav__link i {
        font-size: 1.15rem;
        width: 1.25rem;
    }

    .affiliz-automation-shell__backdrop.is-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1050;
        background: rgba(15, 23, 42, 0.45);
        touch-action: none;
    }

    body.affiliz-automation-nav-open {
        overflow: hidden;
        overscroll-behavior: none;
    }

    .affiliz-automation-home-card {
        padding: 1rem;
    }

    .affiliz-automation-home-overview {
        min-height: 3rem;
    }
}

/* Phones */
@media (max-width: 575.98px) {
    .affiliz-automation-shell__mobile-bar {
        margin-bottom: 0.65rem;
    }

    .affiliz-automation-content__header {
        margin-bottom: 1.1rem;
    }

    .affiliz-automation-content__title {
        font-size: 1.1rem;
        margin-bottom: 0.4rem !important;
    }

    .affiliz-automation-content__subtitle {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .affiliz-automation-home__hero {
        padding: 1rem;
        gap: 0.75rem;
    }

    .affiliz-automation-home__title {
        font-size: 1.05rem;
    }

    .affiliz-automation-home-card {
        padding: 0.9rem;
    }

    .affiliz-automation-home-card__text {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .affiliz-automation-nav {
        width: min(100vw - 2.5rem, 20rem);
    }
}

@media (min-width: 992px) {
    .affiliz-automation-shell__mobile-bar {
        display: none;
    }

    .affiliz-automation-nav__header .btn-close {
        display: none !important;
    }

    .affiliz-automation-nav {
        position: sticky;
        top: 0.75rem;
        align-self: flex-start;
    }
}

/* Tablet landscape / medium desktop: slightly narrower sidebar */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .affiliz-automation-nav {
        flex-basis: 13.75rem;
        max-width: 13.75rem;
    }

    .affiliz-automation-nav__link {
        font-size: 0.82rem;
        padding: 0.48rem 0.55rem;
    }
}
