/* =========================================================
   جزئیات سفارش
   File: assets/css/order-details.css
========================================================= */

/* =========================
   کانتینر اصلی
========================= */

.loan-order-details-container {
    width: calc(100% - 32px);
    max-width: 1100px;
    margin: 32px auto;
    padding: 20px;
    background: #f3f5f7;
    border-radius: 16px;
    font-family: "IRANYekanX", Tahoma, Arial, sans-serif;
    direction: rtl;
    color: #1f2937;
    box-sizing: border-box;
}

.loan-order-details-container *,
.loan-order-details-container *::before,
.loan-order-details-container *::after {
    box-sizing: border-box;
}

/* =========================
   هدر سفارش
========================= */

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
}

.order-header h2 {
    margin: 0;
    color: #111827;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.7;
}

/* =========================
   وضعیت سفارش
========================= */

.order-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.status-pending {
    background: #fff4e5;
    color: #ef6c00;
}

.status-completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-failed {
    background: #ffebee;
    color: #c62828;
}

.status-cancelled {
    background: #eceff1;
    color: #546e7a;
}

/* =========================
   بخش‌ها و کارت‌های اطلاعات
========================= */

.order-section {
    position: relative;
    margin-bottom: 18px;
    padding: 20px;
    overflow: hidden;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.order-section:last-child {
    margin-bottom: 0;
}

.order-section h3 {
    margin: 0 0 16px;
    padding-right: 10px;
    border-right: 4px solid #ef4056;
    color: #1f2937;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.7;
}

.provider-group-bank h3 {
    border-right-color: #1565c0;
}

.provider-group-person h3 {
    border-right-color: #2e7d32;
}

.provider-group-digital h3 {
    border-right-color: #7b1fa2;
}

/* =========================
   جدول عمومی اطلاعات
========================= */

.order-info-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.order-info-table tr {
    border-bottom: 1px solid #edf0f3;
}

.order-info-table tr:last-child {
    border-bottom: none;
}

.order-info-table th {
 /*   width: 28%;*/
    padding: 12px 10px 12px 0;
    color: #6b7280;
    font-weight: 500;
    text-align: right;
    vertical-align: top;
}

.order-info-table td {
    padding: 12px 0;
    color: #1f2937;
    font-weight: 600;
    text-align: right;
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.order-info-table a {
    color: #d63638;
    text-decoration: none;
    transition: color 0.2s ease;
}

.order-info-table a:hover,
.order-info-table a:focus {
    color: #b91c1c;
    text-decoration: underline;
}

/* =========================
   بخش اعتبارسنجی
========================= */

.credit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.credit-label {
    color: #6b7280;
    font-weight: 500;
}

.credit-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    background: #f8fafc;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

/* =========================
   یادداشت، حالت خالی و خطا
========================= */

.order-note-content {
    padding: 15px;
    background: #fafafa;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.9;
}

.loan-report-empty {
    padding: 16px;
    background: #f8fafc;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    color: #4b5563;
    line-height: 1.9;
}

.loan-error {
    max-width: 800px;
    margin: 25px auto;
    padding: 15px;
    background: #fff3f3;
    border: 1px solid #fecaca;
    border-radius: 10px;
    color: #d32f2f;
    text-align: center;
}

/* =========================
   دکمه عملیات سفارش
========================= */

.order-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 25px;
}

.btn-back,
.btn-credit-report {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.btn-back {
    padding-right: 28px;
    padding-left: 28px;
    background: #ef4056;
}

.btn-back:hover,
.btn-back:focus {
    background: #d81b3a;
    color: #fff;
    text-decoration: none;
}

.btn-credit-report {
    background: #2563eb;
}

.btn-credit-report:hover,
.btn-credit-report:focus {
    background: #1d4ed8;
    color: #fff;
    text-decoration: none;
}

.btn-back:active,
.btn-credit-report:active {
    transform: translateY(1px);
}

/* =========================
   دکمه راهنما و گزارش
========================= */

.loan-guide-btn,
.loan-send-report-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

/* دکمه مشاهده راهنما ـ آبی */
.loan-guide-btn {
    background: #2563eb;
}

.loan-guide-btn:hover,
.loan-guide-btn:focus {
    background: #1d4ed8;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* دکمه ثبت گزارش خطا ـ قرمز */
.loan-send-report-btn {
    background: #d32f2f;
}

.loan-send-report-btn:hover,
.loan-send-report-btn:focus {
    background: #b71c1c;
    color: #fff;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.22);
}

.loan-guide-btn:active,
.loan-send-report-btn:active {
    transform: translateY(1px);
}

.loan-guide-btn:disabled,
.loan-send-report-btn:disabled,
.loan-report-submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
}

.provider-action-placeholder {
    color: #9ca3af;
}

/* =========================
   جدول ارائه‌دهندگان
========================= */

.provider-table-wrapper {
    width: 100%;
    overflow-x: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    -webkit-overflow-scrolling: touch;
}

.provider-report-table {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

.provider-report-table thead th {
    padding: 14px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.provider-report-table tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid #edf0f3;
    color: #1f2937;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.9;
    text-align: right;
    vertical-align: top;
}

.provider-report-table tbody tr:last-child td {
    border-bottom: none;
}

.provider-report-table tbody tr:hover {
    background: #fcfcfd;
}

/* ردیف ارائه‌دهنده ویژه */
.provider-report-table tbody tr.special-provider-row {
    background: #fffdf5;
}

.provider-report-table tbody tr.special-provider-row:hover {
    background: #fff9e6;
}

.badge-special {
    display: inline-block;
    margin-right: 5px;
    padding: 2px 6px;
    background: #ff9800;
    border-radius: 4px;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.6;
    vertical-align: middle;
}

.provider-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

/* =========================
   استایل مشترک مودال‌ها
========================= */

.loan-guide-modal,
.loan-report-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    direction: rtl;
    font-family: "IRANYekanX", Tahoma, Arial, sans-serif;
}

.loan-guide-modal.is-open,
.loan-report-modal.is-open {
    display: block !important;
}

.loan-guide-modal-overlay,
.loan-report-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.loan-guide-modal-content,
.loan-report-modal-content {
    position: relative;
    z-index: 2;
    width: calc(100% - 32px);
    margin: 60px auto;
    padding: 22px 20px 20px;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.loan-guide-modal-content {
    max-width: 640px;
    max-height: calc(100vh - 120px);
}

.loan-report-modal-content {
    max-width: 440px;
    max-height: calc(100vh - 120px);
}

.loan-guide-modal-content h4,
.loan-report-modal-content h4 {
    margin: 0 0 18px;
    padding-left: 42px;
    color: #111827;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.8;
}

/* =========================
   دکمه بستن مودال
========================= */

.loan-guide-close,
.loan-report-close {
    position: absolute;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: #f3f4f6;
    border: none;
    border-radius: 999px;
    color: #111827;
    font-family: Arial, sans-serif;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.loan-guide-close:hover,
.loan-guide-close:focus,
.loan-report-close:hover,
.loan-report-close:focus {
    background: #e5e7eb;
    color: #b91c1c;
}

/* =========================
   محتوای مودال راهنما
========================= */

#loan-guide-modal-body {
    color: #374151;
    font-size: 14px;
    font-weight: 400;
    line-height: 2;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#loan-guide-modal-body p:first-child {
    margin-top: 0;
}

#loan-guide-modal-body p:last-child {
    margin-bottom: 0;
}

#loan-guide-modal-body a {
    color: #2563eb;
    text-decoration: none;
}

#loan-guide-modal-body a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* =========================
   فرم مودال گزارش خطا
========================= */

#loan-report-form {
    margin: 0;
}

.loan-report-form-group {
    margin-bottom: 16px;
}

.loan-report-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-size: 13px;
    font-weight: 700;
}

.loan-report-form-group select {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    color: #1f2937;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.loan-report-form-group select:hover {
    border-color: #9ca3af;
}

.loan-report-form-group select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

#loan-report-message {
    min-height: 4px;
    margin-bottom: 12px;
    color: #374151;
    font-size: 13px;
    line-height: 1.8;
}

.loan-report-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 18px;
    background: #2e7d32;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.6;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.loan-report-submit-btn:hover,
.loan-report-submit-btn:focus {
    background: #1b5e20;
    color: #fff;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.22);
}

.loan-report-submit-btn:active {
    transform: translateY(1px);
}

/* =========================
   نوتیفیکیشن
========================= */

.loan-notification {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100000;
    width: calc(100% - 48px);
    max-width: 380px;
    padding: 13px 16px;
    direction: rtl;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-right-width: 4px;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    color: #1f2937;
    font-family: "IRANYekanX", Tahoma, Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.8;
    text-align: right;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease,
        visibility 0.3s ease;
}

.loan-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.loan-notification.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-right-color: #16a34a;
    color: #166534;
}

.loan-notification.error {
    background: #fef2f2;
    border-color: #fecaca;
    border-right-color: #dc2626;
    color: #991b1b;
}

.loan-notification.info {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-right-color: #2563eb;
    color: #1e40af;
}

/* =========================
   حالت فوکوس دسترس‌پذیری
========================= */

.loan-guide-btn:focus-visible,
.loan-send-report-btn:focus-visible,
.loan-report-submit-btn:focus-visible,
.loan-guide-close:focus-visible,
.loan-report-close:focus-visible,
.btn-back:focus-visible,
.btn-credit-report:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.25);
    outline-offset: 2px;
}

/* =========================
   نمایش در موبایل
========================= */

@media (max-width: 768px) {

    .loan-order-details-container {
        width: calc(100% - 24px);
        margin: 12px auto;
        padding: 12px;
        border-radius: 12px;
    }

    .order-section {
        padding: 16px;
        border-radius: 14px;
    }

    .order-section h3 {
        margin-bottom: 14px;
        font-size: 15px;
    }

    .order-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .credit-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .order-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-back,
    .btn-credit-report {
        width: 100%;
    }

    /* تبدیل جدول اطلاعات به حالت بلوکی */
    .order-info-table:not(.provider-report-table),
    .order-info-table:not(.provider-report-table) tbody,
    .order-info-table:not(.provider-report-table) tr,
    .order-info-table:not(.provider-report-table) th,
    .order-info-table:not(.provider-report-table) td {
        display: block;
        width: 100%;
    }

    .order-info-table:not(.provider-report-table) tr {
        margin-bottom: 8px;
        padding: 10px 0;
        border-bottom: 1px dashed #e5e7eb;
    }

    .order-info-table:not(.provider-report-table) th {
        width: 100%;
        padding: 0 0 6px;
        color: #9ca3af;
        font-size: 12px;
    }

    .order-info-table:not(.provider-report-table) td {
        padding: 0;
        font-size: 14px;
        text-align: right;
    }

    /* جدول ارائه‌دهندگان به حالت کارت */
    .provider-table-wrapper {
        overflow: visible;
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .provider-report-table {
        display: block;
        width: 100%;
        min-width: 100%;
    }

    .provider-report-table thead {
        display: none;
    }

    .provider-report-table tbody,
    .provider-report-table tr,
    .provider-report-table td {
        display: block;
        width: 100%;
    }

    .provider-report-table tbody tr {
        margin-bottom: 12px;
        padding: 14px;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 14px;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    }

    .provider-report-table tbody tr.special-provider-row {
        background: #fffdf5;
        border-color: #fde68a;
    }

    .provider-report-table tbody td {
        margin-bottom: 12px;
        padding: 0;
        border: none;
        font-size: 13px;
        line-height: 1.9;
        text-align: right;
    }

    .provider-report-table tbody td:last-child {
        margin-bottom: 0;
    }

    .provider-report-table tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: #6b7280;
        font-size: 12px;
        font-weight: 700;
    }

    .provider-actions {
        align-items: stretch;
        justify-content: stretch;
        gap: 10px;
    }

    .loan-guide-btn,
    .loan-send-report-btn {
        width: 100%;
    }

    /* مودال‌ها */
    .loan-guide-modal-content,
    .loan-report-modal-content {
        width: calc(100% - 20px);
        margin: 20px auto;
        padding: 18px 16px 16px;
        border-radius: 14px;
        max-height: calc(100vh - 40px);
    }

    .loan-guide-modal-content h4,
    .loan-report-modal-content h4 {
        padding-left: 36px;
        font-size: 15px;
    }

    #loan-guide-modal-body {
        font-size: 13px;
        line-height: 2;
    }

    .loan-guide-close,
    .loan-report-close {
        top: 10px;
        left: 10px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .loan-report-submit-btn {
        width: 100%;
    }

    .loan-notification {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }
}

/* =========================
   موبایل‌های کوچک
========================= */

@media (max-width: 480px) {

    .loan-order-details-container {
        width: calc(100% - 16px);
        margin: 8px auto;
        padding: 8px;
    }

    .order-section {
        padding: 14px;
    }

    .provider-report-table tbody tr {
        padding: 12px;
    }

    .loan-guide-modal-content,
    .loan-report-modal-content {
        width: calc(100% - 16px);
        margin: 8px auto;
        max-height: calc(100vh - 16px);
    }
}
.loan-address-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: #6b7280;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.loan-address-btn:hover,
.loan-address-btn:focus {
    background: #4b5563;
    color: #fff;
}

.loan-address-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    direction: rtl;
    font-family: "IRANYekanX", Tahoma, Arial, sans-serif;
}

.loan-address-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(2px);
}

.loan-address-modal-content {
    position: relative;
    z-index: 2;
    width: calc(100% - 32px);
    max-width: 640px;
    margin: 60px auto;
    padding: 22px 20px 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.loan-address-modal-content h4 {
    margin: 0 0 18px;
    padding-left: 42px;
    color: #111827;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.8;
}

.loan-address-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: #f3f4f6;
    font-size: 24px;
    cursor: pointer;
}

#loan-address-modal-body {
    color: #374151;
    font-size: 14px;
    line-height: 2;
    word-break: break-word;
}
