/* ============================================================================
   ORDER CARD STYLES - REDESIGNED (TIGHTER VERSION)
   Shared styles for order cards on Pending & ToPick pages
   ============================================================================ */

/* ============================================================================
   ORDER CARD CONTAINER
   ============================================================================ */

.order-card {
    background: white;
    border-radius: 12px;
    padding: 0.875rem;  /* Reduced from 1rem */
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    line-height: 1.3;  /* Tighter line height */
}

.order-card:active {
    transform: scale(0.98);
    border-color: var(--primary-color);
}

/* ============================================================================
   ROW 1: Order# | Account# | Lines
   ============================================================================ */

.card-row-1 {
    display: grid;
    grid-template-columns: 2fr 1.8fr 1.5fr;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;  /* Reduced from 0.75rem */
    /* Removed border-bottom */
}

.order-number {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: left;
    line-height: 1.2;
}

.account-number {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
}

.line-count {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.25rem;
}

.lines-main {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.units-hint {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.2;
}

/* ============================================================================
   ROW 2: Date References | Time | Value
   ============================================================================ */

.card-row-2 {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;  /* Changed from center to allow wrapping */
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    gap: 0.5rem;
}

.date-info {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    flex-wrap: wrap;  /* Allow wrapping if needed */
    min-width: 0;
    flex: 1;
    line-height: 1.4;  /* Better spacing when wrapped */
}

.date-relative {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.date-full {
    color: var(--text-secondary);
    white-space: nowrap;
}

.time-info {
    color: var(--text-secondary);
    font-size: 0.7rem;
    white-space: nowrap;
}

.order-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
    align-self: center;  /* Keep centered vertically */
}

/* ============================================================================
   ROW 3: Company Name
   ============================================================================ */

.card-row-3 {
    margin-bottom: 0.5rem;  /* Reduced from 0.75rem */
}

.company-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.postcode {
    display: none;  /* Hidden - not used */
}

/* ============================================================================
   ROW 4: Bin Locations
   ============================================================================ */

.card-row-4 {
    margin-bottom: 0;  /* No bottom margin if last element */
}

/* Only add margin if row 5 exists */
.card-row-5 ~ .card-row-4,
.order-card:has(.card-row-5) .card-row-4 {
    margin-bottom: 0.5rem;
}

.bins-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;  /* Tighter gap */
}

.bin-badge {
    display: inline-block;
    padding: 0.3rem 0.5rem;  /* Slightly tighter */
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    line-height: 1.2;
}

.no-bins {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.3;
}

/* ============================================================================
   ROW 5: Action Buttons (ToPick only)
   ============================================================================ */

.card-row-5 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding-top: 0.5rem;  /* Reduced from 0.75rem */
    border-top: 1px solid var(--border-color);
    margin-top: 0.4rem;
}

.action-btn-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.6rem 0.5rem;  /* Slightly reduced */
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.2;
}

.action-btn-card:active {
    transform: scale(0.95);
}

.action-btn-card.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.action-btn-card.primary img {
    filter: brightness(0) invert(1);
}

.action-btn-card img {
    width: 16px;
    height: 16px;
}

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

@media (max-width: 480px) {
    /* Even tighter on mobile */
    .order-card {
        padding: 0.75rem;
    }
    
    .card-row-1 {
        grid-template-columns: 2fr 1.8fr 1.5fr;
        gap: 0.25rem;
        margin-bottom: 0.4rem;
    }
    
    /* Make Order# and Lines same style as Account# */
    .order-number {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text-primary);
    }
    
    .account-number {
        font-size: 0.95rem;
    }
    
    .lines-main {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text-primary);
    }
    
    /* Units stays as-is */
    .units-hint {
        font-size: 0.7rem;
    }
    
    .card-row-2 {
        margin-bottom: 0.4rem;
    }
    
    .card-row-3 {
        margin-bottom: 0.4rem;
    }
    
    /* Truncate time more aggressively on mobile */
    .time-info {
        max-width: 50px;
    }
    
    .action-btn-card span {
        display: none;
    }
    
    .action-btn-card img {
        width: 20px;
        height: 20px;
    }
}

@media (min-width: 481px) and (max-width: 600px) {
    .action-btn-card {
        font-size: 0.8rem;
        padding: 0.55rem 0.4rem;
    }
}

/* ============================================================================
   HOVER EFFECTS (for devices with hover capability)
   ============================================================================ */

@media (hover: hover) {
    .order-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        transform: translateY(-2px);
    }
    
    .action-btn-card:hover {
        background: var(--bg-secondary);
        border-color: var(--primary-color);
        color: var(--primary-color);
    }
    
    .action-btn-card.primary:hover {
        background: var(--primary-dark);
        border-color: var(--primary-dark);
    }
}


/* ============================================================================
   PIP CARD UPDATES - Replace the PIP section in listing-cards.css
   ============================================================================ */

/* Row 1: BatchID | Picker Name | Progress */
.pip-card .card-row-1 {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

.pip-card .batch-id {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.pip-card .picker-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.pip-card .line-count {
    text-align: right;
}

/* Batch Type Icons */
.batch-type-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.tote-icon {
    /* Green #128750 */
    filter: brightness(0) saturate(100%) invert(44%) sepia(65%) saturate(843%) hue-rotate(95deg) brightness(95%) contrast(88%);
}

.pile-icon {
    /* Magenta/Purple #871248 */
    filter: brightness(0) saturate(100%) invert(14%) sepia(85%) saturate(3567%) hue-rotate(315deg) brightness(88%) contrast(95%);
}

/* Row 2: Order#🔗Account# Pairs */
.pip-card .order-account-row {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block; /* Changed from flex to block for inline flow */
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.4;
}

.link-icon {
    width: 14px;
    height: 14px;
    opacity: 0.4;
    margin: 0 2px;
    vertical-align: middle;
    display: inline-block;
}

/* Row 3: Last Pick | Next Pick (side by side) */
.pip-card .bin-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    gap: 1rem;
    color: var(--text-secondary);
}

.pip-card .last-pick-info {
    text-align: left;
    flex: 1;
}

.pip-card .next-pick-info {
    text-align: right;
    flex-shrink: 0;
}

/* Use existing bin-badge style for bin displays */
.pip-card .last-pick-info .bin-badge,
.pip-card .next-pick-info .bin-badge {
    /* Inherits from existing .bin-badge styles */
    margin-left: 0.25rem;
}

/* Row 3.5: Pick Times */
.pip-card .pick-times-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0 0.4rem 0;
    font-size: 0.75rem;
    gap: 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.pip-card .pick-time-info {
    white-space: nowrap;
}

/* Row 4: Action Buttons (was Row 5) */
.pip-card .card-row-4 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.4rem;
}

/* Mobile Adjustments for PIP Cards */
@media (max-width: 480px) {
    .pip-card .card-row-1 {
        gap: 0.5rem;
        margin-bottom: 0.35rem;
    }

    .pip-card .batch-id {
        font-size: 0.8rem;
    }

    .pip-card .picker-name {
        font-size: 0.9rem;
    }

    .pip-card .order-account-row {
        font-size: 0.8rem;
        padding: 0.35rem 0;
    }

    .link-icon {
        width: 12px;
        height: 12px;
    }

    .pip-card .bin-status-row {
        font-size: 0.75rem;
        padding: 0.35rem 0;
    }

    .pip-card .pick-times-row {
        font-size: 0.7rem;
        padding: 0.3rem 0 0.35rem 0;
    }

    .batch-type-icon {
        width: 14px;
        height: 14px;
    }
}

/* Very Small Screens - Stack on tiny screens */
@media (max-width: 360px) {
    .pip-card .bin-status-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .pip-card .next-pick-info {
        text-align: left;
    }
}