/* ===================================================
   modal-form.css — Request Modal Component
   Huthaifa Alqeisi Website
   Inherits all CSS custom properties from style.css.
   Supports RTL (Arabic) & LTR (English) via CSS
   logical properties.
   =================================================== */

/* ── Overlay ──────────────────────────────────────── */
.req-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.req-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ── Modal box ────────────────────────────────────── */
.req-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 44px 40px 36px;
  position: relative;
  transform: translateY(28px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.req-modal-overlay.open .req-modal {
  transform: translateY(0) scale(1);
}

/* ── Close button ─────────────────────────────────── */
.req-modal-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 16px;     /* RTL-aware: right in LTR, left in RTL */
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  border-radius: 0;
  font-family: inherit;
  padding: 0;
}

.req-modal-close:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201, 169, 77, 0.06);
}

/* ── Header ───────────────────────────────────────── */
.req-modal-tag {
  display: block;
  font-size: 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}

.req-modal-title {
  color: var(--text);
  margin-bottom: 0;
  line-height: 1.25;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
}

body[dir="ltr"] .req-modal-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
}

body[dir="rtl"] .req-modal-title {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-weight: 700;
}

.req-modal-divider {
  width: 50px;
  height: 2px;
  background: var(--gold);
  margin: 14px 0 22px;
}

/* ── Request-type badge ───────────────────────────── */
.req-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--gold);
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.4px;
  padding: 7px 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.req-type-badge strong {
  color: var(--gold);
}

/* ── Form fields ──────────────────────────────────── */
.req-field {
  margin-bottom: 16px;
}

.req-field label {
  display: block;
  font-size: 0.76rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.req-field-required::after {
  content: ' *';
  color: var(--gold);
}

.req-field input,
.req-field textarea {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}

.req-field input:focus,
.req-field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 77, 0.1);
}

.req-field input.req-error,
.req-field textarea.req-error {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.08);
}

/* ── Phone: country code dropdown + number side by side ────── */
.req-phone-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  direction: ltr;               /* phone numbers always LTR */
}

.req-cc-dropdown {
  position: relative;
}

.req-cc-trigger {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 10px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.25s;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 68px;
  justify-content: space-between;
  white-space: nowrap;
  border-radius: 0;
}

.req-cc-trigger:hover {
  border-color: var(--gold);
}

.req-cc-trigger.open {
  border-color: var(--gold);
}

.req-cc-trigger-text {
  font-weight: 500;
}

.req-cc-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.req-cc-trigger.open .req-cc-arrow {
  transform: rotate(180deg);
}

.req-cc-list {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  z-index: 1001;
  max-height: 220px;
  overflow-y: auto;
  min-width: 220px;
  display: none;
  margin-top: 4px;
  box-shadow: var(--shadow);
  direction: ltr;
}

.req-cc-list.open {
  display: block;
}

.req-cc-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.req-cc-option:last-child {
  border-bottom: none;
}

.req-cc-option:hover {
  background: rgba(201, 169, 77, 0.08);
}

.req-cc-option.selected {
  background: rgba(201, 169, 77, 0.12);
  font-weight: 600;
}

.req-cc-flag {
  font-size: 1.1rem;
  min-width: 1.4em;
}

.req-cc-name {
  flex: 1;
}

.req-cc-code {
  font-weight: 600;
  color: var(--gold);
  min-width: 48px;
  text-align: inset-end;
}

/* ── Inline validation errors ─────────────────────── */
.req-field-error {
  font-size: 0.75rem;
  color: #c0392b;
  margin-top: 5px;
  display: none;
  padding-inline-start: 2px;
  line-height: 1.5;
}

.req-field-error.req-visible {
  display: block;
}

/* ── Textarea ─────────────────────────────────────── */
.req-field textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.65;
}

/* ── Submit button ────────────────────────────────── */
.req-submit-btn {
  width: 100%;
  background: var(--gold);
  color: #0b0b0b;
  border: 1.5px solid var(--gold);
  padding: 14px 20px;
  font-size: 0.78rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, transform 0.2s;
  font-family: inherit;
  margin-top: 8px;
  border-radius: 0;
  display: block;
}

.req-submit-btn:hover:not(:disabled) {
  background: transparent;
  color: var(--gold);
  transform: translateY(-2px);
}

.req-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── Success / error feedback ─────────────────────── */
.req-modal-feedback {
  display: none;
  margin-top: 14px;
  padding: 12px 16px;
  font-size: 0.88rem;
  line-height: 1.65;
  border-inline-start: 3px solid var(--gold);
  background: var(--bg-alt);
}

.req-modal-feedback.req-success {
  display: block;
  border-color: #27ae60;
}

.req-modal-feedback.req-error-msg {
  display: block;
  border-color: #c0392b;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 600px) {
  .req-modal {
    padding: 32px 20px 28px;
  }

  .req-phone-row {
    grid-template-columns: 74px 1fr;
  }
}
