/* ============================================================
   captura.css  --  Styles for Nexus Autoparts Data Entry
   ============================================================ */

/* --- Tabs --- */
.captura-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.captura-tab {
    padding: 0.8rem 1.8rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    position: relative;
    bottom: -2px;
}

.captura-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.captura-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.captura-tab .tab-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    font-weight: 700;
}

.captura-section {
    display: none;
}

.captura-section.active {
    display: block;
}

/* --- Vehicle Selector (Section 1) --- */
.vehicle-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.vehicle-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.vehicle-filters label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vehicle-filters select,
.vehicle-filters input {
    padding: 0.5rem 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 160px;
}

.vehicle-filters select:focus,
.vehicle-filters input:focus {
    outline: none;
    border-color: var(--accent);
}

/* --- Vehicle List --- */
.vehicle-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.8rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.vehicle-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.vehicle-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.vehicle-card .vc-brand {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent);
}

.vehicle-card .vc-model {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.2rem 0;
}

.vehicle-card .vc-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.vehicle-card .vc-parts-count {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--success);
}

/* --- Vehicle Header (when editing) --- */
.vehicle-header {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-hover) 100%);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vehicle-header .vh-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.vehicle-header .vh-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vehicle-header .vh-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.vehicle-header .vh-brand { color: var(--accent); }

.vehicle-header .vh-actions {
    display: flex;
    gap: 0.5rem;
}

/* --- Part Groups Table --- */
.category-section {
    margin-bottom: 1.5rem;
}

.category-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.category-header:hover {
    background: var(--bg-hover);
}

.category-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
}

.category-header .cat-toggle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.category-header.collapsed .cat-toggle {
    transform: rotate(-90deg);
}

.category-body {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.category-body.collapsed {
    display: none;
}

.group-section {
    border-bottom: 1px solid var(--border);
    padding: 0.8rem 1rem;
}

.group-section:last-child {
    border-bottom: none;
}

.group-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* --- Part Rows --- */
.part-rows {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.part-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.part-row input {
    padding: 0.4rem 0.6rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.part-row input:focus {
    outline: none;
    border-color: var(--accent);
}

.part-row .pr-oem {
    width: 160px;
    font-family: monospace;
}

.part-row .pr-name {
    flex: 1;
    min-width: 150px;
}

.part-row .pr-qty {
    width: 50px;
    text-align: center;
}

.part-row .pr-btn {
    padding: 0.3rem 0.6rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

.part-row .pr-save {
    background: var(--success);
    color: #fff;
}

.part-row .pr-save:hover { background: #1ea34e; }

.part-row .pr-delete {
    background: var(--danger);
    color: #fff;
}

.part-row .pr-delete:hover { background: #cc3333; }

.part-row.saved {
    background: rgba(34, 197, 94, 0.08);
    border-radius: 6px;
    padding: 0.2rem 0.4rem;
}

.part-row.saved input {
    background: transparent;
    border-color: var(--success);
    color: var(--success);
}

.btn-add-part {
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-part:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* --- Progress Bar --- */
.progress-bar {
    background: var(--bg-secondary);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    border-radius: 10px;
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* --- Section 2: Intercambios --- */
.part-detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.part-detail-card .pdc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.part-detail-card .pdc-oem {
    font-family: monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.part-detail-card .pdc-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.part-detail-card .pdc-group {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-hover);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.aftermarket-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.aftermarket-table th {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.aftermarket-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid rgba(42, 42, 58, 0.5);
}

.aftermarket-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--border);
}

.aftermarket-form .af-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.aftermarket-form label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.aftermarket-form select,
.aftermarket-form input {
    padding: 0.4rem 0.6rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.aftermarket-form select:focus,
.aftermarket-form input:focus {
    outline: none;
    border-color: var(--accent);
}

/* --- Section 3: Imágenes --- */
.image-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.8rem;
}

.image-card .ic-preview {
    width: 100px;
    height: 100px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    overflow: hidden;
    flex-shrink: 0;
}

.image-card .ic-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-card .ic-info {
    flex: 1;
}

.image-card .ic-oem {
    font-family: monospace;
    font-weight: 700;
    color: var(--accent);
}

.image-card .ic-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.image-card .ic-upload {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.image-card .ic-upload input[type="file"] {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- Search bar --- */
.captura-search {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
    align-items: center;
}

.captura-search input {
    padding: 0.5rem 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    flex: 1;
    max-width: 400px;
}

.captura-search input:focus {
    outline: none;
    border-color: var(--accent);
}

/* --- Pagination --- */
.captura-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem;
}

.captura-pagination button {
    padding: 0.4rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
}

.captura-pagination button:hover {
    border-color: var(--accent);
}

.captura-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.captura-pagination .page-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state .es-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.empty-state .es-text {
    font-size: 0.9rem;
}

/* --- Toast notifications --- */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 9999;
    animation: toastIn 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes toastIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- Loading spinner --- */
.loading {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Layout --- */
.captura-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5rem 2rem 2rem;
}

/* --- Status tabs for vehicles --- */
.status-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.status-tab {
    padding: 0.4rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.status-tab:hover { border-color: var(--accent); }

.status-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
