/* ============================================================
   TrackKar — Frontend Tracking Page
   All classes are prefixed .tkf- to avoid theme conflicts.
   ============================================================ */

/* ── Wrapper ────────────────────────────────────────────────── */
.tkf-wrap {
    max-width: 700px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    color: #1f2937;
    line-height: 1.5;
}

/* ── Search Box ─────────────────────────────────────────────── */
.tkf-search-box {
    margin-bottom: 24px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.tkf-search-form {
    margin: 0;
    padding: 0;
}

.tkf-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tkf-search-icon {
    flex-shrink: 0;
    color: #9ca3af;
    display: flex;
    align-items: center;
}

.tkf-input {
    flex: 1;
    padding: 11px 14px;
    font-size: 15px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    background: #f9fafb;
    color: #111827;
    transition: border-color .15s, background .15s;
    min-width: 0;
}
.tkf-input::placeholder { color: #9ca3af; }
.tkf-input:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.tkf-search-btn {
    padding: 11px 24px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, transform .1s;
    flex-shrink: 0;
}
.tkf-search-btn:hover  { background: #1d4ed8; }
.tkf-search-btn:active { transform: scale(.97); }

/* ── Loading ────────────────────────────────────────────────── */
.tkf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 14px;
}

.tkf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: tkf-spin .7s linear infinite;
}

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

/* ── Notice / Error ─────────────────────────────────────────── */
.tkf-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
}

.tkf-notice--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.tkf-notice svg { flex-shrink: 0; margin-top: 1px; }

/* ── Card ───────────────────────────────────────────────────── */
.tkf-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}

/* ── Card Header ────────────────────────────────────────────── */
.tkf-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f8fafc 0%, #f0f4ff 100%);
    border-bottom: 1px solid #e5e7eb;
    border-left: 5px solid var(--status-color, #2563eb);
    flex-wrap: wrap;
}

.tkf-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.tkf-status-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.tkf-status-label {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.tkf-updated-at {
    font-size: 12px;
    color: #6b7280;
    margin-top: 3px;
}

.tkf-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.tkf-tn-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

.tkf-tn-label {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.tkf-tn-value {
    font-size: 15px;
    font-weight: 700;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    color: #111827;
    letter-spacing: .03em;
}

.tkf-courier-badge {
    display: inline-block;
    padding: 3px 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}

/* ── Progress Stepper ───────────────────────────────────────── */
.tkf-stepper {
    display: flex;
    align-items: flex-start;
    padding: 24px 28px 20px;
    gap: 0;
    position: relative;
}

.tkf-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    text-align: center;
    min-width: 0;
}

/* Connector line lives inside each step (except last) */
.tkf-step-line {
    position: absolute;
    top: 16px; /* vertically centres with the dot (dot is 32px tall → centre = 16px) */
    left: 50%;
    width: 100%;
    height: 3px;
    background: #e5e7eb;
    z-index: 0;
}

.tkf-step-line--done {
    background: var(--step-color, #2563eb);
}

.tkf-step-dot {
    position: relative;
    z-index: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2.5px solid #d1d5db;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .2s, background .2s;
    flex-shrink: 0;
}

.tkf-step--done .tkf-step-dot {
    background: var(--step-color, #2563eb);
    border-color: var(--step-color, #2563eb);
    color: #fff;
}

.tkf-step--active .tkf-step-dot {
    border-color: var(--step-color, #2563eb);
    border-width: 2.5px;
}

.tkf-step--pending .tkf-step-dot {
    border-color: #d1d5db;
}

/* Pulsing ring for active step */
.tkf-step-pulse {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--step-color, #2563eb);
    animation: tkf-pulse 1.4s ease-in-out infinite;
}

@keyframes tkf-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .5; transform: scale(1.2); }
}

.tkf-step-label {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    line-height: 1.3;
    padding: 0 4px;
    max-width: 90px;
}

.tkf-step--done   .tkf-step-label { color: #374151; font-weight: 600; }
.tkf-step--active .tkf-step-label { color: #1d4ed8; font-weight: 700; }

/* ── Special Status Banner ──────────────────────────────────── */
.tkf-special-banner {
    margin: 0 24px 0;
    padding: 14px 18px;
    border-radius: 10px;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    margin-bottom: 4px;
}

.tkf-special-hint {
    font-size: 13px;
    color: #6b7280;
    flex-basis: 100%;
    margin-top: 2px;
}

/* ── Timeline ───────────────────────────────────────────────── */
.tkf-timeline-section {
    padding: 24px 24px 20px;
    border-top: 1px solid #f3f4f6;
}

.tkf-timeline-title {
    font-size: 13px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 16px;
}

.tkf-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tkf-event {
    display: flex;
    gap: 16px;
    position: relative;
}

.tkf-event-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 20px;
}

.tkf-event-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d1d5db;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #d1d5db;
    flex-shrink: 0;
    margin-top: 3px;
    z-index: 1;
    transition: background .2s, box-shadow .2s;
}

.tkf-event-line {
    width: 2px;
    flex: 1;
    background: #e5e7eb;
    margin-top: 4px;
    min-height: 24px;
}

.tkf-event:last-child .tkf-event-line {
    display: none;
}

.tkf-event-content {
    flex: 1;
    padding-bottom: 20px;
    min-width: 0;
}

.tkf-event:last-child .tkf-event-content {
    padding-bottom: 0;
}

.tkf-event-desc {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
}

.tkf-event-desc--latest {
    color: #111827;
    font-weight: 700;
    font-size: 15px;
}

.tkf-event-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.tkf-event-loc {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
}

.tkf-event-date {
    font-size: 12px;
    color: #9ca3af;
}

/* ── Card Footer ────────────────────────────────────────────── */
.tkf-card-footer {
    padding: 16px 24px;
    border-top: 1px solid #f3f4f6;
    background: #fafafa;
    text-align: center;
}

.tkf-courier-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    background: #2563eb;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, transform .1s;
    border: none;
    cursor: pointer;
}
.tkf-courier-btn:hover  { background: #1d4ed8; color: #fff; text-decoration: none; }
.tkf-courier-btn:active { transform: scale(.97); }

.tkf-courier-btn--outline {
    background: transparent;
    color: #2563eb;
    border: 1.5px solid #2563eb;
    padding: 7px 14px;
    font-size: 13px;
}
.tkf-courier-btn--outline:hover {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #1d4ed8;
}

.tkf-manual-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.tkf-manual-note {
    font-size: 13px;
    color: #6b7280;
}

.tkf-manual-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tkf-tn-code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 5px 10px;
    color: #374151;
    user-select: all;
}

.tkf-copy-btn {
    padding: 7px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: background .15s;
}
.tkf-copy-btn:hover { background: #e5e7eb; }

/* ── Search Type Toggle ─────────────────────────────────────── */
.tkf-search-type-toggle {
    display: flex;
    gap: 4px;
    padding: 12px 16px 0;
}
.tkf-search-type-btn {
    flex: 1;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.tkf-search-type-btn:hover {
    background: #f3f4f6;
    color: #374151;
}
.tkf-search-type-btn--active {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
@media (max-width: 400px) {
    .tkf-search-type-toggle { padding: 10px 12px 0; }
    .tkf-search-type-btn { font-size: 11px; padding: 6px 8px; }
}

/* ── Powered-by Footer ──────────────────────────────────────── */
.tkf-powered-by {
    text-align: center;
    padding: 12px 16px 14px;
    font-size: 11.5px;
    color: #9ca3af;
    border-top: 1px solid #f3f4f6;
    letter-spacing: .01em;
}
.tkf-powered-by__link {
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    transition: color .15s;
}
.tkf-powered-by__link:hover {
    color: #111827;
    text-decoration: underline;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 540px) {
    .tkf-search-box { padding: 14px; }

    .tkf-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .tkf-header-right {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .tkf-tn-badge { align-items: flex-start; }

    .tkf-stepper { padding: 16px 12px 14px; }
    .tkf-step-label { font-size: 10px; max-width: 70px; }
    .tkf-step-dot { width: 26px; height: 26px; }
    .tkf-step-line { top: 13px; }

    .tkf-timeline-section { padding: 16px 16px 14px; }
    .tkf-card-footer { padding: 14px 16px; }
    .tkf-special-banner { margin: 16px 16px 0; }
}
