/* ============================================================
   Ditat Shipment Tracking — stylesheet
   Brand: #173240 (navy), #dbf570 (lime accent)
   ============================================================ */

.ditat-tracking-wrap {
    max-width: 1104px;
    margin: 0;
    font-family: inherit;
}

/* ── Form ─────────────────────────────────────────────────── */

.ditat-tracking-form {
    margin-bottom: 2rem;
}

.ditat-tracking-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}

.ditat-tracking-select-wrap,
.ditat-tracking-input-wrap {
    display: flex;
    align-items: stretch;
}

.ditat-tracking-input-wrap {
    flex: 1 1 220px;
}

.ditat-select,
.ditat-input {
    height: 52px;
    padding: 0 1rem;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    font-size: 1rem;
    color: #173240;
    background: #fff;
    transition: border-color 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.ditat-select:focus,
.ditat-input:focus {
    outline: none;
    border-color: #173240;
}

.ditat-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23173240' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.25rem;
    cursor: pointer;
    white-space: nowrap;
}

/* ── Submit button ────────────────────────────────────────── */

.ditat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 52px;
    padding: 0 1.75rem;
    background: #173240;
    color: #dbf570;
    border: none;
    border-radius: 2px;
    font-size: 17px;
    line-height: 20px;
    font-family: Saira;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.3s ease-in-out, opacity 0.3s ease-in-out;
    white-space: nowrap;
    flex-shrink: 0;
}

.ditat-btn:hover {
    color: #173240;
    background: #dbf570;
}

.ditat-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Spinner — hidden by default, visible during loading */
.ditat-btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(219, 245, 112, 0.4);
    border-top-color: #dbf570;
    border-radius: 50%;
}

.ditat-btn--loading .ditat-btn-spinner {
    display: inline-block;
    animation: ditat-spin 0.7s linear infinite;
}

@keyframes ditat-spin {
    to { transform: rotate(360deg); }
}

/* ── Error message ────────────────────────────────────────── */

.ditat-error {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff3f3;
    border-left: 4px solid #dc3545;
    color: #6d1a1a;
    border-radius: 2px;
    font-size: 0.9375rem;
}

/* ── Results area ─────────────────────────────────────────── */

.ditat-results-header {
    padding: 0.5rem 0 1rem;
    font-size: 0.9375rem;
    color: #6c757d;
}

.ditat-results-header p {
    margin: 0;
}

.ditat-results-note {
    margin-top: 0.35rem !important;
    font-size: 0.8125rem;
    font-style: italic;
    color: #8a6d3b;
}

.ditat-no-results {
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    border-radius: 6px;
    color: #6c757d;
}

.ditat-no-results p {
    margin: 0;
}

/* ── Shipment card ────────────────────────────────────────── */

.ditat-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.ditat-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #173240;
    color: #fff;
    padding: 0.875rem 1.25rem;
}

.ditat-card__id {
    font-weight: 700;
    font-size: 1.0625rem;
    letter-spacing: 0.01em;
}

/* Status badge */
.ditat-card__status {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(255,255,255,0.15);
    color: #dbf570;
}

.ditat-card__status--delivered,
.ditat-card__status--complete,
.ditat-card__status--completed {
    background: rgba(219,245,112,0.25);
    color: #dbf570;
}

.ditat-card__status--in-transit,
.ditat-card__status--in-progress {
    background: rgba(23, 162, 184, 0.3);
    color: #9ef0ff;
}

.ditat-card__status--pending,
.ditat-card__status--scheduled {
    background: rgba(255,255,255,0.1);
    color: #f0f0f0;
}

.ditat-card__body {
    padding: 1.25rem;
}

/* Details grid */
.ditat-card__details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem 1.5rem;
    margin: 0;
}

.ditat-card__row {
    display: flex;
    flex-direction: column;
}

.ditat-card__details dt {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
    margin: 0 0 0.2rem;
}

.ditat-card__details dd {
    margin: 0;
    font-size: 0.9375rem;
    color: #173240;
    font-weight: 500;
}

/* ── Stops list ───────────────────────────────────────────── */

.ditat-card__stops {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #dee2e6;
}

.ditat-card__stops h4 {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6c757d;
}

.ditat-stops-list {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.ditat-stops-list::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: #dee2e6;
}

.ditat-stop {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0 0.5rem 2rem;
    position: relative;
    font-size: 0.9rem;
}

.ditat-stop::before {
    content: '';
    position: absolute;
    left: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #dee2e6;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #dee2e6;
}

.ditat-stop--delivered::before,
.ditat-stop--complete::before,
.ditat-stop--completed::before {
    background: #173240;
    box-shadow: 0 0 0 2px #173240;
}

.ditat-stop--in-transit::before {
    background: #17a2b8;
    box-shadow: 0 0 0 2px #17a2b8;
}

.ditat-stop__label {
    font-weight: 600;
    color: #173240;
    min-width: 80px;
}

.ditat-stop__location {
    color: #495057;
    flex: 1;
}

.ditat-stop__date {
    color: #6c757d;
    font-size: 0.85rem;
}

/* ── Raw JSON fallback (shown when field mapping is unknown) ─ */

.ditat-raw-results {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
}

.ditat-raw-results pre {
    margin: 0;
    font-size: 0.8125rem;
    color: #343a40;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Pagination ───────────────────────────────────────────── */

.ditat-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #dee2e6;
}

.ditat-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.15rem;
    background: #173240;
    color: #dbf570;
    border: none;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.ditat-page-btn:hover:not(:disabled) {
    background: #1e4257;
}

.ditat-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ditat-page-status {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6c757d;
    white-space: nowrap;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 767px) {
    .ditat-tracking-fields {
        flex-direction: column;
    }

    .ditat-tracking-select-wrap,
    .ditat-tracking-input-wrap,
    .ditat-btn {
        width: 100%;
    }
    .ditat-tracking-input-wrap {
        flex: 1 1 70px;
    }
    .ditat-btn {
        height: 48px;
        justify-content: center;
    }

    .ditat-card__details {
        grid-template-columns: 1fr 1fr;
    }

    .ditat-pagination {
        gap: 0.5rem;
    }

    .ditat-page-btn {
        padding: 0.55rem 0.85rem;
    }
}
