/* =========================================================
   Inventory Listing Plugin - Shared Grid Styles
   ========================================================= */

.ilg-wrap { width: 100%; }

/* Region filter */
.ilg-region-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.ilg-region-option { font-weight: normal; cursor: pointer; }

/* Search bar */
.ilg-search-form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ilg-search-inputs { display: flex; flex-direction: column; gap: 6px; }
.ilg-search-fields { display: flex; flex-direction: column; gap: 6px; }
.ilg-search-top-row { display: flex; gap: 8px; align-items: stretch; }
.ilg-search-field { flex: 3; padding: 6px 10px; box-sizing: border-box; min-width: 0; }
.ilg-search-submit { flex: 1; padding: 6px 16px; cursor: pointer; white-space: nowrap; }
.ilg-filter-info { margin: 0 0 12px; font-size: 0.9em; }
.ilg-clear { margin-left: 8px; }

/* Price range filter */
.ilg-price-range { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.ilg-price-range label { white-space: nowrap; }
.ilg-price-field { width: 110px; padding: 6px 8px; box-sizing: border-box; }
.ilg-price-sep { color: #666; }

/* Grid container */
.ilg-grid {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax( 220px, 1fr ) );
    gap: 20px;
    margin-top: 8px;
}

/* Card */
.ilg-card {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Card link - full width, column layout so image is top half */
.ilg-card-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    flex: 1;
}
.ilg-card-link:hover { opacity: 0.85; }

/* Thumbnail - full width, 16:9 aspect ratio */
.ilg-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ilg-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ilg-no-thumb { font-size: 1em; color: #999; padding: 8px; text-align: center; }

/* Card info */
.ilg-card-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.ilg-title { margin: 0 0 2px; font-size: 1em; font-weight: bold; line-height: 1.3; }
.ilg-make-model { margin: 0; font-size: 1em; font-weight: normal; }
.ilg-year { margin: 0; font-size: 1em; font-weight: normal; }
.ilg-mileage { margin: 0; font-size: 1em; font-weight: normal; }
.ilg-region { margin: 0; font-size: 1em; font-weight: normal; }
.ilg-price { margin: 2px 0 0; font-size: 1em; font-weight: bold; }

/* Save button */
.ilg-card .il-save-wrap { padding: 6px 12px 10px; border-top: 1px solid #eee; }

/* Owner actions row (my_inventory_grid) */
.ilg-owner-actions { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 10px; border-top: 1px solid #eee; gap: 8px; }
.ilg-owner-actions .il-save-wrap { padding: 0; border-top: none; }
.ilg-owner-actions-btns { display: flex; gap: 8px; margin-left: auto; }
.ilg-delete-btn { font-size: 0.85em; color: #b32d2e; text-decoration: none; }
.ilg-delete-btn:hover { text-decoration: underline; }
.ilg-edit-btn { font-size: 0.85em; color: #0073aa; text-decoration: none; border: 1px solid #0073aa; padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
.ilg-edit-btn:hover { background: #0073aa; color: #fff; text-decoration: none; }

/* Contact info (phone & Line ID) inside card */
.ilg-contact { margin: 6px 0 0; padding: 0; }
.ilg-contact-item { display: flex; gap: 8px; margin: 0; padding: 0; font-size: 0.82em; line-height: 1.5; }
.ilg-contact-item strong { min-width: 48px; }

/* Saved count header */
.ilg-saved-count { font-size: 1em; font-weight: bold; margin: 0 0 10px; }

/* Draft state */
.ilg-status-draft { opacity: 0.7; }
.ilg-draft-badge { font-size: 0.75em; font-weight: normal; background: #f0a500; color: #fff; padding: 1px 6px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }

/* Pagination */
.ilg-pagination { margin-top: 20px; text-align: center; }
.ilg-no-posts { margin-top: 16px; }

/* =========================================================
   [inventory_list] Row Layout
   ========================================================= */

/* Outer wrapper — flex column so every child stacks vertically */
.il-row-list-wrap {
    display: -webkit-box !important;
    display: -ms-flexbox !important;
    display: flex !important;
    -webkit-box-orient: vertical !important;
    -webkit-box-direction: normal !important;
    -ms-flex-direction: column !important;
    flex-direction: column !important;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 12px;
}

/* Shared column layout — use !important to override theme inline/block resets */
.il-row-header,
.il-row-item {
    display: -ms-grid !important;
    display: grid !important;
    -ms-grid-columns: 3fr 1fr 1fr 1.5fr 1.5fr 1.5fr;
    grid-template-columns: 3fr 1fr 1fr 1.5fr 1.5fr 1.5fr;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    width: 100%;
    padding: 10px 14px;
    box-sizing: border-box;
}

/* Header row */
.il-row-header {
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
    font-weight: bold;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
}

/* Data rows — <a> tags, must force block/grid display */
.il-row-item {
    text-decoration: none !important;
    color: inherit !important;
    border-bottom: 1px solid #eee;
    -webkit-transition: background 0.15s;
    transition: background 0.15s;
}
.il-row-item:last-child { border-bottom: none; }
.il-row-item:hover { background: #f9f9f9; text-decoration: none !important; }

/* Individual cells — block so they don't collapse inline */
.il-row-title,
.il-row-year,
.il-row-make,
.il-row-model,
.il-row-mileage,
.il-row-price {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.il-row-title   { font-weight: 600; white-space: normal; word-break: break-word; }
.il-row-year    { color: #777; font-size: 0.95em; }
.il-row-make    { color: #777; font-size: 0.95em; }
.il-row-model   { color: #777; font-size: 0.95em; }
.il-row-mileage { color: #777; font-size: 0.95em; }
.il-row-price   { font-weight: bold; }

/* Draft rows are dimmed */
.il-status-draft { opacity: 0.65; }

/* Responsive: stack to two-column cards on small screens */
@media ( max-width: 600px ) {
    .il-row-header { display: none !important; }
    .il-row-item {
        grid-template-columns: 1fr 1fr !important;
        -ms-grid-columns: 1fr 1fr !important;
        padding: 10px 12px;
        gap: 2px 8px;
    }
    .il-row-title   { grid-column: 1 / -1; white-space: normal; margin-bottom: 4px; }
    .il-row-year    { grid-column: 1; }
    .il-row-make    { grid-column: 2; }
    .il-row-model   { grid-column: 1; }
    .il-row-mileage { grid-column: 2; }
    .il-row-price   { grid-column: 1 / -1; margin-top: 4px; font-size: 1em; }
}

/* Responsive */
@media ( max-width: 480px ) {
    .ilg-grid { grid-template-columns: 1fr; }
}
