/* =============================================
   HAJIPUR PMR DETAILS DIALOG STYLES
   ============================================= */

.hpmr-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.hpmr-dialog-card {
    background-color: #ffffff;
    width: 920px;
    max-width: 95vw;
    max-height: 85vh;
    border-radius: 14px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    animation: hpmrFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto;
}

/* Branch-accented jewel crest at top edge */
.hpmr-dialog-card::before {
    content: "";
    display: block;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, rgba(4, 5, 171, 0.85) 0%, rgba(4, 5, 171, 0.25) 30%, transparent 80%);
    flex-shrink: 0;
}

@keyframes hpmrFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Header - Compact Height */
.hpmr-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #F1F5F9;
    flex-shrink: 0;
    background-color: #FAFCFF;
}

.hpmr-dialog-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hpmr-dialog-title {
    font-size: 17px;
    font-weight: 700;
    color: #0F172A;
    margin: 0;
    letter-spacing: -0.01em;
}

.hpmr-dialog-close-btn {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    font-size: 18px;
    color: #64748B;
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hpmr-dialog-close-btn:hover {
    color: var(--primary-color, #0405AB);
    background-color: var(--primary-bg, #EEF0FF);
    border-color: var(--primary-color, #0405AB);
    transform: rotate(90deg) scale(1.08);
}

/* Body */
.hpmr-dialog-body {
    padding: 24px 28px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(85vh - 125px);
    display: block !important;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

.hpmr-dialog-body::-webkit-scrollbar {
    width: 7px;
}

.hpmr-dialog-body::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.hpmr-dialog-body::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

.hpmr-dialog-body::-webkit-scrollbar-track {
    background-color: #f8fafc;
}

/* 4-Column Grid for Field Specs */
.hpmr-specs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 28px;
    row-gap: 20px;
    margin-bottom: 20px;
}

.hpmr-spec-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

.hpmr-spec-item:empty {
    display: none !important;
    border: none !important;
    padding: 0 !important;
}

.hpmr-spec-label {
    font-size: 12px;
    font-weight: 500;
    color: #151515;
    line-height: 1.3;
}

.hpmr-spec-value {
    font-size: 13px;
    color: #808080;
    font-weight: 500;
    line-height: 1.4;
    border: none;
    padding: 0;
}

/* Radio buttons container matching Figma design */
.hpmr-radio-group {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 24px;
    margin-top: 4px;
}

.hpmr-radio-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: default;
    user-select: none;
    pointer-events: none;
}

.hpmr-radio-label input[type="radio"] {
    display: none !important;
}

.hpmr-radio-text {
    font-size: 13px;
    color: #737373;
    font-weight: 400;
    line-height: 1;
}

.hpmr-radio-custom {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1.5px solid #D1D5DB;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    background-color: #FFFFFF;
    transition: all 0.15s ease;
}

.hpmr-radio-custom::after {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #FFFFFF;
    display: none;
}

.hpmr-radio-label input[type="radio"]:checked + .hpmr-radio-custom {
    background-color: #0405AB !important;
    border-color: #0405AB !important;
}

.hpmr-radio-label input[type="radio"]:checked + .hpmr-radio-custom::after {
    display: block !important;
    background-color: #FFFFFF !important;
}

/* Footer */
.hpmr-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 14px 24px;
    border-top: 1px solid #F1F5F9;
    background-color: #FAFCFF;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
    flex-shrink: 0;
}

.hpmr-dialog-footer-close-btn {
    background-color: #ffffff;
    color: #475569;
    border: 1px solid #CBD5E1;
    padding: 8px 24px;
    height: 38px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.hpmr-dialog-footer-close-btn:hover {
    background-color: #F8FAFC;
    border-color: #94A3B8;
    color: #0F172A;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transform: translateY(-0.5px);
}

@media (max-width: 768px) {
    .hpmr-specs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .hpmr-specs-grid {
        grid-template-columns: 1fr;
    }
}

/* Planning Details Table in Dialog */
.hpmr-planning-table-wrapper {
    margin-top: 10px;
    width: 100%;
    border: 1px solid #E5E5EE;
    border-radius: 8px;
    background-color: #FFFFFF;
    overflow: hidden;
}

.hpmr-planning-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #FFFFFF;
}

.hpmr-planning-table thead {
    background-color: #EEF0FF;
}

.hpmr-planning-table thead th {
    font-size: 13px;
    font-weight: 600;
    color: #1F2937;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid #E5E5EE;
    line-height: 1.3;
}

.hpmr-planning-table thead th:first-child {
    padding-left: 16px;
    width: 28%;
}

.hpmr-planning-table thead th:not(:first-child) {
    width: 36%;
}

.hpmr-planning-table tbody tr {
    border-bottom: 1px solid #F0F1F5;
}

.hpmr-planning-table tbody tr:last-child {
    border-bottom: none;
}

.hpmr-planning-table tbody td {
    padding: 8px 10px;
    vertical-align: middle;
}

.hpmr-planning-table tbody td:first-child {
    padding-left: 16px;
    padding-right: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #4B5563;
    white-space: nowrap;
    background-color: #F8F9FA;
}

.hpmr-planning-table tbody td:last-child {
    padding-right: 14px;
}

/* Read-only table value display */
.hpmr-table-value {
    padding: 0 14px;
    background-color: #FFFFFF;
    border: 1px solid #E5E5EE;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    color: #555555;
    height: 38px;
    min-height: 38px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Planning table select wrapper & dropdown */
.hpmr-table-select-wrapper {
    position: relative;
    width: 100%;
}

.hpmr-table-select {
    width: 100%;
    height: 38px;
    padding: 0 32px 0 14px;
    background-color: #FFFFFF;
    border: 1px solid #E5E5EE;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    color: #555555;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: default;
    box-sizing: border-box;
}

.hpmr-table-select-chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #808080;
}

.hpmr-table-select-chevron svg {
    width: 16px;
    height: 16px;
}

/* Planning table text input */
.hpmr-table-input {
    width: 100%;
    height: 38px;
    padding: 0 14px;
    background-color: #FFFFFF;
    border: 1px solid #E5E5EE;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    color: #555555;
    outline: none;
    box-sizing: border-box;
}

.hpmr-table-input::placeholder {
    color: #9CA3AF;
}

/* Selling Cost per KG Highlight Box */
.hpmr-selling-cost-highlight {
    width: 38%;
    margin-top: 10px;
    padding: 6px 12px;
    background-color: #EEF2FF;
    border: 1px solid #C7D2FE;
    border-left: 3.5px solid #0405AB;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(4, 5, 171, 0.05);
    overflow: hidden;
}

.hpmr-selling-cost-label-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
}

.hpmr-selling-cost-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #0F172A;
    letter-spacing: 0.1px;
    line-height: 1.2;
    white-space: nowrap;
    flex-shrink: 0;
}

.hpmr-selling-cost-sublabel {
    font-size: 10px;
    font-weight: 500;
    color: #64748B;
    line-height: 1.2;
    white-space: nowrap;
}

.hpmr-selling-cost-value-wrap {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background-color: #FFFFFF;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid #C7D2FE;
    box-shadow: 0 1px 3px rgba(4, 5, 171, 0.06);
    min-width: 0;
    max-width: calc(100% - 115px);
    box-sizing: border-box;
    flex-shrink: 1;
}

.hpmr-selling-cost-currency {
    font-size: 12px;
    font-weight: 700;
    color: #0F172A;
    flex-shrink: 0;
}

.hpmr-selling-cost-value {
    font-size: 13px;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

@media (max-width: 600px) {
    .hpmr-selling-cost-highlight {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 8px 12px;
    }

    .hpmr-selling-cost-value-wrap {
        align-self: flex-start;
        max-width: 100%;
    }
}

/* Action Icons (Revised Rate & Negotiation) */
.hpdv-icon-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s, transform 0.1s;
}

.hpdv-icon-btn:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.hpdv-action-icon {
    width: 20px;
    height: 20px;
    display: block;
}

/* Lock background scrolling while child dialog overlays are open */
html:has(.hrrd-overlay),
body:has(.hrrd-overlay),
html:has(.hnd-overlay),
body:has(.hnd-overlay) {
    overflow: hidden !important;
}

/* Ensure child dialog overlays open above AdminPmrDetailsDialog */
.hrrd-overlay,
.hnd-overlay {
    z-index: 1200 !important;
    overscroll-behavior: contain;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

