/**
 * Tracking Search System - DHL Style Design
 * Version: 4.0.0 - Professional Logistics Theme
 * Color Theme: Navy Blue (#003366) + DHL Orange (#FF6600)
 * Modern, Clean, Easy to View
 */

 
:root {
    /* DHL-inspired Color Palette */
    --dhl-navy: #003366;
    --dhl-navy-dark: #002447;
    --dhl-navy-light: #004080;
    --dhl-orange: #FF6600;
    --dhl-orange-dark: #E65C00;
    --dhl-orange-light: #FF7F33;
    --dhl-yellow: #FFCC00;

    /* Grayscale */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Status Colors */
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 51, 102, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 51, 102, 0.1), 0 2px 4px -1px rgba(0, 51, 102, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 51, 102, 0.1), 0 4px 6px -2px rgba(0, 51, 102, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 51, 102, 0.1), 0 10px 10px -5px rgba(0, 51, 102, 0.04);
}

* {
    box-sizing: border-box;
}

/* ========== CONTAINER ========== */

.ts-modern-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ========== HERO HEADER ========== */

.ts-hero-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--dhl-navy) 0%, var(--dhl-navy-light) 100%);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.ts-hero-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: var(--dhl-orange);
    opacity: 0.1;
    border-radius: 50%;
}

.ts-hero-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 200px;
    height: 200px;
    background: var(--dhl-yellow);
    opacity: 0.08;
    border-radius: 50%;
}

.ts-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--dhl-orange) 0%, var(--dhl-orange-dark) 100%);
    border-radius: 50%;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 16px rgba(255, 102, 0, 0.3);
    position: relative;
    z-index: 1;
}

.ts-hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.ts-hero-subtitle {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* ========== SEARCH BOX ========== */

.ts-search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto 1rem;
}

.ts-search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    stroke: var(--dhl-navy);
    z-index: 1;
}

#tracking-search {
    width: 100%;
    padding: 1rem 3.5rem 1rem 3.5rem;
    font-size: 1.125rem;
    border: 3px solid var(--gray-200);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    background: white;
    font-weight: 500;
    color: var(--gray-900);
}

#tracking-search:focus {
    border-color: var(--dhl-orange);
    box-shadow: 0 0 0 4px rgba(255, 102, 0, 0.1);
}

#tracking-search::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

#clear-search {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gray-200);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--gray-600);
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
}

#clear-search:hover {
    background: var(--dhl-orange);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

/* ========== VERSION TAG ========== */

.ts-version {
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 600;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ts-version-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    background: linear-gradient(135deg, var(--dhl-navy) 0%, var(--dhl-navy-light) 100%);
    color: white;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

/* ========== TRACKING RESULTS ========== */

#tracking-result {
    margin-top: 2rem;
}

.ts-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--gray-100);
    transition: all 0.3s ease;
}

.ts-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

/* ========== CARD HEADER ========== */

.ts-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--dhl-navy) 0%, var(--dhl-navy-dark) 100%);
    border-bottom: 4px solid var(--dhl-orange);
}

.ts-tracking-no {
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
    letter-spacing: 0.02em;
    font-family: 'Courier New', monospace;
}

.ts-status-badge {
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    box-shadow: var(--shadow-md);
}

.ts-status-badge.status-success {
    background: var(--success);
    color: white;
}

.ts-status-badge.status-pending {
    background: var(--dhl-yellow);
    color: var(--gray-900);
}

.ts-status-badge.status-processing {
    background: var(--dhl-orange);
    color: white;
}

.ts-status-badge.status-error {
    background: var(--error);
    color: white;
}

/* ========== CARD BODY ========== */

.ts-card-body {
    padding: 1.5rem;
}

.ts-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 0;
}

.ts-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    border-radius: 12px;
    border: 2px solid var(--gray-100);
    transition: all 0.3s ease;
}

.ts-info-item:hover {
    border-color: var(--dhl-orange);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ts-info-label {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ts-info-label svg {
    stroke: var(--dhl-navy);
    flex-shrink: 0;
}

.ts-info-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.4;
}

/* ========== DELIVERY IMAGES ========== */

.ts-delivery-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--gray-100);
}

.ts-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dhl-navy);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ts-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.image-thumb-container {
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 3px solid var(--gray-200);
}

.image-thumb-container:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
    border-color: var(--dhl-orange);
}

.delivery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ========== GPS INFO ========== */

.gps-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #FFF5EB 0%, white 100%);
    border-radius: 12px;
    border: 2px solid var(--dhl-orange);
    margin-top: 1rem;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.1);
}

.gps-coordinates {
    font-family: 'Courier New', monospace;
    font-size: 0.9375rem;
    color: var(--gray-800);
    font-weight: 700;
    flex: 1;
}

.gps-map-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, var(--dhl-orange) 0%, var(--dhl-orange-dark) 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    transition: all 0.3s;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
}

.gps-map-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(255, 102, 0, 0.4);
}

.gps-map-link svg {
    flex-shrink: 0;
}

/* ========== CARD FOOTER ========== */

.tracking-card-footer {
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

/* ========== TOGGLE SECTIONS ========== */

.toggle-section {
    background: white;
    border: 2px solid var(--gray-200);
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-section:hover {
    background: var(--dhl-navy);
    color: white;
    border-color: var(--dhl-navy);
}

.toggle-section.active {
    background: var(--dhl-orange);
    color: white;
    border-color: var(--dhl-orange);
}

.toggle-icon {
    font-size: 1.25rem;
    line-height: 1;
    font-weight: 700;
}

.section-content {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 2px solid var(--gray-200);
}

.section-content.hidden {
    display: none;
}

/* ========== HISTORY TIMELINE ========== */

.history-timeline,
.resend-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item,
.resend-item {
    padding: 0.875rem;
    background: var(--gray-50);
    border-radius: 8px;
    border-left: 4px solid var(--dhl-orange);
}

.history-date,
.resend-date {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.history-text {
    font-size: 0.875rem;
    color: var(--gray-900);
}

.resend-number {
    font-weight: 700;
    color: var(--dhl-navy);
}

/* ========== TRANSFER BUTTON ========== */

.ts-transfer-btn {
    background: linear-gradient(135deg, var(--dhl-orange) 0%, var(--dhl-orange-dark) 100%);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-left: auto;
}

.ts-transfer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(255, 102, 0, 0.4);
}

.ts-transfer-btn:active {
    transform: translateY(0);
}

.ts-transfer-btn svg {
    flex-shrink: 0;
}

/* ========== TRANSFER MODAL ========== */

.ts-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 51, 102, 0.75);
    backdrop-filter: blur(4px);
    z-index: 99998;
}

.ts-modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    z-index: 99999;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.ts-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--gray-100);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--gray-600);
    z-index: 1;
}

.ts-modal-close:hover {
    background: var(--dhl-orange);
    color: white;
    transform: rotate(90deg);
}

/* ========== USER LIST ========== */

#transfer-users-list {
    scrollbar-width: thin;
    scrollbar-color: var(--dhl-orange) var(--gray-100);
}

#transfer-users-list::-webkit-scrollbar {
    width: 8px;
}

#transfer-users-list::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

#transfer-users-list::-webkit-scrollbar-thumb {
    background: var(--dhl-orange);
    border-radius: 4px;
}

#transfer-users-list::-webkit-scrollbar-thumb:hover {
    background: var(--dhl-orange-dark);
}

.ts-user-item {
    transition: all 0.2s;
}

.ts-user-item:hover {
    background: var(--gray-50) !important;
}

.ts-user-item:last-child {
    border-bottom: none !important;
}

/* ========== IMAGE MODAL ========== */

#imageModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    background: rgba(0, 51, 102, 0.95);
    backdrop-filter: blur(8px);
}

#imageModal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

#imageModal .ts-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    padding: 1rem;
    border-radius: 16px;
}

#fullSizeImage {
    max-width: 100%;
    max-height: calc(90vh - 150px);
    display: block;
    border-radius: 8px;
}

#imageGpsInfo {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 8px;
}

/* ========== EMPTY STATE ========== */

.tracking-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-400);
}

.tracking-empty svg {
    margin-bottom: 1rem;
}

.tracking-empty p {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-500);
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .ts-modern-container {
        padding: 1rem 0.75rem;
    }

    .ts-hero-header {
        padding: 1.5rem 1rem;
        margin-bottom: 2rem;
    }

    .ts-icon-badge {
        width: 64px;
        height: 64px;
        margin-bottom: 1rem;
    }

    .ts-hero-title {
        font-size: 1.75rem;
    }

    .ts-hero-subtitle {
        font-size: 0.9375rem;
    }

    #tracking-search {
        font-size: 1rem;
        padding: 0.875rem 3rem 0.875rem 3rem;
    }

    .ts-card {
        margin-bottom: 1rem;
    }

    .ts-card-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
        padding: 1rem;
    }

    .ts-card-body {
        padding: 1rem;
    }

    .ts-tracking-no {
        font-size: 1.25rem;
    }

    .ts-status-badge {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
        align-self: flex-start;
    }

    .ts-info-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .ts-info-item {
        padding: 0.875rem;
    }

    .ts-info-label {
        font-size: 0.75rem;
    }

    .ts-info-value {
        font-size: 1rem;
    }

    .ts-section-title {
        font-size: 0.8125rem;
    }

    .ts-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.75rem;
    }

    .gps-info {
        flex-wrap: wrap;
        padding: 1rem;
        gap: 0.75rem;
    }

    .gps-coordinates {
        font-size: 0.8125rem;
        flex-basis: 100%;
    }

    .gps-map-link {
        flex-basis: 100%;
        justify-content: center;
        padding: 0.75rem;
    }

    .tracking-card-footer {
        flex-direction: column;
        align-items: stretch;
        padding: 0.875rem 1rem;
        gap: 0.5rem;
    }

    .toggle-section {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
        width: 100%;
    }

    .ts-transfer-btn {
        margin-left: 0;
        justify-content: center;
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }

    .ts-modal-content {
        max-width: 95% !important;
    }
}

/* ========== TABLET RESPONSIVE ========== */

@media (min-width: 769px) and (max-width: 1024px) {
    .ts-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ts-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

/* ========== ANIMATIONS ========== */

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

.ts-card {
    animation: fadeIn 0.3s ease;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ========== LOADING STATE ========== */

.ts-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ========== PERFORMANCE OPTIMIZATIONS ========== */

/* GPU acceleration for animations */
.ts-card,
.ts-transfer-btn,
.ts-info-item,
.toggle-section,
.image-thumb-container,
.gps-map-link {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Lazy load images */
.delivery-thumb {
    content-visibility: auto;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Accessibility - High contrast mode */
@media (prefers-contrast: high) {
    .ts-card {
        border-width: 3px;
    }

    .ts-info-item {
        border-width: 3px;
    }
}

/* Print styles */
@media print {
    .ts-hero-header,
    .ts-search-box,
    .ts-version,
    .ts-transfer-btn,
    .toggle-section,
    #clear-search {
        display: none !important;
    }

    .ts-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }

    .ts-card-header {
        background: var(--dhl-navy) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
