/* نافذة التوقيع المشتركة — مطابقة sign_pdf.php */
:root { --itq-accent: #000000; --itq-primary: #000000; }

.itq-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.itq-modal-overlay.active { display: flex; }
.itq-modal {
    background: #fff;
    border-radius: 14px;
    max-width: 720px;
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
    animation: itqSigIn 0.22s ease-out;
}
.itq-modal.lg { max-width: 880px; }
@keyframes itqSigIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.itq-modal-header {
    background: #1a1a1a;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.itq-modal-header h4 { margin: 0; font-size: 18px; font-weight: 800; }
.itq-modal-close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
}
.itq-modal-close:hover { opacity: 1; }
.itq-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.itq-modal-footer {
    padding: 14px 20px;
    background: #fafafa;
    border-top: 1px solid #ececec;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.btn-itq-primary {
    background: var(--itq-accent);
    color: #fff;
    border: 0;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}
.btn-itq-primary:hover { background: #222; color: #fff; }
.btn-itq-secondary {
    background: #fff;
    color: #333;
    border: 1.5px solid #ddd;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}
.btn-itq-secondary:hover { background: #f7f7f9; }

.itq-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #ececec;
    margin-bottom: 16px;
}
.itq-tab {
    background: transparent;
    border: 0;
    padding: 12px 18px;
    font-weight: 700;
    font-size: 14px;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.itq-tab.active {
    color: var(--itq-primary);
    border-bottom-color: var(--itq-accent);
}
.itq-tab-pane { display: none; }
.itq-tab-pane.active { display: block; }

.sig-meta-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 2px solid #ececec;
    margin: -4px 0 16px;
}
.sig-meta-tab {
    flex: 1 1 auto;
    background: transparent;
    border: 0;
    padding: 12px 14px;
    font-weight: 700;
    font-size: 14px;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}
.sig-meta-tab.active { color: #1565c0; border-bottom-color: #1565c0; }

.signature-fonts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.signature-fonts .sig-font-subtitle { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: #444; margin-bottom: 4px; }
.sig-font-pick {
    border: 1.5px solid #e5e5e8;
    border-radius: 8px;
    padding: 10px 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sig-font-pick:hover { border-color: #b8b8b8; }
.sig-font-pick.active { border-color: var(--itq-accent); background: #f5f5f5; }
.sig-font-pick .preview {
    font-size: 26px;
    line-height: 1.35;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}
.ff-caveat   { font-family: 'Caveat', cursive; }
.ff-dancing  { font-family: 'Dancing Script', cursive; }
.ff-greatv   { font-family: 'Great Vibes', cursive; }
.ff-homemade { font-family: 'Homemade Apple', cursive; }
.ff-marck    { font-family: 'Marck Script', cursive; }
.ff-pacifico { font-family: 'Pacifico', cursive; }
.ff-sacram   { font-family: 'Sacramento', cursive; }
.ff-satisfy  { font-family: 'Satisfy', cursive; }
.ff-shadows  { font-family: 'Shadows Into Light', cursive; }
.ff-yellow   { font-family: 'Yellowtail', cursive; }
.ff-ar-amiri   { font-family: 'Amiri', serif; }
.ff-ar-cairo   { font-family: 'Cairo', sans-serif; }
.ff-ar-tajwal  { font-family: 'Tajawal', sans-serif; }
.ff-ar-messiri { font-family: 'El Messiri', sans-serif; }
.ff-ar-reem    { font-family: 'Reem Kufi Ink', sans-serif; }
.ff-ar-lemon   { font-family: 'Lemonada', cursive; }
.ff-ar-lalezar { font-family: 'Lalezar', system-ui; }
.ff-ar-aref    { font-family: 'Aref Ruqaa', serif; }
.sig-font-pick .preview.ff-homemade { font-size: 22px !important; }
.sig-font-pick .preview.ff-ar-lemon { font-size: 22px !important; }
.signature-fonts-ar { margin-top: 12px; }

.color-picker-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 13px;
    color: #444;
}
.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .15s ease;
    flex-shrink: 0;
}
.color-dot:hover { transform: scale(1.1); }
.color-dot.active { border-color: #111; transform: scale(1.15); }

.draw-board {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #fff;
    width: min(340px, calc(100% - 24px), min(calc(92vw - 32px), 62vh));
    max-width: 100%;
    aspect-ratio: 5 / 4;
    height: auto;
    margin-inline: auto;
    overflow: hidden;
    box-sizing: border-box;
}
.draw-board canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}
.draw-board .placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 15px;
    pointer-events: none;
    text-align: center;
    padding: 12px;
}
.draw-board.has-content .placeholder { display: none; }
.draw-board .clear-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    background: #fff;
    border: 1px solid #e5e5e8;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
}
.draw-board .clear-btn:hover { color: var(--itq-accent); border-color: var(--itq-accent); }

.upload-sig-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    background: #fff;
    position: relative;
    min-height: 200px;
}
.upload-sig-zone.dragover { border-color: var(--itq-accent); background: #f5f5f5; }
.upload-sig-zone .preview-img {
    max-width: 100%;
    max-height: 160px;
    display: none;
    margin: 0 auto;
}
.upload-sig-zone.has-image .upload-prompt { display: none; }
.upload-sig-zone.has-image .preview-img { display: block; }
.upload-sig-zone input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Bootstrap-lite for modal form rows (sign_invitation.php) */
.itq-modal-body .row { display: flex; flex-wrap: wrap; margin: 0 -8px 12px; }
.itq-modal-body .col-md-8 { flex: 1 1 60%; min-width: 180px; padding: 0 8px; }
.itq-modal-body .col-md-4 { flex: 1 1 35%; min-width: 100px; padding: 0 8px; }
.itq-modal-body .form-label { display: block; margin-bottom: 4px; font-size: 13px; }
.itq-modal-body .form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}
.itq-modal-body .form-control-sm { padding: 6px 10px; font-size: 13px; }
.itq-modal-body .mb-3 { margin-bottom: 12px; }
.itq-modal-body .d-flex { display: flex; }
.itq-modal-body .flex-wrap { flex-wrap: wrap; }
.itq-modal-body .align-items-center { align-items: center; }
.itq-modal-body .gap-2 { gap: 8px; }
.itq-modal-body .mt-1 { margin-top: 4px; }
.itq-modal-body .mt-2 { margin-top: 8px; }
.itq-modal-body .mb-2 { margin-bottom: 8px; }
.itq-modal-body .small { font-size: 13px; }
.itq-modal-body .fw-bold { font-weight: 700; }
.itq-modal-body .text-muted { color: #6b7280; }
