/**
 * MA Logistics Tracking — Clean, Premium, Scoped Stylesheet
 */

:root {
    --ma-primary: #2563eb;
    --ma-primary-dark: #1d4ed8;
    --ma-primary-light: #eff6ff;
    --ma-success: #16a34a;
    --ma-success-bg: #dcfce7;
    --ma-warning: #d97706;
    --ma-warning-bg: #fef3c7;
    --ma-danger: #dc2626;
    --ma-danger-bg: #fee2e2;
    --ma-dark: #0f172a;
    --ma-slate: #1e293b;
    --ma-muted: #64748b;
    --ma-border: #e2e8f0;
    --ma-card-bg: #ffffff;
    --ma-radius-lg: 16px;
    --ma-radius-sm: 8px;
    --ma-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.ma-tracking-container,
.ma-tracking-container * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
}

.ma-tracking-container {
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ================== SEARCH PANEL ================== */
.ma-search-wrapper {
    background: var(--ma-card-bg);
    border-radius: var(--ma-radius-lg);
    padding: 30px 28px;
    box-shadow: var(--ma-shadow);
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: box-shadow 0.3s ease;
}

@media (min-width: 768px) {
    .ma-search-wrapper {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.ma-search-left {
    flex: 1;
}

.ma-search-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--ma-dark);
    margin: 0 0 6px 0;
    letter-spacing: -0.5px;
}

.ma-search-subtitle {
    font-size: 14px;
    color: var(--ma-muted);
    margin: 0;
    line-height: 1.5;
}

.ma-search-right {
    flex: 1.2;
    width: 100%;
    max-width: 560px;
}

.ma-search-form {
    width: 100%;
}

.ma-input-group {
    display: flex;
    align-items: center;
    position: relative;
    border: 2px solid var(--ma-border);
    border-radius: 50px;
    padding: 4px 6px;
    transition: all 0.25s ease;
    background: #f8fafc;
    width: 100%;
}

.ma-input-group:focus-within {
    border-color: var(--ma-primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.ma-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px 0 16px;
    color: var(--ma-muted);
    font-size: 16px;
}

.ma-tracking-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 11px 8px !important;
    font-size: 15px !important;
    color: var(--ma-dark) !important;
    outline: none !important;
    box-shadow: none !important;
    min-width: 120px;
}

.ma-tracking-input::placeholder {
    color: #94a3b8;
}

.ma-tracking-btn {
    background: linear-gradient(135deg, var(--ma-primary), var(--ma-primary-dark));
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 11px 26px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.ma-tracking-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

/* Spinner */
.ma-loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: maSpin 0.7s linear infinite;
    display: none;
}

@keyframes maSpin {
    to { transform: rotate(360deg); }
}

/* Error Container */
.ma-error-container {
    color: var(--ma-danger);
    font-size: 14px;
    font-weight: 500;
    padding: 14px 20px;
    background: var(--ma-danger-bg);
    border-radius: var(--ma-radius-sm);
    border: 1px solid #fecaca;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: maFadeIn 0.3s ease;
}

/* ================== RESULT WRAPPER ================== */
.ma-result-wrapper {
    background: var(--ma-card-bg);
    border-radius: var(--ma-radius-lg);
    box-shadow: var(--ma-shadow);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    animation: maSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes maSlideDown {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes maFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Header Band */
.ma-result-header-band {
    background: var(--ma-dark);
    color: #ffffff;
    padding: 18px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 576px) {
    .ma-result-header-band {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.ma-header-awb-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.ma-result-awb-title {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.ma-copy-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.ma-copy-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.ma-result-status-title {
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: var(--ma-slate);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 800;
    display: inline-block;
}

/* Route Overview Card */
.ma-route-card {
    background: #f8fafc;
    border-bottom: 1px solid var(--ma-border);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ma-route-node {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ma-route-right {
    text-align: right;
}

.ma-route-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--ma-muted);
    letter-spacing: 0.8px;
}

.ma-route-city {
    font-size: 15px;
    font-weight: 700;
    color: var(--ma-dark);
}

.ma-route-transit-indicator {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    max-width: 280px;
    margin: 0 20px;
}

.ma-route-line {
    width: 100%;
    height: 2px;
    background: #cbd5e1;
    border-radius: 2px;
}

.ma-route-truck {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--ma-primary);
}

/* Body Grid */
.ma-result-body-grid {
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

@media (min-width: 992px) {
    .ma-result-body-grid {
        grid-template-columns: 1.1fr 1.5fr;
    }
}

.ma-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ma-dark);
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #f1f5f9;
    letter-spacing: -0.2px;
}

/* Info Table */
.ma-info-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--ma-border);
    border-radius: var(--ma-radius-sm);
    overflow: hidden;
    background: #ffffff;
}

.ma-info-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ma-border);
    font-size: 13px;
    color: #334155;
    line-height: 1.4;
}

.ma-info-table tr:last-child td {
    border-bottom: none;
}

.ma-info-table td.label-cell {
    font-weight: 600;
    background-color: #f8fafc;
    color: #475569;
    width: 40%;
    border-right: 1px solid var(--ma-border);
}

.ma-info-table td.value-cell {
    font-weight: 500;
    color: var(--ma-dark);
    word-break: break-word;
}

.ma-info-table td.value-cell.status-highlight {
    font-weight: 800;
    color: var(--ma-primary);
}

/* ================== MILESTONE TIMELINE ================== */
.ma-timeline-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 8px;
}

.ma-timeline-header-row .ma-section-title {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.ma-events-counter {
    font-size: 12px;
    font-weight: 700;
    background: #f1f5f9;
    color: var(--ma-muted);
    padding: 2px 10px;
    border-radius: 12px;
}

.ma-timeline-wrapper {
    position: relative;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ma-timeline-wrapper::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 8px;
    width: 2px;
    background: #e2e8f0;
}

.ma-timeline-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #ffffff;
    border: 1px solid var(--ma-border);
    border-radius: var(--ma-radius-sm);
    padding: 12px 16px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ma-timeline-item:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.ma-timeline-dot {
    position: absolute;
    left: -20px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ma-primary);
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px var(--ma-primary);
}

.ma-timeline-item.is-delivered .ma-timeline-dot {
    background: var(--ma-success);
    box-shadow: 0 0 0 2px var(--ma-success);
}

.ma-timeline-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ma-timeline-activity {
    font-size: 14px;
    font-weight: 700;
    color: var(--ma-dark);
}

.ma-timeline-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
}

.ma-timeline-item.is-delivered .ma-timeline-badge {
    background: var(--ma-success-bg);
    color: var(--ma-success);
}

.ma-timeline-meta {
    font-size: 12px;
    color: var(--ma-muted);
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.ma-timeline-remarks {
    font-size: 13px;
    color: #334155;
    margin-top: 4px;
    font-style: italic;
    background: #f8fafc;
    padding: 6px 10px;
    border-radius: 4px;
}

.ma-timeline-empty {
    text-align: center;
    padding: 36px 20px;
    color: var(--ma-muted);
    font-size: 14px;
    background: #f8fafc;
    border-radius: var(--ma-radius-sm);
    border: 1px dashed var(--ma-border);
}

/* Footer */
.ma-result-footer {
    background: #f8fafc;
    border-top: 1px solid var(--ma-border);
    padding: 14px 24px;
    text-align: center;
    font-size: 12px;
    color: var(--ma-muted);
    font-weight: 500;
}
