/* Koombiyo Delivery Frontend Styles — modern tracking UI */

.koombiyo-tracking-container {
    --kd-primary: #0c8a45;
    --kd-primary-dark: #076a34;
    --kd-primary-soft: #e8f6ee;
    --kd-ink: #17251d;
    --kd-muted: #64756c;
    --kd-line: #e3e9e5;
    --kd-surface: #f6f9f7;
    --kd-card: #ffffff;
    --kd-amber: #d97706;
    --kd-amber-soft: #fef3e2;
    --kd-blue: #1d6fb8;
    --kd-blue-soft: #e8f1fa;
    --kd-red: #c2372f;
    --kd-red-soft: #fdecea;
    --kd-radius: 14px;

    max-width: 860px;
    margin: 40px auto;
    padding: 20px;
    color: var(--kd-ink);
    -webkit-font-smoothing: antialiased;
}

.koombiyo-tracking-form {
    background: var(--kd-card);
    border: 1px solid var(--kd-line);
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(23, 37, 29, 0.04), 0 16px 40px -20px rgba(23, 37, 29, 0.18);
    padding: 44px 40px 32px;
}

/* ---------- Header ---------- */

.kd-head {
    text-align: center;
    margin-bottom: 28px;
}

.kd-head-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: var(--kd-primary-soft);
    color: var(--kd-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kd-head-icon svg {
    width: 28px;
    height: 28px;
}

.tracking-title {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--kd-ink);
    margin: 0 0 6px 0;
    text-align: center;
}

.tracking-subtitle {
    font-size: 14.5px;
    color: var(--kd-muted);
    margin: 0;
    text-align: center;
}

/* ---------- Search row ---------- */

.track-form {
    margin-bottom: 8px;
}

.kd-search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.kd-input-wrap {
    position: relative;
    flex: 1;
}

.kd-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 19px;
    height: 19px;
    color: var(--kd-muted);
    pointer-events: none;
}

.track-input {
    width: 100%;
    padding: 15px 18px 15px 46px;
    font-size: 15.5px;
    color: var(--kd-ink);
    background: var(--kd-surface);
    border: 1.5px solid var(--kd-line);
    border-radius: var(--kd-radius);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
}

.track-input::placeholder {
    color: #93a29a;
}

.track-input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--kd-primary);
    box-shadow: 0 0 0 4px rgba(12, 138, 69, 0.12);
}

.track-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 26px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #ffffff;
    background: var(--kd-primary);
    border: none;
    border-radius: var(--kd-radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.track-button svg {
    width: 17px;
    height: 17px;
    transition: transform 0.2s ease;
}

.track-button:hover {
    background: var(--kd-primary-dark);
    box-shadow: 0 8px 20px -8px rgba(12, 138, 69, 0.55);
}

.track-button:hover svg {
    transform: translateX(3px);
}

.track-button:active {
    transform: translateY(1px);
}

.track-button:focus-visible {
    outline: 3px solid rgba(12, 138, 69, 0.4);
    outline-offset: 2px;
}

/* ---------- Loader ---------- */

.tracking-loader {
    text-align: center;
    padding: 40px 20px;
    color: var(--kd-muted);
    font-size: 14px;
}

.loader-spinner {
    width: 42px;
    height: 42px;
    border: 3.5px solid var(--kd-primary-soft);
    border-top-color: var(--kd-primary);
    border-radius: 50%;
    animation: kd-spin 0.9s linear infinite;
    margin: 0 auto 16px;
}

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

/* ---------- Error ---------- */

.tracking-error {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--kd-red-soft);
    border: 1px solid #f4c7c3;
    border-radius: var(--kd-radius);
    padding: 16px 18px;
    color: var(--kd-red);
    margin-top: 20px;
    font-size: 14.5px;
}

.tracking-error svg {
    width: 21px;
    height: 21px;
    flex-shrink: 0;
    margin-top: 1px;
}

.tracking-error p {
    margin: 0;
    line-height: 1.5;
}

/* ---------- Result card ---------- */

.tracking-result {
    margin-top: 26px;
    animation: kd-fade-in 0.45s ease;
}

@keyframes kd-fade-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tracking-info-card {
    background: var(--kd-surface);
    border: 1px solid var(--kd-line);
    border-radius: 16px;
    padding: 26px 28px;
}

.kd-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding-bottom: 18px;
    border-bottom: 1px dashed var(--kd-line);
}

.kd-card-id {
    font-size: 15px;
}

.kd-card-id-label {
    color: var(--kd-muted);
    font-weight: 600;
    margin-right: 4px;
}

.kd-card-id-value {
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--kd-ink);
}

.status-badge {
    display: inline-block;
    padding: 7px 15px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--kd-amber-soft);
    color: var(--kd-amber);
}

.status-badge.st-delivered { background: var(--kd-primary-soft); color: var(--kd-primary-dark); }
.status-badge.st-out      { background: var(--kd-blue-soft);    color: var(--kd-blue); }
.status-badge.st-transit  { background: var(--kd-blue-soft);    color: var(--kd-blue); }
.status-badge.st-issue    { background: var(--kd-red-soft);     color: var(--kd-red); }
.status-badge.st-pending  { background: var(--kd-amber-soft);   color: var(--kd-amber); }

/* ---------- 5-Step Timeline ---------- */

.status-timeline {
    display: flex;
    margin: 30px 0 26px;
}

.timeline-item {
    flex: 1;
    text-align: center;
    position: relative;
}

/* connecting segment to the left of each step (skipped on the first) */
.timeline-item::before {
    content: '';
    position: absolute;
    top: 23px;
    right: 50%;
    left: -50%;
    height: 3px;
    border-radius: 2px;
    background: var(--kd-line);
    z-index: 0;
}

.timeline-item:first-child::before {
    display: none;
}

.timeline-item.complete::before,
.timeline-item.active::before {
    background: var(--kd-primary);
}

.timeline-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    background: #ffffff;
    border: 2px solid var(--kd-line);
    color: #a9b6ae;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.timeline-icon svg {
    width: 21px;
    height: 21px;
}

.timeline-item.complete .timeline-icon {
    background: var(--kd-primary);
    border-color: var(--kd-primary);
    color: #ffffff;
}

.timeline-item.active .timeline-icon {
    background: #ffffff;
    border-color: var(--kd-primary);
    color: var(--kd-primary);
    box-shadow: 0 0 0 5px rgba(12, 138, 69, 0.14);
    animation: kd-pulse 2s infinite;
}

@keyframes kd-pulse {
    0%, 100% { box-shadow: 0 0 0 5px rgba(12, 138, 69, 0.14); }
    50%      { box-shadow: 0 0 0 9px rgba(12, 138, 69, 0.07); }
}

.timeline-label {
    font-size: 12.5px;
    color: var(--kd-muted);
    font-weight: 600;
    line-height: 1.35;
    padding: 0 4px;
}

.timeline-item.complete .timeline-label,
.timeline-item.active .timeline-label {
    color: var(--kd-ink);
    font-weight: 700;
}

/* ---------- Details grid ---------- */

.info-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.info-item {
    background: #ffffff;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--kd-line);
}

.info-item .label {
    display: block;
    font-size: 12px;
    color: var(--kd-muted);
    margin-bottom: 5px;
    font-weight: 600;
}

.info-item .value {
    display: block;
    font-size: 16.5px;
    color: var(--kd-ink);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.branch-phone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--kd-primary-dark);
    text-decoration: none;
    background: var(--kd-primary-soft);
    padding: 5px 11px;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.branch-phone:hover {
    background: #d8efe2;
    color: var(--kd-primary-dark);
}

.branch-phone svg {
    width: 13px;
    height: 13px;
}

/* ---------- Order history ---------- */

.order-history {
    margin-top: 22px;
    background: #ffffff;
    border: 1px solid var(--kd-line);
    border-radius: 12px;
    padding: 22px 24px;
}

.order-history h3 {
    margin: 0 0 18px 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--kd-ink);
}

.history-timeline {
    position: relative;
    padding-left: 26px;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    border-radius: 1px;
    background: var(--kd-line);
}

.history-item {
    position: relative;
    padding-bottom: 20px;
}

.history-item:last-child {
    padding-bottom: 0;
}

.history-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 5px;
    width: 10px;
    height: 10px;
    background: var(--kd-primary);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--kd-primary-soft);
}

.history-item:first-child::before {
    background: var(--kd-primary);
    box-shadow: 0 0 0 3px rgba(12, 138, 69, 0.25);
}

.history-time {
    font-size: 12px;
    color: var(--kd-muted);
    margin-bottom: 3px;
}

.history-status {
    font-size: 14.5px;
    color: var(--kd-ink);
    font-weight: 600;
    margin-bottom: 3px;
}

.history-note {
    font-size: 13px;
    color: var(--kd-muted);
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    font-size: 15px;
    color: var(--kd-muted);
}

/* ---------- Customer care footer ---------- */

.koombiyo-customer-care-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #0e3d24 0%, #0c8a45 100%);
    border-radius: 16px;
    color: #ffffff;
}

.kd-care-icon {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kd-care-icon svg {
    width: 23px;
    height: 23px;
}

.kd-care-label {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.85;
}

.kd-care-phone {
    display: inline-block;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #ffffff;
    text-decoration: none;
    margin: 2px 0;
}

.kd-care-phone:hover {
    color: #ffffff;
    text-decoration: underline;
}

.kd-care-note {
    font-size: 12px;
    opacity: 0.75;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .tracking-result,
    .timeline-item.active .timeline-icon {
        animation: none;
    }
    .track-button,
    .track-button svg,
    .track-input,
    .timeline-icon {
        transition: none;
    }
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .koombiyo-tracking-container {
        margin: 20px auto;
        padding: 10px;
    }

    .koombiyo-tracking-form {
        padding: 28px 18px 22px;
        border-radius: 16px;
    }

    .tracking-title {
        font-size: 22px;
    }

    .kd-search-row {
        flex-direction: column;
    }

    .track-button {
        width: 100%;
        padding: 14px 20px;
    }

    .tracking-info-card {
        padding: 20px 16px;
    }

    .info-header {
        grid-template-columns: 1fr;
    }

    /* Compact horizontal timeline on mobile */
    .status-timeline {
        margin: 24px 0 20px;
    }

    .timeline-item::before {
        top: 19px;
    }

    .timeline-icon {
        width: 40px;
        height: 40px;
        margin: 0 auto 8px;
    }

    .timeline-icon svg {
        width: 17px;
        height: 17px;
    }

    .timeline-label {
        font-size: 10px;
        line-height: 1.25;
        padding: 0 2px;
    }

    .order-history {
        padding: 18px 16px;
    }
}

@media (max-width: 480px) {
    .timeline-item::before {
        top: 17px;
        height: 2.5px;
    }

    .timeline-icon {
        width: 36px;
        height: 36px;
    }

    .timeline-icon svg {
        width: 15px;
        height: 15px;
    }

    .timeline-label {
        font-size: 9px;
    }

    .kd-care-phone {
        font-size: 19px;
    }
}

@media (max-width: 360px) {
    .timeline-icon {
        width: 32px;
        height: 32px;
    }

    .timeline-icon svg {
        width: 13px;
        height: 13px;
    }

    .timeline-label {
        font-size: 8px;
    }

    .koombiyo-customer-care-footer {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}
