/* ============================================
   SHIPPING TRACKING PREMIUM - FRONTEND STYLES
   ============================================ */

/* CSS Variables */
:root {
    --stp-primary: #2563eb;
    --stp-primary-dark: #1d4ed8;
    --stp-primary-light: #dbeafe;
    --stp-success: #10b981;
    --stp-success-light: #d1fae5;
    --stp-warning: #f59e0b;
    --stp-danger: #ef4444;
    --stp-text: #1e293b;
    --stp-text-light: #64748b;
    --stp-text-muted: #94a3b8;
    --stp-bg: #f8fafc;
    --stp-card: #ffffff;
    --stp-border: #e2e8f0;
    --stp-border-light: #f1f5f9;
    --stp-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --stp-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --stp-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --stp-shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --stp-radius: 16px;
    --stp-radius-sm: 8px;
    --stp-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container */
.stp-frontend-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--stp-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.stp-frontend-container * {
    box-sizing: border-box;
}

.stp-tracking-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Search Section */
.stp-search-section {
    text-align: center;
    margin-bottom: 40px;
    animation: stpFadeInDown 0.8s ease-out;
}

.stp-search-icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: inline-block;
    animation: stpBounce 2s infinite;
}

.stp-search-title {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--stp-text);
    margin: 0 0 8px;
    letter-spacing: -0.025em;
}

.stp-search-subtitle {
    color: var(--stp-text-light);
    font-size: 1.1rem;
    margin: 0 0 32px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* Search Box */
.stp-search-box {
    display: flex;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
    align-items: stretch;
    flex-wrap: wrap;
}

.stp-input-wrapper {
    flex: 1;
    position: relative;
    min-width: 280px;
}

.stp-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    opacity: 0.5;
    pointer-events: none;
}

.stp-tracking-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 2px solid var(--stp-border);
    border-radius: var(--stp-radius);
    font-size: 16px;
    font-weight: 500;
    color: var(--stp-text);
    background: var(--stp-card);
    transition: var(--stp-transition);
    outline: none;
    letter-spacing: 0.02em;
}

.stp-tracking-input:focus {
    border-color: var(--stp-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.stp-tracking-input::placeholder {
    color: var(--stp-text-muted);
}

.stp-track-button {
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--stp-primary) 0%, var(--stp-primary-dark) 100%);
    color: #fff;
    border: none;
    border-radius: var(--stp-radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--stp-transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.stp-track-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.45);
}

.stp-track-button:active {
    transform: translateY(0);
}

.stp-track-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.stp-spinner {
    width: 20px;
    height: 20px;
    animation: stpSpin 1s linear infinite;
}

/* Result Section */
.stp-result-section {
    animation: stpFadeInUp 0.6s ease-out;
}

/* Tracking Card */
.stp-tracking-card {
    background: var(--stp-card);
    border-radius: var(--stp-radius);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--stp-shadow-lg);
    border: 1px solid var(--stp-border);
}

/* Tracking Header */
.stp-tracking-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--stp-border-light);
}

.stp-serial-group {
    flex: 1;
    min-width: 280px;
}

.stp-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--stp-text-light);
    margin-bottom: 6px;
}

.stp-serial-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stp-serial-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--stp-primary) 0%, var(--stp-primary-dark) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    animation: stpIconPulse 2s infinite;
}

.stp-serial-number {
    font-size: 1.75rem;
    font-weight: 800;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    color: var(--stp-primary);
    letter-spacing: 0.08em;
}

.stp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.9rem;
    border: 2px solid transparent;
}

.stp-status-badge.in-transit {
    background: rgba(37, 99, 235, 0.08);
    color: var(--stp-primary);
    border-color: rgba(37, 99, 235, 0.2);
}

.stp-status-badge.delivered {
    background: rgba(16, 185, 129, 0.08);
    color: var(--stp-success);
    border-color: rgba(16, 185, 129, 0.2);
}

.stp-status-badge.out-delivery {
    background: rgba(245, 158, 11, 0.08);
    color: var(--stp-warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.stp-status-badge.processing {
    background: rgba(100, 116, 139, 0.08);
    color: var(--stp-text-light);
    border-color: rgba(100, 116, 139, 0.2);
}

.stp-status-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: stpPulse 2s infinite;
}

/* Progress Bar Section */
.stp-progress-section {
    margin-bottom: 40px;
}

.stp-progress-bar-container {
    position: relative;
    padding: 24px 0;
}

.stp-progress-track {
    height: 10px;
    background: var(--stp-border-light);
    border-radius: 9999px;
    position: relative;
    overflow: hidden;
}

.stp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--stp-primary) 0%, var(--stp-success) 100%);
    border-radius: 9999px;
    width: 0%;
    position: relative;
    transition: width 2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

.stp-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: stpShimmer 2.5s infinite;
}

.stp-progress-percentage {
    text-align: center;
    margin-top: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--stp-primary);
}

.stp-progress-steps {
    display: flex;
    justify-content: space-between;
    margin-top: 28px;
    position: relative;
}

.stp-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
    position: relative;
    opacity: 0.4;
    transition: var(--stp-transition);
}

.stp-step.active,
.stp-step.completed {
    opacity: 1;
}

.stp-step-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--stp-border-light);
    border: 3px solid var(--stp-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: var(--stp-transition);
    z-index: 2;
}

.stp-step.active .stp-step-icon {
    background: linear-gradient(135deg, var(--stp-primary) 0%, var(--stp-primary-dark) 100%);
    border-color: var(--stp-primary);
    color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.12), 0 4px 15px rgba(37, 99, 235, 0.3);
    animation: stpStepBounce 0.6s ease-out;
}

.stp-step.completed .stp-step-icon {
    background: linear-gradient(135deg, var(--stp-success) 0%, #059669 100%);
    border-color: var(--stp-success);
    color: #fff;
}

.stp-step-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--stp-text-light);
    text-align: center;
    transition: var(--stp-transition);
    white-space: nowrap;
}

.stp-step.active .stp-step-label {
    color: var(--stp-primary);
    font-weight: 700;
}

.stp-step.completed .stp-step-label {
    color: var(--stp-success);
}

/* 3D Map Section */
.stp-map-section {
    margin-bottom: 32px;
    perspective: 1200px;
}

.stp-map-container {
    background: linear-gradient(160deg, #1e293b 0%, #0f172a 50%, #020617 100%);
    border-radius: var(--stp-radius);
    padding: 28px;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    transform: rotateX(8deg);
    box-shadow: 
        0 30px 60px -15px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 0.6s ease;
    min-height: 320px;
}

.stp-map-container:hover {
    transform: rotateX(4deg) rotateY(1deg);
}

.stp-map-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(37, 99, 235, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.06) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.6;
    transform: translateZ(-30px);
    animation: stpGridMove 20s linear infinite;
}

.stp-map-content {
    position: relative;
    z-index: 2;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stp-route-svg {
    width: 100%;
    max-width: 700px;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(37, 99, 235, 0.4));
}

.stp-route-line {
    fill: none;
    stroke: var(--stp-primary);
    stroke-width: 3;
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: stpDrawLine 3s ease-out forwards;
    opacity: 0.7;
}

.stp-route-line-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 3;
}

.stp-location-marker {
    cursor: pointer;
    transition: transform 0.3s;
}

.stp-location-marker:hover {
    transform: scale(1.2);
}

.stp-marker-pulse {
    transform-origin: center;
    animation: stpMarkerPulse 2.5s infinite;
}

.stp-map-info {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
}

.stp-map-location {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    flex: 1;
    min-width: 180px;
}

.stp-map-location strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 4px;
    color: #f8fafc;
}

.stp-map-location span {
    font-size: 0.8rem;
    opacity: 0.7;
}

.stp-map-location.current {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.3);
}

.stp-map-location.current strong {
    color: #60a5fa;
}

/* Details Grid */
.stp-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stp-detail-card {
    background: var(--stp-card);
    border-radius: var(--stp-radius-sm);
    padding: 24px;
    border: 1px solid var(--stp-border);
    box-shadow: var(--stp-shadow-sm);
    transition: var(--stp-transition);
}

.stp-detail-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--stp-shadow);
    border-color: var(--stp-primary-light);
}

.stp-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--stp-border-light);
}

.stp-detail-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--stp-primary-light) 0%, #bfdbfe 100%);
    color: var(--stp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stp-detail-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--stp-text);
    margin: 0;
}

.stp-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--stp-border-light);
    gap: 12px;
}

.stp-detail-row:last-child {
    border-bottom: none;
}

.stp-detail-key {
    color: var(--stp-text-light);
    font-size: 0.85rem;
    font-weight: 500;
    flex-shrink: 0;
}

.stp-detail-value {
    font-weight: 600;
    color: var(--stp-text);
    text-align: right;
    word-break: break-word;
}

/* Timeline */
.stp-timeline-card {
    background: var(--stp-card);
    border-radius: var(--stp-radius);
    padding: 32px;
    border: 1px solid var(--stp-border);
    box-shadow: var(--stp-shadow);
}

.stp-timeline-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--stp-text);
}

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

.stp-timeline-list::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg, var(--stp-border) 0%, var(--stp-primary-light) 100%);
    border-radius: 9999px;
}

.stp-timeline-item {
    position: relative;
    padding-bottom: 28px;
    padding-left: 24px;
    animation: stpSlideIn 0.5s ease-out both;
}

.stp-timeline-item:nth-child(1) { animation-delay: 0.1s; }
.stp-timeline-item:nth-child(2) { animation-delay: 0.2s; }
.stp-timeline-item:nth-child(3) { animation-delay: 0.3s; }
.stp-timeline-item:nth-child(4) { animation-delay: 0.4s; }
.stp-timeline-item:nth-child(5) { animation-delay: 0.5s; }

.stp-timeline-item::before {
    content: '';
    position: absolute;
    left: -28px;
    top: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--stp-border);
    border: 3px solid var(--stp-card);
    box-shadow: 0 0 0 2px var(--stp-border);
    transform: translateX(-7px);
    transition: var(--stp-transition);
}

.stp-timeline-item.completed::before {
    background: var(--stp-success);
    box-shadow: 0 0 0 2px var(--stp-success);
}

.stp-timeline-item.current::before {
    background: var(--stp-primary);
    box-shadow: 0 0 0 2px var(--stp-primary);
    animation: stpPulse 2s infinite;
}

.stp-timeline-date {
    font-size: 0.8rem;
    color: var(--stp-text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stp-timeline-text {
    font-weight: 700;
    color: var(--stp-text);
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.stp-timeline-location {
    font-size: 0.85rem;
    color: var(--stp-text-light);
    display: flex;
    align-items: center;
    gap: 4px;
}

.stp-timeline-note {
    font-size: 0.85rem;
    color: var(--stp-text-muted);
    margin-top: 6px;
    padding: 8px 12px;
    background: var(--stp-bg);
    border-radius: 8px;
    font-style: italic;
}

/* Error State */
.stp-error-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--stp-card);
    border-radius: var(--stp-radius);
    box-shadow: var(--stp-shadow);
    border: 1px solid var(--stp-border);
}

.stp-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.stp-error-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--stp-danger);
    margin-bottom: 8px;
}

.stp-error-text {
    color: var(--stp-text-light);
}

/* Animations */
@keyframes stpFadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes stpPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

@keyframes stpBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes stpIconPulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25); }
    50% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.45); }
}

@keyframes stpStepBounce {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1.15); }
}

@keyframes stpShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes stpDrawLine {
    to { stroke-dashoffset: 0; }
}

@keyframes stpMarkerPulse {
    0%, 100% { r: 6; opacity: 1; }
    50% { r: 12; opacity: 0.4; }
}

@keyframes stpGridMove {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

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

/* Responsive */
@media (max-width: 768px) {
    .stp-search-title { font-size: 1.6rem; }
    .stp-tracking-card { padding: 20px; }
    .stp-search-box { flex-direction: column; }
    .stp-input-wrapper { min-width: 100%; }
    .stp-track-button { width: 100%; justify-content: center; }
    .stp-progress-steps { flex-direction: column; gap: 16px; }
    .stp-step { flex-direction: row; align-items: center; gap: 16px; }
    .stp-step-label { text-align: left; }
    .stp-map-container { transform: none; min-height: 260px; }
    .stp-map-container:hover { transform: none; }
    .stp-details-grid { grid-template-columns: 1fr; }
    .stp-tracking-header { flex-direction: column; }
    .stp-serial-number { font-size: 1.3rem; }
}

/* WordPress Compatibility */
.stp-frontend-container img { max-width: 100%; height: auto; }
.stp-frontend-container * { word-wrap: break-word; }
