@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-Thin.otf') format('opentype');
    font-weight: 100;
    font-style: normal;
}

@font-face {
    font-family: 'KOSans';
    src: url('KOSans-ExtraLight.otf') format('opentype');
    font-weight: 200;
    font-style: normal;
}

@font-face {
    font-family: 'KOSans';
    src: url('KOSans-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'KOSans';
    src: url('KOSans-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'KOSans';
    src: url('KOSans-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'KOSans';
    src: url('KOSans-SemiBold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'KOSans';
    src: url('KOSans-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'KOSans';
    src: url('KOSans-Bold.otf') format('opentype');
    font-weight: 800;
    font-style: normal;
}

@font-face {
    font-family: 'KOSans';
    src: url('KOSans-Bold.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
}

:root {
    --primary-blue: #0171EF;
    --accent-yellow: #FFBF00;
    --text-color: #001F64;
    --w: 213mm;
    --h: 301mm;
    --card-bg: #ffffff;
    --form-bg: #f0f4fb;
    --border-light: #dce4f2;
    --input-bg: #f8fbff;
    --shadow-sm: 0 2px 8px rgba(1, 113, 239, 0.06);
    --shadow-md: 0 8px 24px rgba(1, 113, 239, 0.10);
    --shadow-lg: 0 16px 48px rgba(1, 113, 239, 0.12);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

* {
    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;
    word-spacing: 2px;
}

/* ========================== */
/*     صفحة تسجيل الدخول      */
/* ========================== */

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;
}


/* ========================== */
/*      صفحة النموذج (Form)   */
/* ========================== */

body.form-page {
    background: var(--form-bg);
    min-height: 100vh;
    padding: 0;
}

/* الشريط العلوي */
.form-topbar {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0055cc 100%);
    padding: 18px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(1, 113, 239, 0.25);
}

.form-topbar .brand-title {
    color: white;
    font-size: 22px;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-topbar .brand-title .brand-sub {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.8;
    margin-right: 6px;
}

/* ===== شريط اختيار نوع التقرير ===== */
.report-type-selector {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    justify-content: center;
    margin: 0 30px;
}

.report-type-btn {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.25);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.report-type-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.report-type-btn.active {
    background: var(--accent-yellow);
    color:#ffff;
    border-color: var(--accent-yellow);
    box-shadow: 0 4px 16px rgba(255, 191, 0, 0.4);
    font-weight: 700;
}

.form-topbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.topbar-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topbar-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.topbar-btn.btn-logout {
    background: rgba(255, 191, 0, 0.2);
    border-color: rgba(255, 191, 0, 0.4);
    color: var(--accent-yellow);
}

.topbar-btn.btn-new {
    background: #FFFF;
    border-color: #3b82f6;
    color: #001F64;
    transition: all 0.2s ease;
}

.topbar-btn.btn-new:hover {
    background: #3b82f6;
    color: #ffffff;
}

/* حاوية النموذج */
.form-container {
    max-width: 700px;
    width: 100%;
    margin: 30px auto;
    padding: 0 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* البطاقات */
.form-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.form-card:hover {
    box-shadow: var(--shadow-md);
}

.form-card-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0060d6 100%);
    padding: 14px 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.form-card-header:hover {
    background: linear-gradient(135deg, #0060d6 0%, #004db3 100%);
}

.form-card-header .card-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.form-card-header .card-title {
    color: white;
    font-size: 16px;
    font-weight: 700;
    flex: 1;
}

.form-card-header .card-toggle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    transition: transform 0.3s ease;
}

.form-card.collapsed .card-toggle {
    transform: rotate(-90deg);
}

.form-card-body {
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
    max-height: 2000px;
    opacity: 1;
}

.form-card.collapsed .form-card-body {
    max-height: 0;
    opacity: 0;
    padding: 0 22px;
    overflow: hidden;
}

/* صف حقول */
.form-row {
    display: flex;
    gap: 14px;
}

.form-row>.form-field {
    flex: 1;
}

/* حقل واحد */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-field label {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-blue);
    margin: 0;
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    word-spacing: 2px;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(1, 113, 239, 0.1);
}

.form-field textarea {
    resize: vertical;
    min-height: 60px;
}

/* جداول النموذج */
.form-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.form-table th {
    background: #edf3fc;
    color: var(--primary-blue);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    border-bottom: 1.5px solid var(--border-light);
}

.form-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f0f3fa;
    vertical-align: middle;
}

.form-table tr:last-child td {
    border-bottom: none;
}

.form-table input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-color);
    text-align: center;
    transition: all 0.2s ease;
    outline: none;
    word-spacing: 2px;
}

.form-table input:focus {
    border-color: var(--primary-blue);
    background: var(--input-bg);
    box-shadow: 0 0 0 2px rgba(1, 113, 239, 0.08);
}

.form-table .row-num {
    color: #8899bb;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    width: 36px;
}

.form-table .del-row-btn {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 4px;
}

.form-table tr:hover .del-row-btn {
    opacity: 1;
}

/* ========================== */
/*  مكون اختيار السور المتعدد */
/* ========================== */

.sura-picker {
    position: relative;
    width: 100%;
    min-width: 140px;
}

.sura-picker-display {
    width: 100%;
    min-height: 34px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-color);
    text-align: right;
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    transition: all 0.2s ease;
    outline: none;
}

.sura-picker-display:hover,
.sura-picker-display.active {
    border-color: var(--primary-blue);
    background: var(--input-bg);
    box-shadow: 0 0 0 2px rgba(1, 113, 239, 0.08);
}

.sura-picker-display .sura-placeholder {
    color: #a0afc8;
    font-size: 13px;
    pointer-events: none;
}

.sura-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--primary-blue), #0060d6);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    animation: tagPop 0.2s ease;
}

@keyframes tagPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.sura-tag .tag-remove {
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    opacity: 0.8;
    margin-right: 2px;
    transition: opacity 0.15s;
}

.sura-tag .tag-remove:hover {
    opacity: 1;
}

.sura-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 450px;
    z-index: 9999;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-height: 85vh;
    display: none;
    flex-direction: column;
    animation: zoomInModal 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomInModal {
    0% {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.96);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.sura-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(1, 113, 239, 0.1);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: none;
    animation: fadeInModal 0.2s ease;
}

.sura-modal-backdrop.open {
    display: block;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sura-dropdown-footer {
    padding: 12px;
    border-top: 1px solid var(--border-light);
    text-align: center;
    background: #f8fbff;
    border-radius: 0 0 12px 12px;
}

.sura-close-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.sura-close-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(1, 113, 239, 0.2);
}

.sura-dropdown.open {
    display: flex;
}

.sura-dropdown .sura-search {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-bottom: 1.5px solid var(--border-light);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-color);
    outline: none;
    background: #f8fbff;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.sura-dropdown .sura-search::placeholder {
    color: #a0afc8;
}

.sura-dropdown .sura-options {
    overflow-y: auto;
    max-height: 400px;
    padding: 4px 0;
}

.sura-dropdown .sura-option {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s ease;
}

.sura-dropdown .sura-option:hover {
    background: #edf3fc;
}

.sura-dropdown .sura-option.selected {
    background: rgba(1, 113, 239, 0.08);
    color: var(--primary-blue);
    font-weight: 700;
}

.sura-dropdown .sura-option .sura-check {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid #c0cfe0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.sura-dropdown .sura-option.selected .sura-check {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
}

.sura-dropdown .sura-no-result {
    padding: 14px;
    text-align: center;
    color: #a0afc8;
    font-size: 13px;
}

/* قوائم النموذج */
.form-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-list-item .list-num {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, var(--primary-blue), #0055cc);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.form-list-item input {
    flex: 1;
    padding: 9px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    word-spacing: 2px;
}

.form-list-item input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(1, 113, 239, 0.1);
}

.form-list-item .del-item-btn {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 4px;
    flex-shrink: 0;
}

.form-list-item:hover .del-item-btn {
    opacity: 1;
}

/* أزرار إضافة */
.add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--primary-blue);
    border: 1.5px dashed var(--primary-blue);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.add-btn:hover {
    background: rgba(1, 113, 239, 0.06);
    border-style: solid;
}

/* زر إنشاء التقرير */
.generate-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0055cc 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.generate-btn:active {
    transform: translateY(0);
}

/* بطاقة الصور */
.file-upload-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-upload-item .upload-label {
    font-size: 13px;
    color: var(--text-color);
    font-weight: 600;
    min-width: 110px;
}

.file-upload-item input[type="file"] {
    font-family: inherit;
    font-size: 12px;
    color: #6b7fa3;
}

/* ========================== */
/*    التقرير (Report Pages)  */
/* ========================== */

#report-wrapper {
    width: var(--w);
    background: transparent;
    display: none;
    /* مخفي بالبداية */
}

#report-wrapper.visible {
    display: block;
}

/* === الصفحة === */

.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;
}

/* === عناوين الأقسام === */
.sec-title-wrapper {
    text-align: center;
    margin: 20px 0 15px;
    position: relative;
}

.sec-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
}

.sec-line-img {
    display: block !important;
    margin: 8px auto 5px !important;
    height: 12px !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* === شبكة البيانات === */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 50px;
    margin-bottom: 30px;
}

.info-item {
    display: flex;
    align-items: center;
}

.info-lbl {
    font-weight: 800;
    color: var(--primary-blue);
    margin-left: 10px;
    font-size: 16px;
}

.info-val {
    flex: 1;
    border-bottom: 2px dashed #b3d7ff;
    text-align: center;
    font-size: 14px;
    color: var(--text-color);
    padding-bottom: 5px;
    font-weight: 400;
    min-height: 22px;
    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;
    font-size: 13px;
    font-weight: 300;
}

.tbl th:first-child,
.tbl td:first-child {
    direction: ltr;
    unicode-bidi: isolate;
}

.tbl td:last-child {
    border-left: none;
}

.tbl tr:last-child td {
    border-bottom: none;
}

/* === القوائم === */
.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;
}

.list-text {
    font-size: 14px;
    color: var(--text-color);
    text-align: right;
    border-bottom: 1px dotted #ccc;
    padding-bottom: 3px;
    flex: 1;
    line-height: 1.8;
}

/* === التوقيعات === */
.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 {
    color: var(--text-color);
    font-weight: 600;
    margin-bottom: 20px;
    display: block;
    font-size: 13px;
}

.sig-name {
    display: block;
    width: 85%;
    margin: 0 auto;
    border-bottom: 1px dotted #8993AD;
    text-align: center;
    color: var(--primary-blue);
    font-family: 'ArslanWessam', sans-serif;
    font-size: 23px;
    padding-bottom: 4px;
    min-height: 30px;
}

/* ========================== */
/*       طباعة / PDF          */
/* ========================== */

@media print {

    body,
    html {
        margin: 0;
        padding: 0;
        height: 100%;
        background: white;
    }

    .form-topbar,
    .form-container {
        display: none !important;
    }

    #report-wrapper {
        display: block !important;
        margin: 0;
        width: 100%;
    }

    .page {
        margin: 0;
        border: none;
        box-shadow: none;
        page-break-after: always;
    }

    .page:last-child {
        page-break-after: auto;
    }
}

/* ========================== */
/*     تحميل / سبينر          */
/* ========================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 31, 100, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent-yellow);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: white;
    font-size: 16px;
    margin-top: 16px;
    font-weight: 600;
}

/* ========================== */
/*       Responsive           */
/* ========================== */

@media (max-width: 600px) {
    .form-container {
        padding: 0 12px 30px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-topbar {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .form-topbar .brand-title {
        font-size: 18px;
    }

    .form-card-body {
        padding: 16px;
    }

    .generate-btn {
        font-size: 15px;
        padding: 14px 20px;
    }
}

/* ==========================================================================
   نظام التنبيهات المنبثقة الحديث (Toaster Notification System)
   ========================================================================== */

#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 48px);
}

.toast {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(1, 113, 239, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.02);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: var(--text-color);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    direction: rtl;
    text-align: right;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.toast::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    border-radius: 0 16px 16px 0;
}

.toast-content-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.toast-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-message {
    word-break: break-word;
}

.toast-close {
    color: #8899bb;
    font-size: 20px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    margin-right: auto;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-color);
    transform: scale(1.15);
}

/* تصنيفات الإشعارات */
.toast-success {
    background: rgba(240, 253, 250, 0.9);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.toast-success::before {
    background: #10b981;
}

.toast-success .toast-close:hover {
    color: #047857;
}

.toast-error {
    background: rgba(254, 242, 242, 0.9);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.toast-error::before {
    background: #ef4444;
}

.toast-error .toast-close:hover {
    color: #b91c1c;
}

.toast-warning {
    background: rgba(255, 251, 235, 0.9);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.toast-warning::before {
    background: #f59e0b;
}

.toast-warning .toast-close:hover {
    color: #b45309;
}

.toast-info {
    background: rgba(239, 246, 255, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.toast-info::before {
    background: #3b82f6;
}

.toast-info .toast-close:hover {
    color: #1d4ed8;
}

/* الحركات */
@keyframes toastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* للهواتف المحمولة الشاشات الصغيرة */
@media (max-width: 480px) {
    #toast-container {
        top: 16px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
    }
}

/* Sura Picker Tabs & Panels */
.sura-tabs {
    display: flex;
    background: #f1f5f9;
    border-bottom: 1px solid #cbd5e1;
    border-radius: 4px 4px 0 0;
}
.sura-tab {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    user-select: none;
}
.sura-tab:hover {
    background: rgba(1, 113, 239, 0.05);
    color: var(--primary-blue);
}
.sura-tab.active {
    background: white;
    color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
}
.sura-panel-range {
    display: none;
    padding: 12px;
    flex-direction: column;
    gap: 8px;
    background: white;
}
.sura-panel-range .sura-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sura-panel-range label {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-blue);
}
.sura-panel-range select {
    width: 100%;
    padding: 6px 10px;
    border: 1.5px solid var(--border-light);
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-color);
    outline: none;
    background: white;
}
.sura-panel-custom {
    display: none;
    padding: 12px;
    background: white;
}
.sura-panel-custom label {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-blue);
    display: block;
    margin-bottom: 6px;
}
.sura-panel-custom input {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border-light);
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-color);
    outline: none;
}

/* Error highlighting */
.error-field {
    border: 2px solid #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
    transition: all 0.3s ease;
}