/* ========== Vehicle Part Form Compact Styles ========== */

/* Required field star - site color (use primary-red from garage.css when loaded) */
.required-star {
    color: #7A0115;
    font-weight: 600;
    margin-left: 2px;
}

/* Basic tab — modern Active + label block */
.vp-active-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: linear-gradient(145deg, #ffffff 0%, #f9fafb 100%);
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    min-height: 52px;
}

.vp-active-switch .form-check-input {
    width: 2.75rem;
    height: 1.45rem;
    margin-top: 0;
    cursor: pointer;
}

.vp-active-switch .form-check-input:checked {
    background-color: #7A0115;
    border-color: #7A0115;
}

.vp-active-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.vp-active-title {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    line-height: 1.2;
}

.vp-active-hint {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.25;
}

/* Container */
.container.compact {
    max-width: 800px;
    margin: 0 auto;
    padding: 14px 18px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Tabs */
.tabs.compact {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid #E5E7EB;
    margin-bottom: 18px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: #fff;
    padding-bottom: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
}

.tabs.compact::-webkit-scrollbar {
    display: none;
}

/* Sticky tabs: stay under scroll (modal-body with .modal-dialog-scrollable or page scroll) */
#partFormModal #vehiclePartForm .tabs.compact {
    z-index: 30;
    top: 0;
    background-color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
}

#partFormModal.modal .modal-dialog-scrollable .modal-body {
    position: relative;
}

.tab.compact {
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 500;
    color: #6B7280;
    transition: all 0.3s ease;
    border: none;
    background: none;
    position: relative;
    white-space: nowrap;
    font-size: 15px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab.compact:hover {
    color: #1F2937;
}

.tab.compact.active {
    color: var(--primary-red);
    font-weight: 600;
}

.tab-indicator {
    position: absolute;
    bottom: -2px;
    height: 2px;
    background: var(--primary-red);
    transition: all 0.3s ease;
}

/* Steps */
.content.compact.step {
    display: none;
}

.content.compact.step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Titles */
.section-title.compact {
    font-size: 22px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #E5E7EB;
}

.section-subtitle.compact {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    display: block;
}

.section-subtitle.compact.label-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-subtitle.compact.label-with-icon .ti {
    color: var(--primary-red);
    font-size: 18px;
}

/* Form Groups */
.form-group.compact {
    margin-bottom: 14px;
}

.form-group.compact label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
    font-size: 14px;
}

.form-group.compact label.label-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group.compact label.label-with-icon .ti {
    color: var(--primary-red);
    font-size: 18px;
}

.form-group.compact .form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-group.compact .form-control:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(122, 1, 21, 0.12);
}

.form-group.compact .textarea {
    min-height: 100px;
    resize: vertical;
}

/* Custom Select */
.custom-select select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

/* Media Upload */
.image-upload-area.compact {
    border: 2px dashed #D1D5DB;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.image-upload-area.compact:hover {
    border-color: var(--primary-red);
    background: rgba(122, 1, 21, 0.02);
}

.upload-icon.compact {
    font-size: 40px;
    color: #9CA3AF;
    margin-bottom: 8px;
}

.additional-images-grid.compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.image-preview-container {
    position: relative;
    width: 100%;
    padding-top: 66%;
    /* 3:2 Ratio */
    background: #F3F4F6;
    border-radius: 8px;
    overflow: hidden;
}

.image-preview-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    z-index: 10;
}

/* Navigation */
.navigation.compact {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #E5E7EB;
}

.btn.compact {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-back.compact {
    background: #F3F4F6;
    color: #374151;
}

.btn-next.compact {
    background: var(--primary-red);
    color: white;
}

.btn-submit.compact {
    background: #10B981;
    color: white;
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 12px;
}

/* Responsive */
@media (max-width: 640px) {
    .tabs.compact {
        gap: 2px;
    }

    .tab.compact {
        padding: 8px 12px;
        font-size: 13px;
    }

    .additional-images-grid.compact {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== VehiclePart list (Index) — stay within viewport ========== */
/* Let the flex main column shrink so inner table can use horizontal scroll */
.dashboard .main-content:has(.vehicle-parts-index) {
    min-width: 0;
}

.vehicle-parts-index.content-wrapper {
    max-width: 100%;
    box-sizing: border-box;
}

.vehicle-parts-index .content-grid {
    min-width: 0;
    width: 100%;
}

.vehicle-parts-index .content-main {
    min-width: 0;
    max-width: 100%;
    width: 100%;
}

.vehicle-parts-index .section-header {
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.vehicle-parts-index .section-header .section-title {
    min-width: 0;
    flex: 1 1 auto;
}

.vehicle-parts-index .section-header .add-garage-btn {
    flex-shrink: 0;
}

.vehicle-parts-index .table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Same table behavior as Rent (garage.css): no fixed layout so action columns stay readable */
.vehicle-parts-index .garage-table {
    width: 100%;
    min-width: 900px;
}

.vehicle-parts-index .garage-table .table-col-owner {
    max-width: 160px;
    vertical-align: middle;
}

.vehicle-parts-index .garage-table th.table-col-owner {
    max-width: 160px;
}

.vehicle-parts-index .owner-id-badge {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 600;
    font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    line-height: 1.3;
    padding: 6px 10px;
    box-sizing: border-box;
}

.vehicle-parts-index .table-col-location {
    max-width: 280px;
}

/* Same row layout as Rent; clamp only the text span */
.vehicle-parts-index .location-cell.location-cell-clamp {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.vehicle-parts-index .location-cell.location-cell-clamp .location-text-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
}

/* Match Rent: room for all action icons (garage.css .settings-cell is 150px — too tight for 5+ buttons) */
.vehicle-parts-index .garage-table th.table-col-settings-head,
.vehicle-parts-index .garage-table .settings-cell {
    width: auto;
    min-width: 220px;
    vertical-align: middle;
}

.vehicle-parts-index .settings-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

.vehicle-parts-index .settings-actions .action-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
    font-size: 18px;
}

@media (max-width: 1200px) {
    .vehicle-parts-index .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .vehicle-parts-index.content-wrapper {
        padding: 16px;
    }

    .vehicle-parts-index .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Features & details tab — sections, stacked cards, service-style rows ========== */
#vehiclePartForm #features-step .vp-fd-section {
    margin-bottom: 28px;
}

#vehiclePartForm #features-step .vp-fd-section:last-of-type {
    margin-bottom: 6px;
}

#vehiclePartForm .vp-fd-pricing {
    padding: 18px 20px;
    background: linear-gradient(165deg, #f9fafb 0%, #ffffff 55%);
    border: 1px solid #e8eaef;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.045);
}

#vehiclePartForm .vp-fd-specs {
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #e8eaef;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.045);
}

#vehiclePartForm .vp-fd-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #1a1f2c;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

#vehiclePartForm .vp-fd-section-title .ti {
    color: var(--primary-red, #7A0115);
    font-size: 22px;
    flex-shrink: 0;
}

#vehiclePartForm .vp-fd-section-hint {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 16px 0;
    line-height: 1.45;
    max-width: 48rem;
}

/* Feature cards: icon above title (garage Basic “Features” style) */
#vehiclePartForm .vp-features-stack.features-grid-inline {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

@media (max-width: 640px) {
    #vehiclePartForm .vp-features-stack.features-grid-inline {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 641px) and (max-width: 900px) {
    #vehiclePartForm .vp-features-stack.features-grid-inline {
        grid-template-columns: repeat(2, 1fr);
    }
}

#vehiclePartForm .vp-features-stack .feature-card-label {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    padding: 18px 12px 16px;
    gap: 14px;
    min-height: 128px;
}

#vehiclePartForm .vp-features-stack .feature-icon.feature-icon-project {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 14px;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#vehiclePartForm .vp-features-stack .feature-info h4 {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: #1a1f2c;
    margin: 0;
}

/* Policies: garage Services row pattern + header icons */
#vehiclePartForm .service-checkbox-label .service-name-with-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}

#vehiclePartForm .vp-svc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(122, 1, 21, 0.08);
    color: var(--primary-red, #7A0115);
    font-size: 20px;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

#vehiclePartForm .service-row:has(.service-checkbox:checked) .vp-svc-icon {
    background: var(--primary-red, #7A0115);
    color: #fff;
}

#vehiclePartForm .service-checkbox-label .service-name-with-icon > span:last-child {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

#vehiclePartForm .service-row-header {
    padding: 10px 14px;
}

#vehiclePartForm .service-row-details .label-with-icon.small .ti {
    font-size: 15px;
}

/* ========== Site palette on Vehicle Part UI (no Bootstrap / garage-form blue) ========== */
.vehicle-part-spinner {
    color: var(--primary-red, #7A0115);
}

#vehiclePartForm .custom-select select:focus {
    outline: none;
    border-color: var(--primary-red, #7A0115);
    box-shadow: 0 0 0 3px rgba(122, 1, 21, 0.12);
}

#vehiclePartForm .form-check-input:focus {
    border-color: var(--primary-red, #7A0115);
    box-shadow: 0 0 0 0.25rem rgba(122, 1, 21, 0.2);
}

#vehiclePartForm .form-check-input:checked {
    background-color: var(--primary-red, #7A0115);
    border-color: var(--primary-red, #7A0115);
}

#vehiclePartForm .form-check-input:not(:disabled):active {
    filter: brightness(0.95);
}

#vehiclePartForm .btn-next.compact {
    background: var(--primary-red, #7A0115);
    color: #fff;
}

#vehiclePartForm .btn-next.compact:hover {
    background: var(--primary-red-dark, #730114);
    color: #fff;
}

/* Bootstrap modal: garage-style footer bar edge-to-edge */
#partFormModal .vehicle-part-modal-footer .modal-actions {
    border-radius: 0 0 var(--bs-modal-inner-border-radius, 0.5rem) var(--bs-modal-inner-border-radius, 0.5rem);
}

/* garage-form: feature cards & uploads — force brand red inside this form */
#vehiclePartForm .feature-card:hover {
    border-color: var(--primary-red, #7A0115);
}

#vehiclePartForm .feature-card input[type="checkbox"]:checked + .feature-card-label {
    background: var(--primary-red-light, rgba(252, 234, 234, 1));
}

#vehiclePartForm .feature-card input[type="checkbox"]:checked + .feature-card-label .feature-icon {
    background: var(--primary-red, #7A0115);
    color: #fff;
}

#vehiclePartForm .feature-card:has(input[type="checkbox"]:checked) {
    border-color: var(--primary-red, #7A0115);
    background: var(--primary-red-light, rgba(252, 234, 234, 1));
    box-shadow: 0 0 0 1px var(--primary-red, #7A0115);
}

#vehiclePartForm .image-upload-area.compact:hover {
    border-color: var(--primary-red, #7A0115);
    background: var(--primary-red-light, rgba(252, 234, 234, 0.35));
}

#vehiclePartForm .premium-upload-card:hover {
    border-color: var(--primary-red, #7A0115);
    background: var(--primary-red-light, rgba(252, 234, 234, 1));
}

#vehiclePartForm .premium-upload-card.media-upload-card:hover {
    border-color: var(--primary-red, #7A0115);
    background: var(--primary-red-light, rgba(252, 234, 234, 1));
}

#vehiclePartForm .upload-icon-circle {
    color: var(--primary-red, #7A0115);
}

#vehiclePartForm .gallery-upload-premium .image-upload-area.compact:hover,
#vehiclePartForm .gallery-add-area.image-upload-area.compact:hover {
    border-color: var(--primary-red, #7A0115);
    background: var(--primary-red-light, rgba(252, 234, 234, 0.35));
}