/* ==========================================================
   VALORIUM ADMIN DELIVERY
   VISUAL ALINHADO AO DASHBOARD E PEDIDOS
   ========================================================== */

.admin-delivery-page {
    display: none;
}

.admin-delivery-page.active {
    display: grid;
    gap: 14px;
}


/* ==========================================================
   HERO
   MESMA LINGUAGEM DO STAGE DE PEDIDOS
   ========================================================== */

.delivery-hero {
    position: relative;
    overflow: hidden;

    min-height: 190px;
    padding: 30px;

    border:
        1px solid rgba(255, 176, 0, 0.14);

    border-radius:
        18px;

    background:
        radial-gradient(
            circle at 92% 0%,
            rgba(255, 176, 0, 0.11),
            transparent 28%
        ),
        radial-gradient(
            circle at 0% 100%,
            rgba(52, 124, 255, 0.045),
            transparent 30%
        ),
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.035),
            rgba(255, 255, 255, 0.012)
        );

    box-shadow:
        0 22px 55px rgba(0, 0, 0, 0.18);
}

.delivery-hero::before {
    content: '';

    position: absolute;
    top: 0;
    left: 31px;

    width: 58px;
    height: 2px;

    background:
        linear-gradient(
            90deg,
            var(--admin-gold),
            rgba(255, 176, 0, 0.15)
        );
}

.delivery-hero::after {
    content: '';

    position: absolute;
    top: -120px;
    right: -120px;

    width: 280px;
    height: 280px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(255, 176, 0, 0.07),
            transparent 68%
        );

    pointer-events: none;
}

.delivery-hero-content {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 28px;
}

.delivery-hero-copy {
    max-width: 760px;
}

.delivery-hero-copy h2 {
    max-width: 760px;

    margin:
        8px 0 8px;

    color:
        #ffffff;

    font-size:
        clamp(24px, 3vw, 32px);

    font-weight:
        750;

    line-height:
        1.12;

    letter-spacing:
        -0.025em;
}

.delivery-hero-copy p {
    max-width: 720px;

    margin: 0;

    color:
        var(--admin-text-soft);

    font-size:
        12px;

    line-height:
        1.7;
}

.delivery-hero-copy .admin-card-eyebrow {
    color:
        var(--admin-gold);
}


/* ==========================================================
   STATUS DA INTEGRACAO
   ========================================================== */

.delivery-health-badge {
    flex:
        0 0 auto;

    min-width:
        220px;

    padding:
        16px 18px;

    border:
        1px solid rgba(255, 255, 255, 0.075);

    border-radius:
        13px;

    background:
        linear-gradient(
            145deg,
            rgba(255, 176, 0, 0.035),
            rgba(255, 255, 255, 0.018)
        );
}

.delivery-health-label {
    display: block;

    margin-bottom:
        8px;

    color:
        rgba(255, 255, 255, 0.42);

    font-size:
        8px;

    font-weight:
        800;

    letter-spacing:
        0.08em;

    text-transform:
        uppercase;
}

.delivery-health-value {
    display: flex;
    align-items: center;

    gap: 10px;

    color:
        #ffffff;

    font-size:
        13px;

    font-weight:
        800;
}

.delivery-health-dot {
    width:
        8px;

    height:
        8px;

    flex:
        0 0 8px;

    border-radius:
        50%;

    background:
        var(--admin-yellow);
}

.delivery-health-badge.healthy {
    border-color:
        rgba(75, 215, 139, 0.16);

    background:
        linear-gradient(
            90deg,
            rgba(75, 215, 139, 0.055),
            rgba(75, 215, 139, 0.018)
        );
}

.delivery-health-badge.healthy
.delivery-health-dot {
    background:
        #4bd78b;

    box-shadow:
        0 0 0 5px rgba(75, 215, 139, 0.065),
        0 0 15px rgba(75, 215, 139, 0.35);
}

.delivery-health-badge.warning {
    border-color:
        rgba(255, 176, 0, 0.20);

    background:
        rgba(255, 176, 0, 0.04);
}

.delivery-health-badge.warning
.delivery-health-dot {
    background:
        var(--admin-yellow);
}


/* ==========================================================
   KPI
   MESMO PADRAO ESCURO DO DASHBOARD
   ========================================================== */

.delivery-kpi-grid {
    display: grid;

    grid-template-columns:
        repeat(6, minmax(0, 1fr));

    gap:
        14px;
}

.delivery-kpi {
    min-width: 0;
    min-height: 118px;

    padding:
        18px;

    border:
        1px solid var(--admin-border);

    border-radius:
        var(--admin-radius);

    background:
        linear-gradient(
            145deg,
            rgba(255, 176, 0, 0.025),
            transparent 42%
        ),
        var(--admin-panel);

    box-shadow:
        var(--admin-shadow);
}

.delivery-kpi-label {
    display: block;

    min-height:
        28px;

    color:
        #d3d7da;

    font-size:
        10px;

    font-weight:
        600;

    line-height:
        1.35;
}

.delivery-kpi strong {
    display: block;

    margin-top:
        4px;

    overflow: hidden;

    color:
        #ffffff;

    font-size:
        clamp(20px, 1.8vw, 27px);

    line-height:
        1;

    letter-spacing:
        -0.035em;

    text-overflow:
        ellipsis;
}

.delivery-kpi small {
    display: block;

    margin-top:
        8px;

    color:
        var(--admin-text-soft);

    font-size:
        9px;

    line-height:
        1.4;
}


/* ==========================================================
   GRID PRINCIPAL
   ========================================================== */

.delivery-main-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1.75fr)
        minmax(270px, 0.72fr);

    gap:
        14px;

    align-items:
        start;
}

.delivery-panel {
    min-width: 0;
}


/* ==========================================================
   TITULOS / CABECALHO
   ========================================================== */

.delivery-card-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap:
        18px;

    padding:
        22px 24px;

    border-bottom:
        1px solid var(--admin-border);
}

.delivery-card-title h2 {
    margin:
        4px 0 0;

    color:
        #ffffff;

    font-size:
        19px;

    line-height:
        1.2;

    letter-spacing:
        -0.02em;
}

.delivery-card-title p {
    margin:
        6px 0 0;

    color:
        var(--admin-text-soft);

    font-size:
        11px;
}


/* ==========================================================
   BOTAO ATUALIZAR
   MESMO PADRAO DOURADO DAS ACOES
   ========================================================== */

.delivery-refresh {
    min-height:
        34px;

    padding:
        6px 12px;

    border:
        1px solid rgba(255, 176, 0, 0.24);

    border-radius:
        9px;

    background:
        rgba(255, 176, 0, 0.045);

    color:
        var(--admin-gold);

    font: inherit;

    font-size:
        9px;

    font-weight:
        800;

    cursor:
        pointer;

    transition:
        transform 150ms ease,
        border-color 150ms ease,
        background 150ms ease;
}

.delivery-refresh:hover {
    transform:
        translateY(-1px);

    border-color:
        rgba(255, 176, 0, 0.42);

    background:
        rgba(255, 176, 0, 0.075);
}

.delivery-refresh:disabled {
    opacity:
        0.48;

    cursor:
        wait;

    transform:
        none;
}


/* ==========================================================
   OUTBOX
   ========================================================== */

.delivery-sync-summary {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap:
        10px;

    padding:
        18px 20px 0;
}

.delivery-sync-stat {
    min-width: 0;

    padding:
        13px 14px;

    border:
        1px solid rgba(255, 255, 255, 0.065);

    border-radius:
        11px;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.018),
            rgba(255, 255, 255, 0.006)
        );
}

.delivery-sync-stat span {
    display: block;

    margin-bottom:
        7px;

    color:
        rgba(255, 255, 255, 0.40);

    font-size:
        8px;

    font-weight:
        800;

    letter-spacing:
        0.07em;

    text-transform:
        uppercase;
}

.delivery-sync-stat strong {
    display: block;

    color:
        #ffffff;

    font-size:
        22px;

    line-height:
        1;
}

.delivery-sync-stat.sent {
    border-color:
        rgba(75, 215, 139, 0.12);
}

.delivery-sync-stat.sent strong {
    color:
        #4bd78b;
}

.delivery-sync-stat.pending,
.delivery-sync-stat.processing {
    border-color:
        rgba(255, 176, 0, 0.12);
}

.delivery-sync-stat.pending strong,
.delivery-sync-stat.processing strong {
    color:
        var(--admin-yellow);
}

.delivery-sync-stat.failed {
    border-color:
        rgba(255, 77, 85, 0.12);
}

.delivery-sync-stat.failed strong {
    color:
        var(--admin-red);
}


/* ==========================================================
   LINHAS DE SAUDE
   ========================================================== */

.delivery-health-list {
    display: grid;

    gap:
        10px;

    padding:
        18px 20px 20px;
}

.delivery-health-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap:
        16px;

    min-height:
        42px;

    padding:
        11px 13px;

    border:
        1px solid rgba(255, 255, 255, 0.055);

    border-radius:
        10px;

    background:
        rgba(255, 255, 255, 0.014);
}

.delivery-health-row span {
    color:
        var(--admin-text-soft);

    font-size:
        10px;
}

.delivery-health-row strong {
    color:
        #ffffff;

    font-size:
        10px;

    font-weight:
        750;

    text-align:
        right;
}


/* ==========================================================
   STATUS / MODALIDADES
   ========================================================== */

.delivery-status-list {
    display: grid;

    gap:
        10px;

    padding:
        18px 20px 20px;
}

.delivery-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap:
        16px;

    min-height:
        43px;

    padding:
        11px 13px;

    border:
        1px solid rgba(255, 255, 255, 0.055);

    border-radius:
        10px;

    background:
        rgba(255, 255, 255, 0.014);

    transition:
        border-color 150ms ease,
        background 150ms ease;
}

.delivery-status-item:hover {
    border-color:
        rgba(255, 176, 0, 0.14);

    background:
        rgba(255, 176, 0, 0.018);
}

.delivery-status-item span {
    color:
        var(--admin-text-soft);

    font-size:
        10px;
}

.delivery-status-item strong {
    color:
        #ffffff;

    font-size:
        14px;
}


/* ==========================================================
   ERRO / EMPTY
   ========================================================== */

.delivery-empty {
    min-height:
        70px;

    display: grid;

    place-items:
        center;

    color:
        var(--admin-text-soft);

    font-size:
        10px;

    text-align:
        center;
}

.delivery-error {
    padding:
        14px 16px;

    border-color:
        rgba(255, 77, 85, 0.16);

    background:
        rgba(255, 77, 85, 0.035);

    color:
        #ff8b91;

    font-size:
        10px;
}


/* ==========================================================
   HISTORICO
   MESMO PADRAO DA TABELA PEDIDOS
   ========================================================== */

.delivery-history-card {
    overflow: hidden;
}

.delivery-history-wrap {
    width: 100%;

    overflow-x:
        auto;
}

.delivery-history-table {
    width:
        100%;

    min-width:
        900px;

    border-collapse:
        collapse;
}

.delivery-history-table th {
    padding:
        12px 15px;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.05);

    background:
        rgba(255, 255, 255, 0.008);

    color:
        rgba(255, 255, 255, 0.38);

    font-size:
        8px;

    font-weight:
        800;

    letter-spacing:
        0.075em;

    text-align:
        left;

    text-transform:
        uppercase;
}

.delivery-history-table td {
    padding:
        14px 15px;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.04);

    color:
        #dce0e3;

    font-size:
        10px;

    vertical-align:
        middle;
}

.delivery-history-table tbody tr {
    transition:
        background 150ms ease;
}

.delivery-history-table tbody tr:hover {
    background:
        rgba(255, 176, 0, 0.015);
}

.delivery-history-table tbody tr:last-child td {
    border-bottom:
        0;
}

.delivery-order-number {
    color:
        #ffffff;

    font-weight:
        800;
}


/* ==========================================================
   BADGES OUTBOX
   ========================================================== */

.delivery-sync-badge {
    display:
        inline-flex;

    align-items:
        center;

    min-height:
        23px;

    padding:
        4px 8px;

    border:
        1px solid rgba(255, 255, 255, 0.08);

    border-radius:
        999px;

    background:
        rgba(255, 255, 255, 0.02);

    color:
        #d9dde0;

    font-size:
        8px;

    font-weight:
        800;

    text-transform:
        uppercase;
}

.delivery-sync-badge.sent {
    border-color:
        rgba(75, 215, 139, 0.18);

    background:
        rgba(75, 215, 139, 0.045);

    color:
        #75dda5;
}

.delivery-sync-badge.pending,
.delivery-sync-badge.processing {
    border-color:
        rgba(255, 176, 0, 0.20);

    background:
        rgba(255, 176, 0, 0.05);

    color:
        #f2c15b;
}

.delivery-sync-badge.failed {
    border-color:
        rgba(255, 77, 85, 0.18);

    background:
        rgba(255, 77, 85, 0.045);

    color:
        #ff858b;
}

.delivery-sync-badge.unknown {
    color:
        var(--admin-text-soft);
}


/* ==========================================================
   RESPONSIVO
   ========================================================== */

@media (max-width: 1280px) {
    .delivery-kpi-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1020px) {
    .delivery-main-grid {
        grid-template-columns:
            1fr;
    }

    .delivery-hero-content {
        align-items:
            flex-start;

        flex-direction:
            column;
    }

    .delivery-health-badge {
        min-width:
            0;

        width:
            100%;
    }
}

@media (max-width: 700px) {
    .delivery-hero {
        padding:
            24px 20px;
    }

    .delivery-kpi-grid {
        grid-template-columns:
            1fr 1fr;
    }

    .delivery-sync-summary {
        grid-template-columns:
            1fr 1fr;
    }

    .delivery-card-title {
        align-items:
            flex-start;

        flex-direction:
            column;

        padding:
            18px;
    }

    .delivery-health-list,
    .delivery-status-list {
        padding:
            16px 18px 18px;
    }
}

@media (max-width: 480px) {
    .delivery-kpi-grid {
        grid-template-columns:
            1fr;
    }

    .delivery-sync-summary {
        grid-template-columns:
            1fr;
    }
}


/* ==========================================================
   DELIVERY - REFINAMENTO FINAL D5.6
   ========================================================== */

.delivery-kpi {
    position: relative;
}

.delivery-kpi-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
}

.delivery-kpi-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 176, 0, 0.20);
    border-radius: 7px;
    background: rgba(255, 176, 0, 0.055);
    color: var(--admin-gold);
    font-size: 10px;
    font-weight: 900;
}

.delivery-kpi-top .delivery-kpi-label {
    min-height: 0;
    color: #d3d7da;
}

.delivery-status-name {
    display: flex;
    align-items: center;
    gap: 9px;
}

.delivery-status-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #6a7279;
}

.delivery-status-item.pending .delivery-status-dot {
    background: var(--admin-yellow);
    box-shadow: 0 0 0 4px rgba(255, 189, 46, 0.055);
}

.delivery-status-item.success .delivery-status-dot {
    background: var(--admin-green);
    box-shadow: 0 0 0 4px rgba(22, 209, 121, 0.055);
}

.delivery-status-item.processing .delivery-status-dot {
    background: var(--admin-orange);
    box-shadow: 0 0 0 4px rgba(255, 122, 0, 0.055);
}

.delivery-status-item.danger .delivery-status-dot {
    background: var(--admin-red);
    box-shadow: 0 0 0 4px rgba(255, 77, 85, 0.055);
}

.delivery-type-grid {
    grid-template-columns: 1fr 1fr;
}

.delivery-type-card {
    position: relative;
    overflow: hidden;
    min-height: 132px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 12px;
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.018),
            rgba(255, 255, 255, 0.006)
        );
}

.delivery-type-card.delivery {
    border-color: rgba(255, 176, 0, 0.15);
    background:
        linear-gradient(
            145deg,
            rgba(255, 176, 0, 0.055),
            rgba(255, 255, 255, 0.008)
        );
}

.delivery-type-card.retirada {
    border-color: rgba(97, 181, 255, 0.12);
    background:
        linear-gradient(
            145deg,
            rgba(97, 181, 255, 0.035),
            rgba(255, 255, 255, 0.008)
        );
}

.delivery-type-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.delivery-type-head span {
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.delivery-type-head small {
    color: var(--admin-gold);
    font-size: 9px;
    font-weight: 800;
}

.delivery-type-card.retirada .delivery-type-head small {
    color: #a4d6ff;
}

.delivery-type-card > strong {
    display: block;
    margin-top: 14px;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.delivery-type-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    color: var(--admin-text-soft);
    font-size: 8px;
}

.delivery-type-track {
    height: 4px;
    overflow: hidden;
    margin-top: 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.055);
}

.delivery-type-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background:
        linear-gradient(
            90deg,
            var(--admin-gold),
            var(--admin-gold-2)
        );
}

.delivery-type-card.retirada .delivery-type-track i {
    background:
        linear-gradient(
            90deg,
            #3188ff,
            #79bcff
        );
}

.delivery-health-ok {
    position: relative;
    padding-left: 14px;
    color: #9be2bd !important;
}

.delivery-health-ok::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    transform: translateY(-50%);
    border-radius: 50%;
    background: var(--admin-green);
    box-shadow: 0 0 0 4px rgba(22, 209, 121, 0.045);
}

.delivery-history-card {
    margin-top: 0;
}

@media (max-width: 700px) {
    .delivery-type-grid {
        grid-template-columns: 1fr;
    }
}
