/*
 * ===================================================================
 * PROFESSIONAL WPCARGO STYLES V3 (June 2025)
 * By Gemini
 *
 * Features:
 * - Embedded SVG icons (from the PHP file)
 * - CSS Variables for easy theme customization.
 * - Clean, high-contrast, professional design.
 * - Improved information hierarchy with labels.
 * - Subtle, professional animations.
 * ===================================================================
 */

/* --- 1. CSS VARIABLES: CUSTOMIZE COLORS HERE --- */
.wpc-details-container-v3 {
    --wpc-bg-color: #f4f7fc;         /* Light grey background for the whole section */
    --wpc-card-bg-color: #ffffff;    /* Card background */
    --wpc-primary-color: #3b5998;     /* A deep, trustworthy blue */
    --wpc-accent-color: #8b9dc3;      /* A softer, complementary blue */
    --wpc-text-color: #1d2129;       /* Dark text for readability */
    --wpc-label-color: #606770;      /* Lighter text for labels */
    --wpc-border-color: #dfe3ee;      /* Subtle border color */
    --wpc-shadow-color: rgba(0, 0, 0, 0.08);
    --wpc-card-radius: 8px;
    --wpc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- 2. MAIN CONTAINER --- */
.wpc-details-container-v3 {
    font-family: var(--wpc-font);
    background-color: var(--wpc-bg-color);
    padding: 30px 15px; /* Add some breathing room */
    margin-top: 20px;
    border-radius: var(--wpc-card-radius);
}

/* --- 3. THE CARD --- */
.wpc-detail-card {
    background: var(--wpc-card-bg-color);
    border: 1px solid var(--wpc-border-color);
    border-radius: var(--wpc-card-radius);
    box-shadow: 0 4px 12px var(--wpc-shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%; /* Makes cards in the same row equal height */
}

.wpc-detail-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* --- 4. CARD HEADER --- */
.wpc-card-header {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--wpc-border-color);
}

.wpc-header-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--wpc-primary-color);
    margin: 0 0 0 15px; /* Space between icon and title */
}

/* --- 5. CARD BODY & INFO ROWS --- */
.wpc-card-body {
    padding: 10px 20px 20px 20px;
}

.wpc-info-row {
    display: flex;
    align-items: flex-start; /* Aligns icon to the top of content */
    padding: 15px 0;
    border-bottom: 1px solid #f0f2f5; /* Very subtle internal separator */
}

.wpc-info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.wpc-info-content {
    display: flex;
    flex-direction: column;
    margin-left: 18px;
}

.wpc-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--wpc-label-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.wpc-data {
    font-size: 1rem;
    color: var(--wpc-text-color);
    line-height: 1.5;
}

.wpc-data a {
    color: var(--wpc-primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.wpc-data a:hover {
    color: var(--wpc-text-color);
    text-decoration: underline;
}

/* --- 6. ICON STYLING (For the Embedded SVGs) --- */
.wpc-icon {
    width: 28px;
    height: 28px;
    color: var(--wpc-accent-color);
    flex-shrink: 0; /* Prevents icons from shrinking */
}

.wpc-card-header .wpc-icon {
    width: 32px;
    height: 32px;
    color: var(--wpc-primary-color);
}


/* --- 7. RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 767.98px) {
    /* Stack cards on mobile and add space between them */
    .wpc-details-container-v3 .wpcargo-col-md-6:not(:last-child) .wpc-detail-card {
        margin-bottom: 30px;
    }
}

/*
 * ===================================================================
 * V3.1 - RESPONSIVE REFINEMENTS FOR MOBILE (June 2025)
 * Fixes the cramped layout on mobile devices.
 * ===================================================================
 */

@media (max-width: 576px) {

    /* Make the overall container padding a bit tighter on mobile */
    .wpc-details-container-v3 {
        padding: 20px 10px;
    }

    /* Adjust card header for a more compact look */
    .wpc-card-header {
        padding: 15px;
    }
    
    .wpc-header-title {
        font-size: 1.1rem;
    }

    .wpc-card-body {
        padding: 10px 15px 15px 15px;
    }
    
    /* Make the icon and content alignment more flexible */
    .wpc-info-row {
        align-items: center; /* Vertically centers the icon with the content */
    }

    .wpc-info-content {
        margin-left: 15px;
    }

    /*
     * THE KEY FIX: This allows long, unbroken text (like email addresses or
     * tracking numbers) to wrap properly instead of overflowing the card.
     */
    .wpc-data {
        word-break: break-all;
        overflow-wrap: break-word;
    }

    /* Slightly reduce icon size on mobile */
    .wpc-icon {
        width: 24px;
        height: 24px;
    }
    
    .wpc-card-header .wpc-icon {
        width: 28px;
        height: 28px;
    }
}

/*
 * ===================================================================
 * V3.2 - FIX: ADD GAP BETWEEN CARDS ON MOBILE (June 2025)
 * ===================================================================
 */

@media (max-width: 767px) {
    /*
     * This rule targets the container of each card when in mobile view.
     * We add a margin to the bottom to create a gap before the next
     * card stacks below it.
    */
    .wpc-details-container-v3 .wpcargo-col-md-6 {
        margin-bottom: 25px;
    }

    /* This removes the bottom margin from the very last card to
       prevent extra, unnecessary space at the end of the list. */
    .wpc-details-container-v3 .wpcargo-col-md-6:last-child {
        margin-bottom: 0;
    }
}


/*
 * ===================================================================
 * V3.3 - PROFESSIONAL SHIPMENT INFORMATION STYLES (June 2025)
 * ===================================================================
 */

/* --- 1. Main Details Container --- */
.wpc-shipment-details-v3 {
    background: var(--wpc-card-bg-color, #ffffff);
    border: 1px solid var(--wpc-border-color, #dfe3ee);
    border-radius: var(--wpc-card-radius, 8px);
    box-shadow: 0 4px 12px var(--wpc-shadow-color, rgba(0, 0, 0, 0.08));
    margin-top: 30px;
    overflow: hidden; /* Important for the status badge */
}

/* --- 2. Status Badge --- */
.wpc-status-badge {
    padding: 12px 20px;
    background-color: #6c757d; /* Default grey color */
    color: #ffffff;
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Add custom colors for different statuses here */
.wpc-status-badge.on-hold { background-color: #ffc107; color: #1d2129; }
.wpc-status-badge.in-transit { background-color: #17a2b8; }
.wpc-status-badge.delivered { background-color: #28a745; }
.wpc-status-badge.pending { background-color: #6c757d; }
/* Add more statuses as needed by copying the class name */


/* --- 3. Main Body & Groups --- */
.wpc-details-body {
    padding: 10px 25px 25px 25px;
}

.wpc-info-group {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--wpc-border-color, #dfe3ee);
}

.wpc-info-group:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.wpc-group-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--wpc-primary-color, #3b5998);
    margin-top: 0;
    margin-bottom: 20px;
}

/* --- 4. Responsive Grid for Details --- */
.wpc-details-grid {
    display: grid;
    /* This creates a responsive grid that automatically adjusts columns */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

/* --- 5. Individual Detail Items --- */
.wpc-detail-item {
    display: flex;
    flex-direction: column;
}

.wpc-detail-item.wpc-full-width {
    grid-column: 1 / -1; /* Makes the item span all columns */
}

/* Use the same label/data styles for consistency */
.wpc-detail-item .wpc-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--wpc-label-color, #606770);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.wpc-detail-item .wpc-data {
    font-size: 1rem;
    color: var(--wpc-text-color, #1d2129);
    line-height: 1.5;
}


/*
 * ===================================================================
 * V3.5 - PROFESSIONAL VERTICAL TIMELINE STYLES (June 2025)
 * ===================================================================
 */

/* --- 1. Main Timeline Container --- */
.wpc-timeline-container {
    font-family: var(--wpc-font, sans-serif);
    background: var(--wpc-card-bg-color, #ffffff);
    border: 1px solid var(--wpc-border-color, #dfe3ee);
    border-radius: var(--wpc-card-radius, 8px);
    box-shadow: 0 4px 12px var(--wpc-shadow-color, rgba(0, 0, 0, 0.08));
    margin-top: 30px;
    padding: 25px;
}

/* Use the same title style */
.wpc-timeline-container .wpc-group-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--wpc-primary-color, #3b5998);
    margin-top: 0;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--wpc-border-color, #dfe3ee);
}

.wpc-timeline-container .wpc-empty-data {
    text-align: center;
    padding: 20px;
    color: #888;
}

/* --- 2. The Timeline Structure --- */
.wpc-timeline {
    position: relative;
    padding-left: 30px; /* Space for the line and dots */
}

/* The vertical line */
.wpc-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background-color: #e9ecef;
}

/* --- 3. Each Timeline Event/Item --- */
.wpc-timeline-item {
    position: relative;
    margin-bottom: 25px;
}
.wpc-timeline-item:last-child {
    margin-bottom: 0;
}

/* The dot on the line */
.wpc-timeline-item .wpc-timeline-dot {
    position: absolute;
    left: -24px; /* (30px padding - (18px dot / 2)) + 1px border */
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--wpc-accent-color, #8b9dc3);
    border: 2px solid var(--wpc-card-bg-color, #ffffff);
    z-index: 1;
}

/* --- 4. Highlighting the LATEST Status --- */
.wpc-timeline-item:first-child .wpc-timeline-dot {
    background-color: var(--wpc-primary-color, #3b5998);
    transform: scale(1.3);
    box-shadow: 0 0 0 4px rgba(59, 89, 152, 0.2);
}

.wpc-timeline-item:first-child .wpc-timeline-content {
    border-color: var(--wpc-primary-color, #3b5998);
}


/* --- 5. Timeline Content Styling --- */
.wpc-timeline-content {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-radius: var(--wpc-card-radius, 8px);
    border-left: 4px solid var(--wpc-accent-color, #8b9dc3);
}

.wpc-timeline-status {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--wpc-text-color, #1d2129);
    margin: 0 0 8px 0;
}

.wpc-timeline-meta {
    font-size: 0.85rem;
    color: var(--wpc-label-color, #606770);
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0 15px; /* Spacing between Date and Location */
}

.wpc-timeline-location::before {
    content: '•';
    margin-right: 10px;
}

.wpc-timeline-remarks {
    font-size: 0.9rem;
    color: var(--wpc-text-color, #1d2129);
    margin: 12px 0 0 0;
    padding-top: 12px;
    border-top: 1px dotted #dee2e6;
}

/* --- 6. Custom Styling per Status --- */
/* Match the border color of the content to the status badge colors */
.wpc-timeline-item.on-hold .wpc-timeline-content { border-color: #ffc107; }
.wpc-timeline-item.in-transit .wpc-timeline-content { border-color: #17a2b8; }
.wpc-timeline-item.delivered .wpc-timeline-content { border-color: #28a745; }
/* Add more as needed */
