/* =============================================================================
   TPC Courier Integration — Public Styles
   Version: 1.0.0
   ============================================================================= */

/* ── Design Tokens ──────────────────────────────────────────────────────────── */
:root {
    --tpc-primary:        #1a56db;
    --tpc-primary-dark:   #1342b0;
    --tpc-primary-light:  #e8f0fd;
    --tpc-success:        #0a7c42;
    --tpc-success-bg:     #edfaed;
    --tpc-error:          #c0392b;
    --tpc-error-bg:       #fdecea;
    --tpc-warn:           #b45309;
    --tpc-warn-bg:        #fff8e1;
    --tpc-text:           #1a202c;
    --tpc-text-muted:     #6b7280;
    --tpc-border:         #e2e8f0;
    --tpc-bg:             #f8fafc;
    --tpc-white:          #ffffff;
    --tpc-radius:         12px;
    --tpc-radius-sm:      8px;
    --tpc-shadow:         0 4px 20px rgba(0, 0, 0, 0.08);
    --tpc-shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.06);
    --tpc-transition:     all 0.22s ease;
    --tpc-font:           'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Base Widget ────────────────────────────────────────────────────────────── */
.tpc-widget {
    font-family: var(--tpc-font);
    font-size: 15px;
    color: var(--tpc-text);
    background: var(--tpc-white);
    border: 1px solid var(--tpc-border);
    border-radius: var(--tpc-radius);
    box-shadow: var(--tpc-shadow);
    padding: 32px;
    margin: 24px 0;
    max-width: 780px;
}

/* ── Widget Header ──────────────────────────────────────────────────────────── */
.tpc-widget-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--tpc-border);
}

.tpc-widget-icon {
    font-size: 40px;
    line-height: 1;
    flex-shrink: 0;
}

.tpc-widget-title {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: var(--tpc-text);
    line-height: 1.2;
}

.tpc-widget-subtitle {
    margin: 0;
    color: var(--tpc-text-muted);
    font-size: 14px;
}

/* ── Search / Input Bar ─────────────────────────────────────────────────────── */
.tpc-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tpc-search-bar .tpc-input {
    flex: 1;
}

/* ── Inputs ─────────────────────────────────────────────────────────────────── */
.tpc-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 16px;
    border: 1.5px solid var(--tpc-border);
    border-radius: var(--tpc-radius-sm);
    font-family: var(--tpc-font);
    font-size: 15px;
    color: var(--tpc-text);
    background: var(--tpc-bg);
    transition: var(--tpc-transition);
    outline: none;
    -webkit-appearance: none;
}

.tpc-input:focus {
    border-color: var(--tpc-primary);
    background: var(--tpc-white);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.tpc-textarea {
    resize: vertical;
    min-height: 80px;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.tpc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    border: none;
    border-radius: var(--tpc-radius-sm);
    font-family: var(--tpc-font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tpc-transition);
    white-space: nowrap;
    text-decoration: none;
}

.tpc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tpc-btn-primary {
    background: var(--tpc-primary);
    color: var(--tpc-white);
}

.tpc-btn-primary:hover:not(:disabled) {
    background: var(--tpc-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 86, 219, 0.3);
}

.tpc-btn-lg {
    padding: 13px 32px;
    font-size: 16px;
}

.tpc-link-btn {
    background: none;
    border: none;
    color: var(--tpc-primary);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    font-family: var(--tpc-font);
    text-decoration: underline;
    transition: var(--tpc-transition);
}

.tpc-link-btn:hover {
    color: var(--tpc-primary-dark);
}

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.tpc-alert {
    padding: 13px 18px;
    border-radius: var(--tpc-radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    animation: tpcFadeIn 0.25s ease;
}

.tpc-alert-error {
    background: var(--tpc-error-bg);
    color: var(--tpc-error);
    border-left: 4px solid var(--tpc-error);
}

.tpc-alert-success {
    background: var(--tpc-success-bg);
    color: var(--tpc-success);
    border-left: 4px solid var(--tpc-success);
}

/* ── Tracking: Summary Cards ────────────────────────────────────────────────── */
.tpc-result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
    padding: 20px;
    background: var(--tpc-primary-light);
    border-radius: var(--tpc-radius-sm);
    animation: tpcFadeIn 0.3s ease;
}

.tpc-result-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tpc-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tpc-primary);
}

.tpc-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--tpc-text);
}

.tpc-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tpc-badge-delivered  { background: #dcfce7; color: #166534; }
.tpc-badge-transit    { background: #dbeafe; color: #1e40af; }
.tpc-badge-out        { background: #fef9c3; color: #713f12; }
.tpc-badge-pending    { background: #f1f5f9; color: #475569; }
.tpc-badge-ndr        { background: #fee2e2; color: #991b1b; }

/* ── Tracking: Timeline ─────────────────────────────────────────────────────── */
.tpc-timeline-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--tpc-text);
}

.tpc-timeline {
    position: relative;
    padding-left: 28px;
}

.tpc-timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--tpc-border);
}

.tpc-timeline-item {
    position: relative;
    margin-bottom: 22px;
    animation: tpcSlideIn 0.3s ease both;
}

.tpc-timeline-item:last-child {
    margin-bottom: 0;
}

.tpc-timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--tpc-border);
    border: 2px solid var(--tpc-white);
    box-shadow: var(--tpc-shadow-sm);
}

.tpc-timeline-item.tpc-item-first .tpc-timeline-dot {
    background: var(--tpc-primary);
    width: 14px;
    height: 14px;
    left: -25px;
    top: 3px;
}

.tpc-timeline-event {
    font-size: 14px;
    font-weight: 600;
    color: var(--tpc-text);
    margin-bottom: 3px;
}

.tpc-timeline-location {
    font-size: 13px;
    color: var(--tpc-text-muted);
    margin-bottom: 2px;
}

.tpc-timeline-date {
    font-size: 12px;
    color: var(--tpc-text-muted);
}

/* ── Booking: Form Layout ───────────────────────────────────────────────────── */
.tpc-fieldset {
    border: 1.5px solid var(--tpc-border);
    border-radius: var(--tpc-radius-sm);
    padding: 20px 20px 16px;
    margin-bottom: 20px;
}

.tpc-legend {
    font-size: 14px;
    font-weight: 700;
    color: var(--tpc-primary);
    padding: 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tpc-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.tpc-full-width {
    grid-column: 1 / -1;
}

.tpc-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tpc-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--tpc-text);
}

.tpc-required {
    color: var(--tpc-error);
}

.tpc-field-hint {
    font-size: 12px;
    color: var(--tpc-text-muted);
    margin: 4px 0 0;
}

/* Pincode serviceability badge */
.tpc-pincode-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tpc-pincode-badge {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.tpc-pincode-ok   { color: var(--tpc-success); }
.tpc-pincode-fail { color: var(--tpc-error); }
.tpc-pincode-load { color: var(--tpc-text-muted); }

/* Dimensions toggle */
.tpc-dims-toggle {
    margin-top: 12px;
}

.tpc-dims-grid {
    grid-template-columns: 1fr 1fr 1fr;
    margin-top: 14px;
}

/* ── Shipping Charge Summary ────────────────────────────────────────────────── */
.tpc-charge-summary {
    margin: 0 0 24px;
    padding: 20px;
    background: #f0fdf4;
    border: 1.5px dashed #22c55e;
    border-radius: var(--tpc-radius-sm);
    animation: tpcFadeIn 0.35s ease;
}

.tpc-charge-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.tpc-charge-icon {
    font-size: 20px;
}

.tpc-charge-label {
    font-size: 13px;
    font-weight: 700;
    color: #166534;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tpc-charge-value {
    font-size: 28px;
    font-weight: 800;
    color: #14532d;
    line-height: 1.2;
}

.tpc-charge-note {
    font-size: 12px;
    color: #15803d;
    margin: 8px 0 0;
    font-style: italic;
    opacity: 0.8;
}

/* ── Form Footer ─────────────────────────────────────────────────────────────── */
.tpc-form-footer {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 8px;
}

.tpc-form-note {
    font-size: 13px;
    color: var(--tpc-text-muted);
    margin: 0;
}

/* ── Product Page Pincode Check ─────────────────────────────────────────────── */
.tpc-product-pincode-check {
    margin: 20px 0;
    padding: 16px;
    background: var(--tpc-bg);
    border: 1px solid var(--tpc-border);
    border-radius: var(--tpc-radius-sm);
    max-width: 350px;
}

.tpc-pincode-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--tpc-text);
}

.tpc-pincode-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tpc-pincode-field {
    max-width: 140px;
    padding: 8px 12px;
    font-size: 14px;
}

/* ── Animations ─────────────────────────────────────────────────────────────── */
@keyframes tpcFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes tpcSlideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .tpc-widget {
        padding: 20px 16px;
    }

    .tpc-search-bar {
        flex-direction: column;
    }

    .tpc-form-grid {
        grid-template-columns: 1fr;
    }

    .tpc-dims-grid {
        grid-template-columns: 1fr;
    }

    .tpc-result-summary {
        grid-template-columns: 1fr 1fr;
    }

    .tpc-form-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
