/**
 * Karma Tracking Pro - Modern Persian E-Commerce Tracking Styles
 * Inspired by Digikala, Tipax, and modern Iranian UI designs.
 */

.ktp-tracking-wrapper {
    width: 100%;
    max-width: 860px;
    margin: 32px auto;
    font-family: inherit;
    box-sizing: border-box;
    color: #1e293b;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

.ktp-tracking-wrapper * {
    box-sizing: border-box;
}

/* =========================================
   1. Hero Search Card
   ========================================= */
.ktp-hero-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.04), 0 8px 10px -6px rgba(15, 23, 42, 0.02);
    text-align: center;
    position: relative;
    overflow: hidden;
}

@media (max-width: 640px) {
    .ktp-hero-card {
        padding: 24px 16px;
        border-radius: 16px;
    }
}

.ktp-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 16px;
}

.ktp-hero-title {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 10px 0;
    letter-spacing: -0.3px;
}

@media (max-width: 640px) {
    .ktp-hero-title {
        font-size: 20px;
    }
}

.ktp-hero-desc {
    font-size: 14px;
    color: #64748b;
    margin: 0 auto 28px auto;
    max-width: 580px;
    line-height: 1.7;
}

/* Search Box & Input */
.ktp-search-box {
    max-width: 680px;
    margin: 0 auto;
}

/* User Logged-in Notice */
.ktp-user-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 20px;
    text-align: right;
    font-size: 13px;
    color: #166534;
}

.ktp-user-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #16a34a;
    flex-shrink: 0;
}

.ktp-user-badge-text strong {
    color: #14532d;
}

.ktp-user-sub {
    display: block;
    font-size: 11px;
    color: #15803d;
    margin-top: 2px;
}

/* Dual Inputs Grid */
.ktp-dual-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
    text-align: right;
}

@media (max-width: 640px) {
    .ktp-dual-inputs {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

.ktp-field-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ktp-field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.ktp-field-label svg {
    color: #0284c7;
}

.ktp-required {
    color: #ef4444;
    font-weight: 800;
}

.ktp-input-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    padding: 2px 8px;
    transition: all 0.2s ease;
}

.ktp-input-box:focus-within {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.ktp-input-prefilled {
    background: #f0fdf4;
    border-color: #86efac;
}

.ktp-text-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px 8px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 600;
    color: #0f172a;
    direction: ltr;
    text-align: right;
}

.ktp-text-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.ktp-verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: #22c55e;
    color: #ffffff;
    flex-shrink: 0;
    margin-right: 4px;
}

/* Action Row & Button */
.ktp-action-row {
    margin-bottom: 16px;
}

.ktp-search-btn-large {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.ktp-search-btn-large:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.4);
}

.ktp-search-btn-large:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Privacy Notice */
.ktp-privacy-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
    text-align: center;
}

.ktp-privacy-notice svg {
    color: #0284c7;
    flex-shrink: 0;
}

.ktp-privacy-notice strong {
    color: #334155;
}

.ktp-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    padding: 6px 8px 6px 6px;
    transition: all 0.25s ease;
}

.ktp-input-wrapper:focus-within {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.12);
}

.ktp-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px 0 6px;
    color: #94a3b8;
}

.ktp-search-input {
    flex: 1 1 0;
    border: none;
    outline: none;
    background: transparent;
    padding: 12px 8px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 600;
    color: #0f172a;
    direction: rtl;
    text-align: right;
}

.ktp-search-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.ktp-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.ktp-search-btn:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
}

.ktp-search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 580px) {
    .ktp-input-wrapper {
        flex-direction: column;
        padding: 10px;
        border-radius: 14px;
    }
    .ktp-search-input {
        width: 100%;
        padding: 8px 6px;
    }
    .ktp-search-btn {
        width: 100%;
        margin-top: 8px;
        padding: 12px;
    }
}

.ktp-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: ktp-spin 0.8s linear infinite;
}

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

.ktp-search-tips {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 0 8px;
    font-size: 12px;
    color: #64748b;
    flex-wrap: wrap;
    gap: 8px;
}

.ktp-tip-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Feedback Notice */
.ktp-feedback {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    animation: ktp-fadeIn 0.3s ease;
}

.ktp-feedback-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.ktp-feedback-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

@keyframes ktp-fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   2. Live Result Card
   ========================================= */
.ktp-result-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 28px 32px;
    margin-top: 28px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.04);
    animation: ktp-slideUp 0.35s ease;
}

@media (max-width: 640px) {
    .ktp-result-card {
        padding: 20px 16px;
        border-radius: 16px;
    }
}

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

.ktp-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 16px;
}

.ktp-result-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ktp-order-icon-box {
    width: 48px;
    height: 48px;
    background: #f0f9ff;
    color: #0284c7;
    border: 1px solid #bae6fd;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ktp-res-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    display: block;
    margin-bottom: 2px;
}

.ktp-res-order-no {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}

/* Status Pill */
.ktp-status-pill {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 800;
    background: #f1f5f9;
    color: #475569;
}

.ktp-pill-completed {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.ktp-pill-processing {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.ktp-pill-shipping {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.ktp-pill-pending {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.ktp-pill-cancelled {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* =========================================
   3. Digikala-Style Stepper
   ========================================= */
.ktp-stepper-box {
    margin: 32px 0;
    overflow-x: auto;
    padding-bottom: 10px;
}

.ktp-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 600px;
    position: relative;
}

.ktp-stepper-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    z-index: 2;
}

.ktp-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8fafc;
    color: #94a3b8;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.ktp-step-check {
    display: none;
}

.ktp-step-title {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-align: center;
    max-width: 95px;
    transition: color 0.3s ease;
}

.ktp-stepper-bar {
    flex: 1 1 0;
    height: 4px;
    background: #e2e8f0;
    margin: 0 8px 24px 8px;
    border-radius: 2px;
    transition: background-color 0.35s ease;
    z-index: 1;
}

/* Completed Step */
.ktp-stepper-item.completed .ktp-step-circle {
    background: #0284c7;
    border-color: #0284c7;
    color: #ffffff;
}

.ktp-stepper-item.completed .ktp-step-num {
    display: none;
}

.ktp-stepper-item.completed .ktp-step-check {
    display: block;
}

.ktp-stepper-item.completed .ktp-step-title {
    color: #0f172a;
    font-weight: 700;
}

/* Active Current Step */
.ktp-stepper-item.active .ktp-step-circle {
    background: #ffffff;
    border-color: #0284c7;
    color: #0284c7;
    box-shadow: 0 0 0 5px rgba(2, 132, 199, 0.2);
}

.ktp-stepper-item.active .ktp-step-title {
    color: #0284c7;
    font-weight: 800;
}

/* Active Bar */
.ktp-stepper-bar.active {
    background: #0284c7;
}

/* =========================================
   4. Tracking Code Hero Banner
   ========================================= */
.ktp-tracking-banner {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1.5px solid #bae6fd;
    border-radius: 16px;
    padding: 22px 24px;
    margin-bottom: 28px;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08);
}

@media (max-width: 640px) {
    .ktp-tracking-banner {
        padding: 16px;
    }
}

.ktp-carrier-badge-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ktp-carrier-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #0284c7;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    border-radius: 9999px;
}

.ktp-carrier-desc {
    font-size: 13px;
    color: #475569;
    font-weight: 600;
}

.ktp-code-action-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    flex-wrap: wrap;
    gap: 14px;
}

.ktp-code-display-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ktp-code-caption {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.ktp-code-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    padding: 4px 6px 4px 10px;
    border-radius: 8px;
}

.ktp-code-pill code {
    font-family: monospace;
    font-size: 15px;
    font-weight: 800;
    color: #0369a1;
    letter-spacing: 0.5px;
}

.ktp-btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ktp-btn-copy:hover {
    background: #bae6fd;
}

.ktp-btn-copy.ktp-copied {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

.ktp-btn-direct-track {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #0284c7;
    color: #ffffff !important;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.2);
}

.ktp-btn-direct-track:hover {
    background: #0369a1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

/* =========================================
   5. Order Details Grid
   ========================================= */
.ktp-summary-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px 24px;
}

.ktp-summary-heading {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.ktp-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .ktp-summary-grid {
        grid-template-columns: 1fr;
    }
}

.ktp-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
}

.ktp-summary-full {
    grid-column: 1 / -1;
}

.ktp-sum-label {
    color: #64748b;
    font-weight: 500;
}

.ktp-sum-val {
    color: #0f172a;
    font-weight: 700;
}

/* =========================================
   6. Direct Portals Card
   ========================================= */
.ktp-portals-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px 28px;
    margin-top: 24px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
}

@media (max-width: 640px) {
    .ktp-portals-card {
        padding: 18px 16px;
        border-radius: 16px;
    }
}

.ktp-portals-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    color: #0284c7;
}

.ktp-portals-header h3 {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}

.ktp-portals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.ktp-portal-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.ktp-portal-box:hover {
    border-color: #0284c7;
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.1);
}

.ktp-portal-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ktp-portal-post {
    background: #e0f2fe;
    color: #0284c7;
}

.ktp-portal-tipax {
    background: #ffedd5;
    color: #ea580c;
}

.ktp-portal-chapar {
    background: #dcfce7;
    color: #16a34a;
}

.ktp-portal-title {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
}

.ktp-portal-domain {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #0284c7;
    direction: ltr;
    margin-top: 2px;
}
