@import url("./index.css");

/* TRACK */
.track {
    background: var(--color-bg-section);
    padding: 50px 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 40px;
}

/* WRAPPER ESQUERDA */
.track-wrapper {
    max-width: 750px;
    width: 100%;
    margin: 0;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.track h2 {
    font-size: 22px;
    margin-bottom: 12px;
    color: var(--color-text-primary);
}

.track p {
    font-size: 15px;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

/* ========================= */
/* SEARCH */
/* ========================= */

.track-search {
    width: 100%;
    background: var(--color-bg-card);
    padding: 28px;
    border-radius: 10px;
    margin-bottom: 24px;
    border: 1px solid var(--color-border-default);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.track-search h2 {
    font-size: 22px;
    margin: 0;
    color: var(--color-text-primary);
}

.track-search p {
    font-size: 14px;
    margin: 0;
    color: var(--color-text-secondary);
}

.track-search input {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--color-border-default);
    font-size: 14px;
    outline: none;
}

.track-search button {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    background: var(--color-action-primary);
    color: var(--color-text-inverse);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.3s ease;
}

.track-search button:hover {
    filter: brightness(0.95);
}

/* ========================= */
/* CARD RASTREIO */
/* ========================= */

.track-card {
    width: 100%;
    margin: 0 auto 40px;
    background: var(--color-bg-card);
    border-radius: 10px;
    border: 1px solid var(--color-border-default);
    padding: 28px;
    box-shadow: var(--shadow-md);
}

.track-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 20px;
}

.track-header h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--color-text-primary);
    margin: 0;
}

.track-header span {
    color: var(--color-brand-primary);
    font-weight: bold;
}

.track-info {
    padding: 12px 0px;
    border-top: 1px solid var(--color-border-muted);
    border-bottom: 1px solid var(--color-border-muted);
    margin-bottom: 22px;
}

.track-destinatario {
    font-size: 13px;
    color: var(--color-text-primary);
    margin-bottom: 10px;
}

.track-destinatario span {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.track-endereco {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
}

.track-dados {
    background-color: var(--color-bg-muted);
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    border-radius: 8px 0 0 8px;
    border-left: 3px solid var(--color-brand-primary);
}

.track-local {
    padding-left: 14px;
}

.track-local h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 2px 0;
}

.track-local p {
    margin: 0;
    font-size: 11px;
    color: var(--color-text-secondary);
}

.track-status {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
    height: 70px;
    padding: 14px 22px;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0 10px 10px 0;
}

.track-status span {
    font-size: 12px;
    opacity: 0.9;
}

.track-status strong {
    font-size: 15px;
}

.track-card.off {
    opacity: 0;
    transform: translateY(20px);
    display: none;
}

.track-card.on {
    opacity: 1;
    transform: translateY(0);
    display: block;
    transition: all 0.5s ease;
}

/* ========================= */
/* TIMELINE */
/* ========================= */
.timeline {
    position: relative;
    padding-left: 50px;
}

/* LINHA DE FUNDO (CINZA) */
.timeline::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 20px;
    bottom: 24px;
    width: 3px;
    background: var(--color-border-muted);
    z-index: 0;
}

/* LINHA DE PROGRESSO (AZUL - DINÂMICA) */
.timeline::after {
    content: "";
    position: absolute;
    left: 18.5px;
    top: 20px;
    width: 3px;
    background: var(--color-brand-primary);
    z-index: 1;
    height: var(--progress, 0%);
    transition: height 0.5s ease-in-out;
}

.timeline-item {
    display: flex;
    gap: 16px;
    margin-bottom: 26px;
}

.timeline-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -50px;
    position: relative;
    z-index: 2;
}

.timeline-dot svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.timeline-dot.is-pending {
    background: var(--color-action-disabled);
}

.timeline-content strong {
    display: block;
    font-size: 15px;
    color: var(--color-text-primary);
}

.timeline-content span {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* ========================= */
/* DUVIDAS */
/* ========================= */

.cardDuvidas {
    background: var(--color-bg-card);
    padding: 20px;
    border-radius: 10px;
    width: 360px;
    min-width: 320px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-default);
}

.cardDuvidas h2 {
    margin-bottom: 5px;
}

.cardDuvidas h6 {
    font-weight: normal;
    color: var(--color-text-secondary);
    margin-bottom: 15px;
}

.duvida {
    border-bottom: 1px solid var(--color-border-muted);
}

.pergunta {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 14px 0;
    font-size: 14px;
    cursor: pointer;
    color: var(--color-brand-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pergunta:hover {
    color: var(--color-brand-primary-hover);
}

.pergunta::after {
    content: "›";
    font-size: 18px;
    transform: rotate(90deg);
    transition: 0.3s;
    color: var(--color-text-muted);
}

.duvida.ativa .pergunta::after {
    transform: rotate(-90deg);
    color: var(--color-brand-primary);
}

.resposta {
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.resposta p {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin: 5px 0 15px;
    line-height: 1.5;
}

/* ========================= */
/* LOADING */
/* ========================= */

.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.loading-spinner svg {
    animation: spin 1s linear infinite;
}

.loading-spinner circle {
    stroke: var(--color-brand-primary);
    stroke-dasharray: 90;
    stroke-dashoffset: 60;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* ========================= */
/* RESPONSIVO */
/* ========================= */

@media (max-width: 1024px) {
    .track {
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
    }

    .track-wrapper {
        max-width: 600px;
    }

    .cardDuvidas {
        width: 100%;
        max-width: 600px;
    }
}

@media (max-width: 768px) {
    .track-wrapper {
        padding: 0 16px;
    }

    .track h2 {
        font-size: 20px;
        text-align: center;
    }

    .track p {
        font-size: 14px;
    }

    /* SEARCH */
    .track-search {
        padding: 20px;
    }

    /* CARD RASTREIO */
    .track-card {
        padding: 20px;
    }

    .track-endereco {
        display: flex;
        flex-direction: column;
        /* Empilha endereço em cima e status embaixo */
        width: 100%;
        gap: 0;
        /* Remove qualquer espaço entre os dois */
        border-radius: 8px;
        overflow: hidden;
        /* Garante que as bordas arredondadas funcionem */
        border: 1px solid var(--color-border-default);
        /* Opcional: contorno leve */
    }

    .track-dados {
        width: 100% !important;
        /* Força largura total */
        height: auto;
        min-height: 80px;
        padding: 15px;
        border-radius: 0;
        /* Remove bordas individuais para unificar */
        border-left: 4px solid var(--color-brand-primary);
        background-color: var(--color-bg-muted);
        display: flex;
        align-items: center;
    }

    .track-status {
        width: 100% !important;
        /* Força largura total */
        min-width: 100%;
        height: auto;
        padding: 12px 15px;
        border-radius: 0;
        /* Remove bordas para não separar do de cima */
        flex-direction: row;
        /* Coloca "Status" e "Em Trânsito" lado a lado */
        justify-content: space-between;
        /* Espalha o texto nas pontas */
        align-items: center;
    }

    /* Ajuste para o texto não ficar gigante no celular */
    .track-status strong {
        font-size: 14px;
    }

    .track-local {
        padding-left: 0px;
    }

    .track-local h4 {
        font-size: 13px;
    }

    /* Reposicionamento da Timeline para não ficar colada na borda */
    .timeline {
        padding-left: 40px;
        /* Espaço para o dot e a linha */
        margin-top: 30px;
        position: relative;
    }

    /* Ajuste das Linhas (Centralização Precisa) */
    .timeline::before,
    .timeline::after {
        /* Cálculo: (Padding 40px / 2) - (Metade da largura da linha 3px / 2) */
        /* Para um dot de 32px posicionado com margin-left -40px: */
        left: 15.5px;
        width: 2px;
        /* Linha levemente mais fina para mobile */
        top: 10px;
        bottom: 10px;
    }

    .timeline-item {
        display: flex;
        gap: 15px;
        margin-bottom: 30px;
        align-items: flex-start;
        /* Garante alinhamento no topo do texto */
    }

    .timeline-dot {
        width: 32px;
        height: 32px;
        margin-left: -40px;
        /* Coloca o dot dentro do padding da timeline */
        flex-shrink: 0;
        /* Impede que o círculo amasse */
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        z-index: 2;
    }

    .timeline-dot svg {
        width: 14px;
        height: 14px;
    }

    /* Conteúdo da Timeline */
    .timeline-content {
        padding-top: 4px;
        /* Alinha o texto com o centro do dot */
    }

    .timeline-content strong {
        font-size: 14px;
        line-height: 1.2;
    }

    .timeline-content span {
        font-size: 12px;
        margin-top: 4px;
    }

    .cardDuvidas h6 {
        text-align: center;
    }

    .track-header h3 {
        font-size: 13px;
    }
}