/**
 * Mishkat Recruitment — frontend styles.
 * Scoped to .mishkat-* to avoid theme conflicts.
 * RTL-aware via logical properties (margin-inline, padding-inline, text-align: start).
 */

/* ===== Primitives ===== */
.mishkat-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #2271b1;
    color: #fff;
    border: 1px solid #2271b1;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    text-decoration: none;
    transition: background .15s ease, transform .1s ease;
    line-height: 1.4;
}
.mishkat-btn:hover { background: #135e96; border-color: #135e96; color: #fff; }
.mishkat-btn:active { transform: translateY(1px); }
.mishkat-btn:disabled { opacity: .65; cursor: not-allowed; transform: none; }
.mishkat-btn--primary { background: #16a34a; border-color: #16a34a; }
.mishkat-btn--primary:hover { background: #15803d; border-color: #15803d; }
.mishkat-btn--outline { background: transparent; color: #2271b1; }
.mishkat-btn--outline:hover { background: #2271b1; color: #fff; }

.mishkat-pill {
    display: inline-block;
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 999px;
    font-size: 13px;
    color: #334155;
    margin-inline-end: 6px;
    margin-block-end: 6px;
}
.mishkat-pill--featured {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

.mishkat-empty {
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 6px;
}

/* ===== Spinner (used inside the submit button) ===== */
.mishkat-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mishkat-spin .8s linear infinite;
    margin-inline-end: 8px;
    vertical-align: middle;
}
@keyframes mishkat-spin { to { transform: rotate(360deg); } }

/* ===== Jobs list ===== */
.mishkat-jobs__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 6px;
}
.mishkat-jobs__filters input[type="search"],
.mishkat-jobs__filters select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    flex: 1 1 180px;
    font-family: inherit;
}
.mishkat-jobs__filters input[type="search"]:focus,
.mishkat-jobs__filters select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,.15);
}

.mishkat-jobs__list { list-style: none; margin: 0; padding: 0; }
.mishkat-job-card {
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
    transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.mishkat-job-card:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
    transform: translateY(-1px);
}
.mishkat-job-card__title { margin: 0 0 8px; font-size: 18px; }
.mishkat-job-card__title a { color: #111827; text-decoration: none; }
.mishkat-job-card__title a:hover { color: #2271b1; }
.mishkat-job-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 10px;
}
.mishkat-job-card__excerpt { color: #4b5563; margin-bottom: 12px; line-height: 1.6; }

.mishkat-jobs__pagination { margin-top: 24px; text-align: center; }
.mishkat-jobs__pagination .page-numbers {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    text-decoration: none;
    color: #374151;
}
.mishkat-jobs__pagination .page-numbers.current {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

/* ===== Job details ===== */
.mishkat-job-detail__header {
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}
.mishkat-job-detail__header h1 { margin: 0 0 16px; font-size: 28px; }
.mishkat-job-detail__meta { margin-bottom: 12px; }
.mishkat-job-detail__expiry { color: #dc2626; font-size: 14px; margin: 0; }
.mishkat-job-detail__body {
    line-height: 1.8;
    color: #374151;
    margin-bottom: 32px;
}
.mishkat-job-detail__body h2,
.mishkat-job-detail__body h3 { margin-top: 24px; }

/* ===== Apply form ===== */
.mishkat-apply {
    background: #f9fafb;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.mishkat-apply h2 { margin: 0 0 20px; font-size: 20px; color: #111827; }

/* Honeypot — moved off-screen (display:none would be skipped by some bots) */
.mishkat-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.mishkat-field { margin-bottom: 16px; }
.mishkat-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}
.mishkat-field .req { color: #dc2626; margin-inline-start: 2px; }
.mishkat-field input[type="text"],
.mishkat-field input[type="email"],
.mishkat-field input[type="tel"],
.mishkat-field input[type="url"],
.mishkat-field input[type="number"],
.mishkat-field input[type="file"],
.mishkat-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    background: #fff;
    color: #111827;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.mishkat-field input:focus,
.mishkat-field textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,.15);
}
.mishkat-field small {
    display: block;
    margin-top: 4px;
    color: #6b7280;
    font-size: 12px;
}

/* Per-field error state */
.mishkat-field--error input,
.mishkat-field--error textarea,
.mishkat-field--error select {
    border-color: #dc2626 !important;
    background: #fef2f2;
}
.mishkat-field--error input:focus,
.mishkat-field--error textarea:focus {
    box-shadow: 0 0 0 3px rgba(220,38,38,.15) !important;
}
.mishkat-field-error {
    margin-top: 6px;
    color: #dc2626;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mishkat-field-error::before { content: '⚠'; font-size: 14px; }

/* File picker preview chip */
.mishkat-file-preview {
    margin-top: 8px;
    padding: 10px 12px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #065f46;
}
.mishkat-file-preview__icon { font-size: 18px; }
.mishkat-file-preview__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.mishkat-file-preview__size { color: #047857; font-variant-numeric: tabular-nums; }

.mishkat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 600px) {
    .mishkat-row { grid-template-columns: 1fr; }
    .mishkat-apply { padding: 16px; }
    .mishkat-job-detail__header h1 { font-size: 22px; }
}

.mishkat-consent {
    padding: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}
.mishkat-consent label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: normal;
    cursor: pointer;
    line-height: 1.5;
}
.mishkat-consent input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; }

.mishkat-submit-row { margin-top: 20px; text-align: start; }
.mishkat-submit-row .mishkat-btn {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    min-width: 180px;
}

.mishkat-apply__message {
    margin-top: 16px;
    padding: 0;
    border-radius: 4px;
    outline: none;
}
.mishkat-apply__message:focus { outline: 2px solid #2271b1; outline-offset: 2px; }
.mishkat-apply__message--success {
    padding: 14px 16px;
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    font-weight: 500;
}
.mishkat-apply__message--error {
    padding: 14px 16px;
    background: #fee2e2;
    color: #7f1d1d;
    border: 1px solid #fecaca;
    font-weight: 500;
}

/* ===== RTL polish =====
 * Most layout already uses logical properties. These rules cover the
 * few cases where direction-specific tweaks help (e.g. file inputs and
 * pagination alignment in Arabic).
 */
[dir="rtl"] .mishkat-spinner { margin-inline-end: 0; margin-inline-start: 8px; }
[dir="rtl"] .mishkat-field-error::before { content: '⚠'; }
[dir="rtl"] .mishkat-file-preview { text-align: right; }

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    .mishkat-spinner { animation-duration: 2s; }
    .mishkat-job-card,
    .mishkat-btn,
    .mishkat-field input,
    .mishkat-field textarea { transition: none; }
}
