@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&display=swap');
:root{
  font-family: 'Cairo', sans-serif;
  --bg:#072032;
  --card-from:#fdf9f6; --card-to:#f5ede4;
  --border:#e4d8cc;
  --blue:#1a56d6; --blue-glow:rgba(26,86,214,0.14);
  --purple:#7c5cbf; --purple-h:#6b4aad;
  --text:#0d1b2a; --muted:#64748b; --label:#757575;
  --error:#dc2626;
  --rc:22px; --ri:12px; --rb:12px;
  --shadow:0 12px 60px rgba(5,20,40,0.32),0 2px 8px rgba(5,20,40,0.10);
  --tr:0.22s cubic-bezier(0.4,0,0.2,1);
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
html{scroll-behavior:smooth;}
body {
  font-family: var(--fa);
  background: var(--bg); 
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

body.ltr {
  direction: ltr;
  font-family: var(--fe);
}
/* ═══════════════════════════════════════════════════
   NAV 
   RTL: [Alinma logo] .................. [English btn | subtitle]
   LTR: [English btn | subtitle] .... [Alinma logo]
   ═══════════════════════════════════════════════════ */
nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  height: 40px;
  background: transparent;
  border: none;
  width: 100%;
  max-width: 1400px; 
  margin: 25px auto 0; 
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  opacity: 0.95;
  transition: opacity var(--tr);
}
.nav-logo:hover { opacity: 1; }

.nav-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.nav-logo-cert {
  display: flex;
  align-items: center;
  text-decoration: none;
  opacity: 0.95;
  transition: opacity var(--tr);
}
.nav-logo-cert:hover { opacity: 1; }

.nav-logo svg, 
.nav-logo-cert svg {
  height: 55px; 
  width: auto;
  display: block;
}


.lang-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid rgb(255, 255, 255);
  background: transparent;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  font-family: var(--fe);
  transition: var(--tr);
  white-space: nowrap;
}
.lang-btn:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.45);
}

@media (max-width: 640px) {
  nav { padding: 0 16px; height: 80px; }
  .nav-controls { gap: 12px; }
  .nav-logo svg, 
  .nav-logo-cert svg { height: 26px; }
}
/* ═══════════════════════════════════════════════════
   MAIN
   ═══════════════════════════════════════════════════ */
main{
  position:relative;z-index:5;flex:1;
  display:flex;flex-direction:column;align-items:center;
  padding:52px 24px 80px;
}

/* ═══════════════════════════════════════════════════
   CARD 
   ═══════════════════════════════════════════════════ */
.card{
  width:100%;
  max-width:1400px;  
  background: linear-gradient(to right, #ffe0d6 0%, #fffdf9 40%);  
  border-radius:50px;
  margin-left: 50px;
  margin-right: 50px;
  box-shadow:var(--shadow);
  overflow:hidden;
  animation:cardIn 0.5s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes cardIn{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:translateY(0)}}

/* ─── Card Header ─── */
.card-header{
  padding: 30px 40px 10px;
  text-align:right;      
}
body.ltr .card-header{text-align:left;}

.card-title{
  font-size:clamp(40px,3.5vw,34px);
  font-weight:500;
  color:var(--text);
  line-height:1.25;
  margin-bottom:6px;
  text-align:right;
}
body.ltr .card-title{text-align:left;}

/* Required note — right-aligned */
.req-note {
  font-size: 18px;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  margin-top: 6px;
}

.req-note .star {
  color: var(--error);
}

/* ─── Card Form ─── */
.card-form {
  padding: 10px 40px 40px;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 58%; 
  margin-right: 0;
  margin-left: auto;
}

body.ltr .card-form {
  margin-right: auto !important; 
  margin-left: 0 !important;
}
/* ─── Field Group ─── */
.field-group {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 0.38s cubic-bezier(0.22,1,0.36,1), opacity 0.3s ease;
  opacity: 0;
}
.field-group.visible { grid-template-rows: 1fr; opacity: 1; }
.field-group-inner { overflow: hidden; padding-bottom: 16px; }
.field-group.always { grid-template-rows: 1fr; opacity: 1; }

/* ─── Field Wrap (floating label) ─── */
.fw {
  position: relative;
  width: 100%;                
  background: #ffffff; 
  border: 1px solid #f4ecec; 
  border-radius: 12px; 
  height: 70px; 
  transition: border-color var(--tr, 0.3s), box-shadow var(--tr, 0.3s);
}
.fw:focus-within { border-color: var(--blue, #8e8ada); box-shadow: 0 0 0 4px rgba(142,138,218,0.15); }
.fw.err { border-color: var(--error, #e53e3e); box-shadow: 0 0 0 4px rgba(220,38,38,0.10); }

.fw label {
  position: absolute;
  top: 50%; 
  right: 22px; 
  transform: translateY(-50%);
  font-size: 20px; 
  color: var(--label, #777777);
  font-weight: 500;
  pointer-events: none;
  transition: all var(--tr, 0.3s) ease;
  white-space: nowrap;
}
body.ltr .fw label { right: auto; left: 22px; }
.fw label .rs { color: var(--error, #e53e3e); }

.fw select, .fw input, .fw textarea {
  width: 100%;
  height: 100%; 
  padding: 32px 22px 0px 45px; 
  border: none;
  background: transparent;
  font-size: 18px; 
  font-family: inherit;
  color: var(--text, #141b2d);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  border-radius: var(--ri, 12px);
  direction: inherit;
}
body.ltr .fw select, body.ltr .fw input, body.ltr .fw textarea {
  padding: 32px 45px 0px 22px; 
}

.fw select, .fw input { cursor: pointer; }
.fw input { cursor: text; }
.fw textarea { cursor: text; resize: vertical; min-height: 88px; padding-top: 36px; }

.fw .caret {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted, #111);
  pointer-events: none;
  display: flex; 
  align-items: center;
  justify-content: center;
  transition: transform var(--tr, 0.3s);
}
body.ltr .fw .caret { left: auto; right: 22px; }
.fw:focus-within .caret { transform: translateY(-50%) rotate(180deg); }

.fw.hv label,
.fw:focus-within label,
.fw:has(select:valid) label {
  top: 15px; 
  transform: none;
  font-size: 12px; 
  color: var(--blue, #9b9b9b); 
}

.fw:has(select:valid):not(:focus-within) label {
  color: var(--label, #888);
}

.fw.ta label { top: 18px; transform: none; font-size: 12px; color: var(--label, #888); }
.fw.ta:focus-within label, .fw.ta.hv label { color: var(--blue, #8e8ada); }

.ferr { display: none; font-size: 12px; color: var(--error, #e53e3e); margin-top: 4px; padding: 0 4px; animation: sIn 0.2s ease; }
.ferr.vis { display: block; }
@keyframes sIn { from { opacity: 0; transform: translateY(-3px) } to { opacity: 1; transform: translateY(0) } }

.btn-row {
  display: flex;
  justify-content: flex-start; 
  gap: 16px; 
  margin-top: 0px;
}
body.ltr .btn-row {
  justify-content: flex-start;
}

.btn {
  min-width: 140px; 
  height: 52px; 
  font-size: 18px; 
  font-weight: 600; 
  border-radius: 10px; 
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-family: inherit; 
  transition: opacity 0.2s ease;
}

.btn:hover {
  opacity: 0.85; 
}

.btn-p {
  background-color: #8c88d8; 
  color: #111424; 
  border: none;
}

.btn-s {
  background-color: #ffffff;
  color: #111424; 
  border: 1px solid #111424; 
}

.spinner {
  display: none; 
  margin-inline-end: 8px; 
}


/* ═══════════════════════════════════════════════════
   PDF SECTION
   ══════════════════════════════════════════════════ */
.pdf-section{
  display:none;width:100%;max-width:900px;margin-top:24px;
  background:linear-gradient(148deg,var(--card-from) 0%,var(--card-to) 100%);
  border-radius:var(--rc);box-shadow:var(--shadow);overflow:hidden;
  animation:cardIn 0.4s cubic-bezier(0.22,1,0.36,1) both;}
.pdf-section.vis{display:block;}
.pdf-toolbar{display:flex;align-items:center;justify-content:space-between;padding:16px 24px;background:rgba(12,30,55,0.04);border-bottom:1.5px solid var(--border);gap:12px;flex-wrap:wrap;}
.pdf-title{font-size:15px;font-weight:700;color:var(--text);display:flex;align-items:center;gap:8px;}
.pdf-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.pdf-name{font-size:12px;color:var(--muted);background:#fff;border:1px solid var(--border);border-radius:8px;padding:6px 12px;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--fe);}
.pdf-up-lbl{display:inline-flex;align-items:center;gap:7px;padding:9px 20px;border-radius:10px;background:var(--purple);color:#fff;font-size:13px;font-weight:600;font-family:inherit;cursor:pointer;transition:var(--tr);box-shadow:0 3px 12px rgba(124,92,191,0.28);}
.pdf-up-lbl:hover{background:var(--purple-h);transform:translateY(-1px);}
#pdfInput{display:none;}
.pdf-del{display:inline-flex;align-items:center;gap:7px;padding:9px 20px;border-radius:10px;background:#fff;color:var(--error);border:1.5px solid #fcc;font-size:13px;font-weight:600;font-family:inherit;cursor:pointer;transition:var(--tr);}
.pdf-del:hover{background:#fff5f5;border-color:#f99;transform:translateY(-1px);}
.pdf-del:disabled{opacity:0.4;cursor:not-allowed;transform:none;}
.pdf-wrap{width:100%;background:#ddd8d2;min-height:520px;position:relative;}
.pdf-ph{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:520px;gap:16px;color:var(--muted);padding:40px;text-align:center;}
.pdf-ph svg{opacity:0.28;}
.pdf-ph p{font-size:14px;line-height:1.7;}
#pdfFrame{width:100%;height:620px;border:none;display:none;}
#pdfFrame.vis{display:block;}


/* ═══════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════ */
.pdf-controls {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    margin-top: 20px;
    padding: 10px;
}

.btn {
    padding: 10px 30px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-save {
    background-color: transparent;
    border: 2px solid #001f3f; 
    color: #001f3f;
    border-radius: 8px;
}

.btn-save:hover {
    background-color: #f0f4f8; 
}

.btn-print {
    background-color: #001f3f;
    border: 2px solid #001f3f;
    color: white;
    border-radius: 8px;
}

.btn-print:hover {
    background-color: #003366; 
}

/* ═══════════════════════════════════════════════════
   ERROR ALERT
   ═══════════════════════════════════════════════════ */
.error-alert {
  background-color: #fee2e2;
  color: #dc2626;
  padding: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  font-weight: 600;
  font-size: 14px;
}
body.ltr .error-alert { flex-direction: row-reverse; justify-content: flex-end; }

.pdf-section-simple {
  width: 100%;
  margin-top: 30px; 
  border-top: 1px solid #e4d8cc;
  padding-top: 30px;
}
.pdf-h2 {
  color: #072032; font-size: 28px; font-weight: 800; margin-bottom: 20px; text-align: right;
}
body.ltr .pdf-h2 { text-align: left; }
.pdf-frame-container {
  width: 100%; height: auto; border: 1px solid #e4d8cc; border-radius: 6px; overflow: hidden; background: #fff;
}
.pdf-frame-container iframe { width: 100%; height: 100%; border: none; }


/* ═══════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════ */
footer{
  position:relative;z-index:5;
  text-align:center;
  padding:18px 24px 28px;
  font-size:11.5px;
  color:rgb(255, 255, 255);
  font-family:var(--fa);
  line-height:1.8;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  nav {
    max-width: 100% !important; 
    width: 100% !important;
    padding: 12px 16px !important; 
    justify-content: space-between !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    margin-bottom: 0 !important;
  }

  .nav-logo {
    margin-right: 0 !important;
  }

  .nav-controls {
    margin-left: 0 !important;
    gap: 10px !important;
    display: flex !important;
    align-items: center !important;
  }

  .nav-logo img, .nav-logo svg,
  .nav-logo-cert img, .nav-logo-cert svg {
    height: 36px !important; 
    width: auto !important;
  }

  .lang-btn {
    padding: 6px 12px !important;
    font-size: 12px !important;
  }
  .card-form {
        max-width: 100%;
    }
}