/* ===== PRODUCTOS.CSS ===== */
:root {
    --pr-primary: var(--wk-primary);
    --pr-surface: rgba(255,255,255,0.88);
    --pr-border: rgba(255,255,255,0.55);
    --pr-text: #1a1a1a;
    --pr-text-2: #46443d;
    --pr-text-3: #8a8782;
}
.dark {
    --pr-primary: var(--wk-primary);
    --pr-surface: rgba(28,28,28,0.94);
    --pr-border: rgba(255,255,255,0.10);
    --pr-text: #ededed;
    --pr-text-2: #cfcdc7;
    --pr-text-3: #8a8782;
}

.pr-container { max-width: 1400px; margin: 0 auto; padding: 4px 0 24px; }

/* Header */
.pr-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.pr-title { font-size: 28px; font-weight: 900; color: var(--pr-text); letter-spacing: -.02em; margin: 0 0 4px; font-family: 'Manrope', sans-serif; }
.pr-subtitle { font-size: 13px; color: var(--pr-text-3); margin: 0; }

/* KPIs */
.pr-kpi-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 18px; }
.pr-kpi {
    background: var(--pr-surface); backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--pr-border); border-radius: 1.5rem;
    padding: 18px 20px; box-shadow: 0 4px 24px rgba(var(--wk-primary-rgb),0.05);
}
.pr-kpi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--pr-text-3); margin-bottom: 8px; }
.pr-kpi-value { font-size: 28px; font-weight: 900; color: var(--pr-text); font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; font-family: 'Manrope', sans-serif; }
.pr-kpi-blue { color: var(--wk-text); }
.pr-kpi-warn { color: #d97706; }
.dark .pr-kpi-blue { color: var(--wk-text); }
.dark .pr-kpi-warn { color: #fbbf24; }

/* Search */
.pr-search-bar { position: relative; margin-bottom: 14px; }
.pr-search-input {
    width: 100%; padding: 11px 44px 11px 18px; border-radius: 14px;
    border: 1px solid var(--pr-border); background: var(--pr-surface); backdrop-filter: blur(16px);
    font-size: 13.5px; color: var(--pr-text); font-family: inherit;
    outline: none; transition: border-color .15s, box-shadow .15s;
}
.pr-search-input::placeholder { color: var(--pr-text-3); }
.pr-search-input:focus { border-color: var(--wk-text); box-shadow: 0 0 0 3px rgba(var(--wk-primary-rgb),0.1); }
.pr-search-clear {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--pr-text-3); cursor: pointer;
    font-size: 13px; padding: 4px; transition: color .15s;
}
.pr-search-clear:hover { color: #ba1a1a; }

/* Table card */
.pr-table-card {
    background: var(--pr-surface); backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--pr-border); border-radius: 1.5rem;
    box-shadow: 0 4px 24px rgba(var(--wk-primary-rgb),0.05); overflow: hidden;
}
.pr-table-info { font-size: 12px; color: var(--pr-text-3); padding: 11px 20px; border-bottom: 1px solid rgba(70,68,61,0.07); }
.dark .pr-table-info { border-bottom-color: rgba(255,255,255,0.05); }
.pr-table-info strong { color: var(--pr-text); }
.pr-table-wrap { overflow-x: auto; }
.pr-table { width: 100%; border-collapse: collapse; }
.pr-table thead { border-bottom: 1px solid rgba(70,68,61,0.07); }
.dark .pr-table thead { border-bottom-color: rgba(255,255,255,0.05); }
.pr-table th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--pr-text-3); padding: 11px 16px; text-align: left; white-space: nowrap; }
.pr-th-right { text-align: right; }
.pr-table td { padding: 12px 16px; border-bottom: 1px solid rgba(70,68,61,0.05); font-size: 13px; color: var(--pr-text); vertical-align: middle; }
.dark .pr-table td { border-bottom-color: rgba(255,255,255,0.04); }
.pr-table tr:last-child td { border-bottom: none; }
.pr-table tbody tr:hover td { background: rgba(var(--wk-primary-rgb),0.025); }
.dark .pr-table tbody tr:hover td { background: rgba(255,255,255,0.03); }
.pr-td-codigo { font-family: 'Courier New', monospace; font-size: 12px; font-weight: 700; color: var(--pr-text-3); white-space: nowrap; }
.pr-td-nombre { font-weight: 500; }
.pr-td-precio { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; font-family: 'Manrope', sans-serif; }
.pr-sin-precio { color: var(--pr-text-3); font-weight: 400; font-size: 12px; }
.pr-base { color: var(--pr-text-3); font-weight: 500; }
.pr-td-actions { width: 80px; white-space: nowrap; }

/* Unit badge */
.pr-uni-badge {
    display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 600;
    padding: 2px 9px; border-radius: 20px;
    background: rgba(var(--wk-primary-rgb),0.06); border: 1px solid rgba(var(--wk-primary-rgb),0.1); color: var(--pr-text-3);
    white-space: nowrap;
}
.dark .pr-uni-badge { background: rgba(var(--wk-primary-rgb),0.08); border-color: rgba(var(--wk-primary-rgb),0.12); }

/* Icon buttons */
.pr-btn-icon { width: 40px; height: 40px; border: none; border-radius: 10px; cursor: pointer; background: transparent; display: inline-flex; align-items: center; justify-content: center; transition: background .14s, color .14s; touch-action: manipulation; }
.pr-btn-icon .material-symbols-outlined { font-size: 17px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.pr-btn-icon.edit { color: var(--pr-text-3); }
.pr-btn-icon.edit:hover { background: rgba(var(--wk-primary-rgb),0.08); color: var(--wk-text); }
.pr-btn-icon.delete { color: var(--pr-text-3); }
.pr-btn-icon.delete:hover { background: rgba(186,26,26,0.08); color: #ba1a1a; }
.dark .pr-btn-icon.edit:hover { background: rgba(var(--wk-primary-rgb),0.12); color: var(--wk-text); }
.dark .pr-btn-icon.delete:hover { background: rgba(255,180,171,0.12); color: #ffb4ab; }

/* Empty */
.pr-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 56px 20px; color: var(--pr-text-3); }
.pr-empty-icon .material-symbols-outlined { font-size: 44px; font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 48; opacity: .5; }
.pr-empty-text { font-size: 15px; font-weight: 700; color: var(--pr-text-2); }
.pr-empty-sub { font-size: 13px; opacity: .75; }
.pr-spinner { width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid rgba(var(--wk-primary-rgb),0.12); border-top-color: var(--wk-text); animation: pr-spin .75s linear infinite; }
@keyframes pr-spin { to { transform: rotate(360deg); } }

/* Modal */
.pr-modal {
    background: var(--pr-surface); backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--pr-border); border-radius: 1.5rem;
    width: 100%; max-width: 500px; max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.18);
    animation: pr-popIn .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pr-popIn { from { transform: scale(.93) translateY(14px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.pr-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 16px; border-bottom: 1px solid rgba(70,68,61,0.07); flex-shrink: 0; }
.dark .pr-modal-header { border-bottom-color: rgba(255,255,255,0.06); }
.pr-modal-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; color: var(--pr-text); font-family: 'Manrope', sans-serif; }
.pr-modal-title .material-symbols-outlined { font-size: 20px; color: var(--wk-text); font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.pr-modal-close { width: 32px; height: 32px; border: none; border-radius: 9px; background: transparent; cursor: pointer; color: var(--pr-text-3); display: flex; align-items: center; justify-content: center; transition: background .14s; }
.pr-modal-close .material-symbols-outlined { font-size: 18px; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.pr-modal-close:hover { background: rgba(186,26,26,0.08); color: #ba1a1a; }
.pr-modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.pr-modal-footer { display: flex; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid rgba(70,68,61,0.07); flex-shrink: 0; }
.dark .pr-modal-footer { border-top-color: rgba(255,255,255,0.06); }

/* Checkbox */
.pr-check-field { display: flex; flex-direction: column; gap: 4px; }
.pr-check-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--pr-text); }
.pr-check-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--wk-text); cursor: pointer; }
.pr-check-text { user-select: none; }

/* Error box */
.pr-error-box { display: flex; align-items: flex-start; gap: 8px; background: rgba(186,26,26,0.06); border: 1px solid rgba(186,26,26,0.15); border-radius: 11px; padding: 10px 14px; font-size: 13px; color: #ba1a1a; font-weight: 500; line-height: 1.5; }
.pr-error-box .material-symbols-outlined { font-size: 16px; font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; flex-shrink: 0; }
.dark .pr-error-box { background: rgba(147,0,10,0.2); border-color: rgba(255,180,171,0.2); color: #ffb4ab; }

/* Buttons */
.pr-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: 14px; font-size: 13.5px; font-weight: 700; cursor: pointer; border: none; font-family: inherit; transition: all .15s; white-space: nowrap; }
.pr-btn:disabled { opacity: .5; cursor: not-allowed; }
.pr-btn:active:not(:disabled) { transform: scale(.97); }
.pr-btn.primary { background: linear-gradient(135deg,var(--wk-primary),var(--wk-primary-strong)); color: var(--wk-on-primary); box-shadow: 0 4px 14px rgba(var(--wk-primary-rgb),0.25); }
.pr-btn.primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(var(--wk-primary-rgb),0.35); filter: brightness(1.05); }
.dark .pr-btn.primary { background: linear-gradient(135deg,var(--wk-primary-strong),var(--wk-primary-strong)); }
.pr-btn.danger { background: #ba1a1a; color: #fff; }
.pr-btn.danger:hover { background: #a31515; }
.pr-btn.light { background: transparent; color: var(--pr-text-2); border: 1px solid var(--pr-border); }
.pr-btn.light:hover:not(:disabled) { border-color: var(--wk-text); color: var(--wk-text); background: rgba(var(--wk-primary-rgb),0.04); }
.dark .pr-btn.light { border-color: rgba(255,255,255,0.12); }
.dark .pr-btn.light:hover:not(:disabled) { background: rgba(var(--wk-primary-rgb),0.08); border-color: rgba(var(--wk-primary-rgb),0.3); color: var(--wk-text); }
.pr-btn-spinner { width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: pr-spin .7s linear infinite; flex-shrink: 0; }

/* Responsive */
@media (max-width: 768px) {
    .pr-kpi-grid { grid-template-columns: 1fr 1fr 1fr; }
    .pr-table th:nth-child(5), .pr-table td:nth-child(5) { display: none; }
}
@media (max-width: 520px) {
    .pr-kpi-grid { grid-template-columns: 1fr 1fr; }
    .pr-header { flex-direction: column; align-items: flex-start; }
    .pr-table th:nth-child(3), .pr-table td:nth-child(3) { display: none; }
}
