@font-face {
    font-family: 'ArslanWessam';
    src: url('Arslan-Wessam-B.ttf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'KOSans';
    src: url('KOSans-Medium.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --primary-blue: #0171EF;
    --accent-yellow: #FFBF00;
    --text-color: #001F64;
    --w: 213mm;
    --h: 301mm;
}

* {
    box-sizing: border-box;
    -webkit-print-color-adjust: exact;
}

body {
    background-color: #FFFFFF;
    margin: 0;
    padding: 20px;
    font-family: 'KOSans', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    direction: rtl;
    text-align: right;
}

body.login-page {
    min-height: 100vh;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(180deg, #eaf2ff 0%, #f6faff 100%);
}

.login-container {
    width: min(420px, 100%);
    background: white;
    padding: 32px 28px;
    border-radius: 24px;
    box-shadow: 0 22px 60px rgba(1, 113, 239, 0.14);
    border: 1px solid rgba(1, 113, 239, 0.12);
    text-align: center;
}

.login-container h1 {
    margin: 0 0 20px;
    font-size: 30px;
    color: var(--primary-blue);
}

.login-container p {
    margin: 0 0 24px;
    color: #2f3f6a;
    font-size: 14px;
    line-height: 1.6;
}

.input-group {
    text-align: right;
    margin-bottom: 16px;
}

.input-group label {
    margin-bottom: 8px;
    display: block;
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5ee;
    border-radius: 10px;
    background: #f8fbff;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-color);
}

.login-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: var(--primary-blue);
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(1, 113, 239, 0.18);
}

.login-note {
    margin-top: 14px;
    color: #5b6f96;
    font-size: 13px;
    line-height: 1.6;
}

/* التقرير */

#report-wrapper {
    width: var(--w);
    background: transparent;
}

/* === الصفحة === */


.page {
    width: var(--w);
    height: 296.8mm;
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
    display: block;
    page-break-after: always;
    break-after: page;
    background: white;
}



.page-img {
    padding: 0;
    margin: 0;
    background-color: var(--primary-blue) !important;
    line-height: 0;
    display: block;
}

.full-img {
    width: 100.5%;
    height: 100.5%;
    position: relative;
    top: -0.25%;
    left: -0.25%;
    object-fit: cover;
    display: block;
}

/* === المحتوى الداخلي === */
.page-content {
    padding: 45px 50px;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: calc(100% - 90px);
}

.header {
    display: flex;
    margin-bottom: 15px;
}

.brand {
    color: var(--primary-blue);
    font-size: 26px;
    font-weight: 900;
}

/* === الأقسام القابلة للتحريك === */
.editable-section {
    position: relative;
    margin-bottom: 10px;
    padding: 5px;
    border: 1px dashed transparent;
    /* حدود شفافة للتحرير */
    transition: 0.3s;
}       

/* إظهار أدوات التحكم عند تمرير الماوس */
.editable-section:hover {
    border-color: #ccc;
    background: rgba(0, 0, 0, 0.01);
}

.editable-section:hover .section-controls {
    display: flex;
}

/* أدوات التحكم (نقل/حذف) */
.section-controls {
    display: none;
    position: absolute;
    left: -35px;
    top: 0;
    flex-direction: column;
    gap: 2px;
}

.sec-btn {
    width: 25px;
    height: 25px;
    background: #eee;
    border: 1px solid #ccc;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.sec-btn:hover {
    background: #ddd;
}

.sec-btn.del-sec {
    background: #ffdddd;
    color: red;
}

/* === العناوين القابلة للتعديل === */
.sec-title-wrapper {
    text-align: center;
    margin: 20px 0 15px;
    position: relative;
}

.sec-title-inp {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    width: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
}

.sec-line {
    width: 100%;
    height: 6px;
    background: var(--accent-yellow);
    display: block;
    margin-top: 8px;
    border-radius: 6px;
    transform: rotate(-1deg);
    opacity: 0.9;
}

/* === شبكة البيانات القابلة للتعديل === */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 50px;
    margin-bottom: 30px;
}

.info-item {
    display: flex;
    align-items: center;
}

/* الليبل (مثل الاسم:) أصبح Input */
.lbl-inp {
    font-weight: 800;
    color: var(--primary-blue);
    margin-left: 10px;
    font-size: 16px;
    border: none;
    background: transparent;
    width: 80px;
    /* عرض مناسب */
    font-family: inherit;
    cursor: text;
}

.val-inp {
    width: 100%;
    border: none;
    border-bottom: 2px dashed #b3d7ff;
    text-align: center;
    font-family: inherit;
    font-size: 14px;
    background: transparent;
    color: var(--text-color);
    padding-bottom: 5px;
    font-weight: 400;
    unicode-bidi: isolate;
}

/* .val-inp[dir="ltr"] {
    direction: ltr;
    unicode-bidi: isolate-override;
    text-align: left;
} */

/* .tbl input {
    unicode-bidi: isolate;
} */

/* === الجداول === */
.tbl {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 2px solid var(--primary-blue);
    overflow: hidden;
    margin-bottom: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.tbl th {
    background: var(--primary-blue);
    color: white;
    padding: 12px;
    font-weight: 800;
    font-size: 16px;
    border-left: 1px solid var(--primary-blue);
    text-align: center;
}

.tbl th:last-child {
    border-left: none;
}

.tbl td {
    border-bottom: 1px solid var(--primary-blue);
    border-left: 1px solid var(--primary-blue);
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

.tbl th:first-child,
.tbl td:first-child {
    direction: ltr;
    unicode-bidi: isolate;
}

.val-inp[dir="ltr"] {
    direction: ltr;
    unicode-bidi: isolate;
}

.tbl td:last-child {
    border-left: none;
}

.tbl tr:last-child td {
    border-bottom: none;
}

.tbl input {
    width: 100%;
    border: none;
    text-align: center;
    font-family: inherit;
    font-weight: 300;
    font-size: 13px;
    color: var(--text-color);
    background: transparent;
    outline: none;
    /* direction: rtl;
    unicode-bidi: isolate-override; */
}

/* #report-wrapper input {
    direction: rtl;
    unicode-bidi: isolate-override;
} */

/* === القوائم === */
.list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    position: relative;
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--accent-yellow);
    transform: rotate(45deg);
    margin: 10px 0 0 15px;
    flex-shrink: 0;
}

.l-inp {
    width: 100%;
    border: none;
    font-family: inherit;
    font-size: 14px;
    background: transparent;
    color: var(--text-color);
    text-align: right;
    border-bottom: 1px dotted #ccc;
    padding-bottom: 3px;
}

/* === التوقيعات === */
.sigs {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
    margin-top: auto;
    padding-top: 20px;
}

.sig-box {
    text-align: center;
    flex: 1 1 calc(33.33% - 10px);
    min-width: 150px;
    max-width: 32%;
}

.sig-head-inp {
    color: var(--text-color);
    font-weight: 600;
    margin-bottom: 20px;
    display: block;
    font-size: 13px;
    width: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-family: inherit;
    cursor: text;
}

.sig-ln {
    width: 85%;
    border: none;
    border-bottom: 1px dotted #8993AD;
    text-align: center;
    color: var(--primary-blue);
    font-family: 'ArslanWessam', sans-serif;
    font-size: 23px;
}

/* === التحكم (للحذف) === */
.del {
    color: #dc3545;
    display: none;
    cursor: pointer;
    font-weight: bold;
    margin-right: 8px;
    font-size: 18px;
    line-height: 1;
}

tr:hover .del, li:hover .del {
    display: inline-block;
}

/* === لوحة التحكم الجانبية === */
.controls {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #eee;
    max-height: 90vh;
    overflow-y: auto;
    width: 250px;
}

.control-group {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.btn {
    background: var(--text-color);
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-weight: bold;
    font-family: inherit;
    font-size: 13px;
    width: 100%;
    margin-bottom: 5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-green {
    background: #28a745;
}

.btn-orange {
    background: #FFBF00;
}

.btn-blue {
    background: var(--primary-blue);
    padding: 12px;
    font-size: 15px;
}

.text-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    margin-bottom: 5px;
}

label {
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 5px;
    display: block;
    color: var(--primary-blue);
}

/* === إخفاء أدوات التحكم عند الطباعة === */
@media print {
    body, html {
        margin: 0;
        padding: 0;
        height: 100%;
        background: white;
    }

    .controls, .section-controls, .del {
        display: none !important;
    }

    .editable-section {
        border: none !important;
        margin-bottom: 5px;
    }

    #report-wrapper {
        margin: 0;
        width: 100%;
    }

    .page {
        margin: 0;
        border: none;
        box-shadow: none;
        page-break-after: always;
    }

    .page:last-child {
        page-break-after: auto;
    }
}



.sec-line-img {
    display: block;
    margin: 5px auto 0;
    height: auto;
    max-height: 15px;
    opacity: 0.9;
    /* filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1)); */
}


