/* TTPost Tracker Modern Styles */
:root {
    --primary-color: #0047AB;
    --primary-hover: #003380;
    --success-color: #059669;
    --warning-color: #D97706;
    --error-color: #DC2626;
    --text-primary: #111827;
    --text-secondary: #374151;
    --border-color: #E5E7EB;
    --background-light: #F9FAFB;
    --background-card: #FFFFFF;
    --box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --timeline-line-color: #e5e7eb;
    --timeline-dot-size: 20px;
    --timeline-line-width: 2px;
}

.ttpost-tracker-container {
    max-width: 1100px;
    margin: 3rem auto;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    padding: 0 1.5rem;
    color: var(--text-primary);
}

/* TTPost Logo Styles */
.ttpost-logo {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
}

.ttpost-logo img {
    max-width: 250px;
    height: auto;
    margin: 0 auto;
}

/* Form Styles */
#ttpost-form {
    background: var(--background-card);
    padding: 2.5rem;
    border-radius: 1.25rem;
    box-shadow: var(--box-shadow);
    margin-bottom: 2.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

#ttpost-form:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#ttpost-form label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.input-group {
    display: flex;
    gap: 1.25rem;
    align-items: stretch;
    flex-wrap: wrap;
}

#ttpost_tracking_number {
    flex: 1;
    min-width: 280px;
    padding: 1.25rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 0.875rem;
    font-size: 1.05rem;
    transition: all 0.2s ease;
    background: var(--background-light);
    color: var(--text-primary);
}

#ttpost_tracking_number:focus {
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 71, 171, 0.1);
    outline: none;
}

#ttpost-form input[type="submit"] {
    padding: 1.25rem 2.5rem !important;
    background: var(--primary-color) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 0.875rem !important;
    font-weight: 600 !important;
    font-size: 1.05rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-width: 180px !important;
    letter-spacing: 0.025em !important;
}

#ttpost-form input[type="submit"]:hover {
    background: var(--primary-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 71, 171, 0.2);
}

/* Loader Styles */
#ttpost-loader {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 9999;
}

#ttpost-loader .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2.5rem 4rem;
    border-radius: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--text-primary);
    animation: fadeIn 0.3s ease;
}

.spinner::before {
    content: "";
    width: 28px;
    height: 28px;
    border: 3px solid #E5E7EB;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite, loadingPulse 2s infinite;
}

/* Results Container Styles */
.ttpost-results-container {
    background: var(--background-card);
    border-radius: 1.25rem;
    box-shadow: var(--box-shadow);
    overflow: hidden;
    margin-top: 2.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.5s ease;
}

.ttpost-results-container h4 {
    margin: 0 !important;
    padding: 1.75rem 2rem !important;
    background: var(--background-light) !important;
    font-size: 1.35rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    letter-spacing: -0.025em !important;
}

.ttpost-results-container h3 {
    margin: 0 !important;
    padding: 1.5rem 2rem !important;
    background: white !important;
    font-size: 1.15rem !important;
    font-weight: 500 !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ttpost-results-container h3:hover {
    background: var(--background-light) !important;
}

.ttpost-results-container h3 i {
    transition: transform 0.3s ease;
    color: var(--primary-color);
}

.ttpost-results-container h3.active i {
    transform: rotate(180deg);
}

/* Table Styles */
.ttpost-results-container table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 0 !important;
    font-family: system-ui, -apple-system, sans-serif !important;
}

.ttpost-results-container td,
.ttpost-results-container tr td {
    padding: 1rem 1.5rem !important;
    font-size: 0.925rem !important;
    color: var(--text-secondary) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    line-height: 1.6 !important;
    transition: background-color 0.2s ease !important;
}

/* Header row styles */
.ttpost-results-container tr[style*="font-weight:bold"] td {
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    background-color: var(--background-light) !important;
    text-transform: uppercase !important;
    font-size: 0.8rem !important;
    letter-spacing: 0.05em !important;
}

/* Date header row styles */
.ttpost-results-container td[style*="font-size:10pt;font-weight:bold;"] {
    background-color: #f8f9fa !important;
    color: var(--text-primary) !important;
    font-size: 0.9rem !important;
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
}

/* Delivery status styles */
.ttpost-results-container td:contains("Delivered") {
    color: #10b981 !important;
    font-weight: 600 !important;
}

/* Zebra striping for rows */
.ttpost-results-container tr:nth-child(even) td {
    background-color: #fafbfc !important;
}

.ttpost-results-container tr:hover td {
    background-color: #f1f5f9 !important;
}

/* Item Details section */
.ttpost-results-container td[style*="font-size:13px;font-weight:bold;"],
.ttpost-results-container td[style*="font-size:14px;font-weight:bold;"] {
    font-size: 1.1rem !important;
    color: var(--text-primary) !important;
    padding-top: 1.5rem !important;
    padding-bottom: 1rem !important;
    border-bottom: 2px solid var(--border-color) !important;
}

/* Signature info styles */
.ttpost-results-container td b {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
}

/* Enhanced Interactive Timeline Styles */
.tracking-timeline {
    position: relative;
    padding: 2rem;
    background: #fff;
}

.timeline-event {
    position: relative;
    padding-left: 3rem;
    padding-bottom: 2.5rem;
    border-left: 2px solid var(--timeline-line-color);
    transition: transform 0.3s ease;
}

.timeline-event:hover {
    transform: translateX(10px);
}

.timeline-event:last-child {
    border-left: 2px solid transparent;
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -11px;
    top: 0;
    width: var(--timeline-dot-size);
    height: var(--timeline-dot-size);
    border-radius: 50%;
    background: var(--primary-color);
    border: 4px solid #fff;
    box-shadow: 0 0 0 2px var(--primary-color);
    transition: all 0.3s ease;
}

.timeline-event:hover .timeline-dot {
    transform: scale(1.2);
    box-shadow: 0 0 0 3px var(--primary-color), 0 0 20px rgba(0, 71, 171, 0.3);
}

.timeline-event.completed:hover .timeline-dot {
    box-shadow: 0 0 0 3px var(--success-color), 0 0 20px rgba(16, 185, 129, 0.3);
}

.timeline-event.active:hover .timeline-dot {
    box-shadow: 0 0 0 3px var(--warning-color), 0 0 20px rgba(217, 119, 6, 0.3);
}

.timeline-content {
    background: var(--background-light);
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.timeline-event:hover .timeline-content {
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.timeline-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.timeline-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.timeline-location {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-location svg {
    color: var(--primary-color);
    flex-shrink: 0;
    margin-top: 2px;
}

.package-status svg {
    flex-shrink: 0;
}

/* First and Last Timeline Dot Styles */
.timeline-event:first-child .timeline-dot {
    background: var(--warning-color);
    box-shadow: 0 0 0 2px var(--warning-color);
}

.timeline-event:first-child:hover .timeline-dot {
    box-shadow: 0 0 0 3px var(--warning-color), 0 0 20px rgba(217, 119, 6, 0.3);
}

/* Timeline Dot Styles - Reset last dot default color */
.timeline-event:last-child .timeline-dot {
    background: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.timeline-event:last-child:hover .timeline-dot {
    box-shadow: 0 0 0 3px var(--primary-color), 0 0 20px rgba(0, 71, 171, 0.3);
}

/* Apply green color only when completed class is present */
.timeline-event.completed .timeline-dot {
    background: var(--success-color);
    box-shadow: 0 0 0 2px var(--success-color);
}

.timeline-event.completed:hover .timeline-dot {
    box-shadow: 0 0 0 3px var(--success-color), 0 0 20px rgba(16, 185, 129, 0.3);
}

/* Package Info Card */
.package-info-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
}

.package-info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.package-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.package-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.package-status:hover {
    transform: scale(1.05);
}

.package-status.delivered {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.package-status.delivered:hover {
    background: rgba(16, 185, 129, 0.2);
}

.package-status.in-transit {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning-color);
}

.package-status.in-transit:hover {
    background: rgba(217, 119, 6, 0.2);
}

.package-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.info-item:hover {
    background: var(--background-light);
    transform: translateY(-2px);
}

.info-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Responsive styles */
@media (max-width: 768px) {
    .ttpost-results-container td,
    .ttpost-results-container tr td {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    .ttpost-results-container td[colspan="4"] {
        padding-left: 1rem !important;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ttpost-tracker-container {
        margin: 1.5rem auto;
        padding: 0 1rem;
    }

    #ttpost-form {
        padding: 1.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    #ttpost-form input[type="submit"] {
        width: 100% !important;
    }

    .ttpost-results-container td,
    .ttpost-results-container tr td {
        padding: 1rem 1.25rem !important;
        font-size: 0.95rem !important;
    }

    .tracking-timeline {
        padding: 1rem;
    }

    .timeline-event {
        padding-left: 2rem;
        padding-bottom: 2rem;
    }

    .package-info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    #ttpost-loader .spinner {
        padding: 1.5rem;
        font-size: 1rem;
        width: 80%;
        max-width: 300px;
        text-align: center;
        justify-content: center;
    }

    #ttpost-loader .spinner::before {
        width: 24px;
        height: 24px;
        border-width: 2px;
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Pulsing animation for active tracking */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(217, 119, 6, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(217, 119, 6, 0);
    }
}

.timeline-event.active .timeline-dot {
    animation: pulse 2s infinite;
}

/* Enhanced Loading Animation */
@keyframes loadingPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 71, 171, 0.3);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 15px rgba(0, 71, 171, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 71, 171, 0);
    }
}

/* Print Styles */
@media print {
    .ttpost-tracker-container {
        margin: 0;
        padding: 0;
    }

    #ttpost-form,
    #ttpost-loader {
        display: none !important;
    }

    .ttpost-results-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}