/* ═══════════════════════════════════════════════════════════════
   Producción — Histórico Fabricaciones
   Reuses ho-* global classes from historico.css for consistency
   Only defines fabricaciones-specific elements
   ═══════════════════════════════════════════════════════════════ */

/* ── Layout: match Histórico OC density ──────────────────────── */
#sub-produccion-historico .ho-table-container {
    max-height: calc(100vh - 140px);
}

/* ── Fabrication type badge ──────────────────────────────────── */
.hf-badge-fab {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.hf-badge-fabricacion {
    background: rgba(34,197,94,0.12);
    color: #4ade80;
    border: 1px solid rgba(34,197,94,0.2);
}

.hf-badge-acondicionado {
    background: rgba(96,165,250,0.12);
    color: #60a5fa;
    border: 1px solid rgba(96,165,250,0.2);
}

.hf-badge-default {
    background: rgba(148,163,184,0.1);
    color: #94a3b8;
    border: 1px solid rgba(148,163,184,0.15);
}

/* ── Quantity cell ────────────────────────────────────────────── */
.hf-qty {
    font-weight: 600;
    color: #e2e8f0;
}

.hf-qty-target {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 400;
}

.hf-qty-split {
    display: block;
    margin-top: 2px;
    color: #a78bfa;
    font-size: 0.62rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Zebra & hover for Fabricaciones table ────────────────────── */
#hf-table tbody tr.ho-row:nth-child(even) .ho-td {
    background: rgba(30, 41, 59, 0.25);
}

#hf-table tbody tr.ho-row:hover .ho-td {
    background: rgba(99, 102, 241, 0.07);
}

#hf-table tbody tr.ho-row:hover .ho-sku-col__sku {
    color: #34d399;
}

/* ── Drawer ───────────────────────────────────────────────────── */
.hf-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.hf-drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.hf-drawer {
    position: fixed;
    top: 0;
    right: -640px;
    width: 620px;
    height: 100vh;
    background: #1a2233;
    border-left: 1px solid rgba(255,255,255,0.08);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.3);
}

.hf-drawer.active {
    right: 0;
}

.hf-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.hf-drawer-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: #e2e8f0;
}

.hf-drawer-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.hf-drawer-close:hover {
    color: #e2e8f0;
    background: rgba(255,255,255,0.06);
}

.hf-drawer-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Drawer sections */
.hf-detail-section {
    margin-bottom: 20px;
}

.hf-detail-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.hf-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.hf-detail-item label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #475569;
    margin-bottom: 3px;
}

.hf-detail-item strong {
    display: block;
    font-size: 0.85rem;
    color: #e2e8f0;
    font-weight: 600;
}

/* Financial card */
.hf-finance-card {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    padding: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
}

.hf-finance-item label {
    display: block;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #475569;
    margin-bottom: 3px;
}

.hf-finance-item strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
}

.hf-finance-costo { color: #e2e8f0; }
.hf-finance-unitario { color: #fbbf24; }
.hf-finance-ingreso { color: #34d399; }

/* ── Modify Plan Button ──────────────────────────────────────── */
.hf-btn-modify-plan {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 8px;
    color: #818cf8;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.hf-btn-modify-plan:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    transform: translateY(-1px);
}

/* ── SweetAlert Plan Selector Cards ──────────────────────────── */
.hf-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 4px;
}

.hf-plan-card {
    padding: 16px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(51, 65, 85, 0.35);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hf-plan-card:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(15, 23, 42, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.hf-plan-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.hf-plan-card__id {
    font-weight: 700;
    color: #e2e8f0;
    font-size: 1rem;
}

.hf-plan-card__date {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
}

/* ── Plan Selector Filters ── */

.hf-plan-filters {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(51, 65, 85, 0.3);
}

.hf-plan-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.hf-plan-filter-group label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hf-plan-filter-dates {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hf-plan-filter-dates input[type="date"],
.hf-plan-filter-group select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 6px;
    padding: 6px 10px;
    color: #e2e8f0;
    font-size: 0.78rem;
    outline: none;
    transition: border-color 0.2s;
}

.hf-plan-filter-dates input[type="date"]:focus,
.hf-plan-filter-group select:focus {
    border-color: rgba(99, 102, 241, 0.6);
}

.hf-plan-filter-dates input[type="date"] {
    flex: 1;
    min-width: 0;
}

.hf-plan-filter-group select {
    width: 100%;
}

/* Fix date input icon color for dark theme */
.hf-plan-filter-dates input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
}

.hf-plan-card__meta {
    font-size: 0.78rem;
    color: #64748b;
}

.hf-plan-card__meta strong {
    color: #94a3b8;
}

/* ── SweetAlert Edit Table ───────────────────────────────────── */
.hf-edit-wrap {
    max-height: 55vh;
    overflow-y: auto;
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: 8px;
}

.hf-edit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.hf-edit-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.hf-edit-table th {
    background: #1e293b;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #334155;
    white-space: nowrap;
}

.hf-edit-table td {
    padding: 7px 10px;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.2);
    vertical-align: middle;
}

.hf-edit-table tbody tr:hover td {
    background: rgba(99, 102, 241, 0.05);
}

.hf-edit-table tbody tr.hf-row-removed td {
    opacity: 0.3;
    text-decoration: line-through;
}

.hf-edit-table tbody tr.hf-row-added td {
    background: rgba(34, 197, 94, 0.06);
}

.hf-edit-input {
    width: 100%;
    padding: 5px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    color: #e2e8f0;
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    transition: border-color 0.2s;
}

.hf-edit-input:focus {
    border-color: rgba(99, 102, 241, 0.5);
}

.hf-edit-input--qty {
    width: 80px;
    text-align: right;
    color: #4ade80;
    font-weight: 700;
    -moz-appearance: textfield;
}

.hf-edit-input--pack {
    color: #a78bfa;
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.22);
    cursor: default;
}

.hf-edit-total {
    color: #c4b5fd;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    font-weight: 800;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.hf-edit-input--qty::-webkit-inner-spin-button,
.hf-edit-input--qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

.hf-edit-input--lote {
    width: 140px;
    color: #fbbf24;
}

.hf-edit-btn-remove {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.hf-edit-btn-remove:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.hf-edit-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
    flex-wrap: wrap;
}

.hf-edit-toolbar__title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hf-edit-toolbar__actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.hf-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 1px solid rgba(51, 65, 85, 0.4);
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.6);
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.hf-edit-btn:hover {
    background: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
    border-color: rgba(99, 102, 241, 0.4);
}

.hf-edit-btn--add {
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.hf-edit-btn--add:hover {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.08);
}

.hf-edit-btn--lote {
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.hf-edit-btn--lote:hover {
    border-color: rgba(251, 191, 36, 0.6);
    background: rgba(251, 191, 36, 0.08);
}

/* ── Inline Add Product Panel ── */

.hf-add-panel {
    margin: 0 0 12px 0;
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.95);
    overflow: hidden;
    animation: hfSlideDown 0.2s ease;
}

@keyframes hfSlideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 400px; }
}

.hf-add-panel__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    background: rgba(34, 197, 94, 0.05);
}

.hf-add-panel__search {
    flex: 1;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 6px;
    padding: 7px 12px;
    color: #e2e8f0;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.2s;
}

.hf-add-panel__search:focus {
    border-color: rgba(34, 197, 94, 0.5);
}

.hf-add-panel__search::placeholder {
    color: #475569;
}

.hf-add-panel__close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.15s;
}

.hf-add-panel__close:hover {
    color: #ef4444;
}

.hf-add-panel__results {
    max-height: 220px;
    overflow-y: auto;
}

.hf-add-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.15);
    cursor: pointer;
    transition: background 0.15s;
}

.hf-add-result-item:hover {
    background: rgba(34, 197, 94, 0.06);
}

.hf-add-result-sku {
    color: #60a5fa;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 80px;
}

.hf-add-result-name {
    color: #94a3b8;
    font-size: 0.78rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hf-add-result-btn {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.hf-add-result-btn:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.6);
    transform: scale(1.1);
}

.hf-row-order-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 64px;
    padding: 5px 8px;
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 7px;
    color: #93c5fd;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.hf-row-order-btn:hover:not(:disabled) {
    background: rgba(96, 165, 250, 0.2);
    border-color: rgba(96, 165, 250, 0.45);
    color: #bfdbfe;
}

.hf-row-order-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
