/* PAN CRM v222 - Test popup mantığıyla bağımsız teklif ürün seçme penceresi */
:root {
    --pancrm-product-popup-z: 2147483600;
}

#pancrm-offer-product-popup-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    background: #16a34a;
    color: #fff;
    font: 800 13px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    box-shadow: 0 10px 24px rgba(22, 163, 74, .22);
    cursor: pointer;
    margin: 8px 10px 8px 0;
}
#pancrm-offer-product-popup-button:hover { background: #15803d; }

#pancrm-offer-product-popup-root[hidden] { display: none !important; }
#pancrm-offer-product-popup-root {
    position: fixed;
    inset: 0;
    z-index: var(--pancrm-product-popup-z);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#pancrm-offer-product-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .48);
}
#pancrm-offer-product-popup-window {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(980px, calc(100vw - 32px));
    max-height: calc(100vh - 44px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    color: #111827;
    box-shadow: 0 30px 90px rgba(15, 23, 42, .35);
    border: 1px solid rgba(148, 163, 184, .35);
    pointer-events: auto;
}
#pancrm-offer-product-popup-window .pop-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff7ed;
}
#pancrm-offer-product-popup-window .pop-title { font-weight: 900; font-size: 16px; }
#pancrm-offer-product-popup-window .pop-subtitle { margin-top: 3px; font-size: 12px; color: #64748b; }
#pancrm-offer-product-popup-window .pop-close {
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #111827;
    cursor: pointer;
    padding: 7px 9px;
    font-weight: 900;
}
#pancrm-offer-product-popup-window .pop-body {
    padding: 16px 18px;
    overflow: auto;
}
.pancrm-product-search-row {
    display: grid;
    grid-template-columns: 1fr 120px 120px 120px;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
}
.pancrm-product-search-row label,
.pancrm-product-options label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: #334155;
    margin-bottom: 5px;
}
.pancrm-product-search-row input,
.pancrm-product-options input,
.pancrm-product-options select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    padding: 10px 11px;
    background: #fff;
    color: #111827;
    font-size: 14px;
    outline: none;
}
.pancrm-product-search-row input:focus,
.pancrm-product-options input:focus,
.pancrm-product-options select:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .14);
}
.pancrm-product-options {
    display: grid;
    grid-template-columns: 120px 150px 120px 120px 1fr;
    gap: 10px;
    align-items: end;
    margin: 12px 0;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #f8fafc;
}
.pancrm-check-box {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 0 !important;
    height: 40px;
    font-size: 13px !important;
    color: #111827 !important;
}
.pancrm-check-box input { width: 18px !important; height: 18px !important; }
#pancrm-offer-product-results {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    min-height: 220px;
    max-height: 380px;
    overflow-y: auto;
}
.pancrm-product-row {
    display: grid;
    grid-template-columns: 1fr 120px 95px 100px;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    align-items: center;
}
.pancrm-product-row:hover,
.pancrm-product-row.is-selected {
    background: #fff7ed;
}
.pancrm-product-row .pname { font-weight: 800; color: #111827; }
.pancrm-product-row .pmeta { font-size: 12px; color: #64748b; margin-top: 2px; }
.pancrm-product-row .pprice { font-weight: 800; text-align: right; }
.pancrm-product-empty { padding: 22px; color: #64748b; text-align: center; }
#pancrm-offer-product-selected {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    color: #14532d;
    font-weight: 800;
    display: none;
}
#pancrm-offer-product-message {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #334155;
    font-size: 13px;
    display: none;
}
#pancrm-offer-product-popup-window .pop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}
#pancrm-offer-product-popup-window .pop-actions button,
.pancrm-product-search-btn {
    border: 0;
    border-radius: 11px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 900;
}
.pancrm-product-search-btn { background: #f97316; color: #fff; width: 100%; }
#pancrm-product-add-btn { background: #16a34a; color: #fff; }
#pancrm-product-add-btn:disabled { background: #94a3b8; cursor: not-allowed; }
#pancrm-product-close-btn { background: #e5e7eb; color: #111827; }
@media (max-width: 800px) {
    .pancrm-product-search-row,
    .pancrm-product-options,
    .pancrm-product-row { grid-template-columns: 1fr; }
    .pancrm-product-row .pprice { text-align: left; }
}

/* v226: ürün ekle / kalem düzenle / satışa çevir popup ortak düzen */
#pancrm-offer-product-popup-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    margin: 8px 0 12px auto;
    border: 0;
    border-radius: 12px;
    background: #16a34a;
    color: #fff;
    font-weight: 800;
    box-shadow: 0 14px 30px rgba(22, 163, 74, .22);
    cursor: pointer;
}

#pancrm-offer-item-edit-root[hidden],
#pancrm-convert-sale-root[hidden] {
    display: none !important;
}

#pancrm-offer-item-edit-root,
#pancrm-convert-sale-root,
#pancrm-offer-product-popup-root {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483600 !important;
}

#pancrm-offer-item-edit-backdrop,
#pancrm-convert-sale-backdrop,
#pancrm-offer-product-popup-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, .38) !important;
    backdrop-filter: blur(2px);
    z-index: 2147483601 !important;
    pointer-events: auto !important;
}

#pancrm-offer-item-edit-window,
#pancrm-convert-sale-window,
#pancrm-offer-product-popup-window {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: min(1120px, calc(100vw - 54px)) !important;
    max-height: calc(100vh - 70px) !important;
    overflow: hidden !important;
    background: #fff !important;
    border-radius: 20px !important;
    box-shadow: 0 30px 90px rgba(15, 23, 42, .35) !important;
    z-index: 2147483602 !important;
    pointer-events: auto !important;
    display: flex;
    flex-direction: column;
}

#pancrm-convert-sale-window {
    width: min(620px, calc(100vw - 54px)) !important;
}

#pancrm-offer-item-edit-window .pop-head,
#pancrm-convert-sale-window .pop-head,
#pancrm-offer-product-popup-window .pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    background: #e0f2fe;
    border-bottom: 1px solid #bae6fd;
}

#pancrm-offer-item-edit-window .pop-title,
#pancrm-convert-sale-window .pop-title,
#pancrm-offer-product-popup-window .pop-title {
    font-size: 22px;
    font-weight: 900;
    color: #0f172a;
}

#pancrm-offer-item-edit-window .pop-subtitle,
#pancrm-convert-sale-window .pop-subtitle,
#pancrm-offer-product-popup-window .pop-subtitle {
    margin-top: 4px;
    color: #475569;
    font-size: 13px;
}

#pancrm-offer-item-edit-window .pop-close,
#pancrm-convert-sale-window .pop-close,
#pancrm-offer-product-popup-window .pop-close {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

#pancrm-offer-item-edit-window .pop-body,
#pancrm-convert-sale-window .pop-body,
#pancrm-offer-product-popup-window .pop-body {
    padding: 20px 22px;
    overflow: auto;
}

#pancrm-offer-item-edit-window .pop-actions,
#pancrm-convert-sale-window .pop-actions,
#pancrm-offer-product-popup-window .pop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 22px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

#pancrm-offer-item-edit-window .pop-actions button,
#pancrm-convert-sale-window .pop-actions button,
#pancrm-offer-product-popup-window .pop-actions button {
    min-width: 120px;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 800;
    cursor: pointer;
}

#pancrm-edit-save-btn,
#pancrm-convert-confirm-btn,
#pancrm-product-add-btn {
    background: #0ea5e9 !important;
    color: #fff !important;
}

#pancrm-product-add-btn {
    background: #16a34a !important;
}

#pancrm-convert-confirm-btn {
    background: #f97316 !important;
}

.pancrm-edit-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.pancrm-edit-form-grid .wide {
    grid-column: 1 / -1;
}

.pancrm-edit-form-grid label,
.pancrm-product-form-grid label {
    display: block;
    margin-bottom: 6px;
    font-weight: 800;
    color: #0f172a;
}

.pancrm-edit-form-grid input,
.pancrm-edit-form-grid select,
.pancrm-edit-form-grid textarea,
.pancrm-product-form-grid input,
.pancrm-product-form-grid select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
    color: #0f172a;
}

.pancrm-check-box {
    min-height: 44px;
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
}

#pancrm-edit-message,
#pancrm-convert-message,
#pancrm-offer-product-message {
    display: none;
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-weight: 700;
}

.pancrm-convert-warning {
    padding: 16px;
    border-radius: 14px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-weight: 900;
}

.pancrm-direct-item-edit-v226 {
    cursor: pointer !important;
}

@media (max-width: 900px) {
    .pancrm-edit-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
