/* ── Certificates Manager Frontend CSS ── */

/* ===== SEARCH PAGE ===== */
.cert-search-wrap { direction: rtl; font-family: 'Segoe UI', Tahoma, Arial, sans-serif; max-width: 700px; margin: 0 auto; }

.cert-search-hero {
  background: linear-gradient(135deg, #1a3a6b 0%, #0f6e56 100%);
  border-radius: 16px; padding: 48px 32px; text-align: center; margin-bottom: 28px; color: #fff;
}
.cert-search-hero h2 { font-size: 28px; margin: 0 0 8px; font-weight: 700; }
.cert-search-hero p  { font-size: 15px; margin: 0 0 24px; opacity: .85; }

.cert-search-box { display: flex; gap: 0; max-width: 460px; margin: 0 auto; border-radius: 10px; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.2); }
.cert-search-box input {
  flex: 1; padding: 14px 18px; font-size: 17px; font-family: monospace; letter-spacing: 3px;
  border: none; outline: none; text-align: center; text-transform: uppercase; color: #1a1a1a;
}
.cert-search-box button {
  padding: 14px 22px; background: #e67e22; color: #fff; border: none; cursor: pointer;
  font-size: 15px; font-weight: 700; transition: background .15s;
}
.cert-search-box button:hover { background: #d35400; }

#cert-search-status { min-height: 28px; margin-top: 14px; font-size: 14px; }
.cert-status-loading { opacity: .7; animation: pulse 1s infinite; }
.cert-status-error   { color: #ff7675; font-weight: 600; }
@keyframes pulse { 0%,100%{opacity:.7} 50%{opacity:1} }

/* ── Result card with logo background ── */
.cert-result-card {
  background: #fff; border-radius: 14px; box-shadow: 0 4px 24px rgba(0,0,0,.1);
  padding: 28px 28px 24px; direction: rtl;
  position: relative; overflow: hidden;
}
/* Logo watermark */
.cert-result-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('https://2013.quran-bayan.com/wp-content/uploads/2026/04/cropped-cropped-WhatsApp-Image-2024-11-07-at-4.27.19-PMV.webp');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 55%;
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}
.cert-result-card > * { position: relative; z-index: 1; }

.cert-result-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #e8f8f0; color: #1a7a3c; border: 1px solid #a7e0be;
  border-radius: 20px; padding: 5px 14px; font-size: 13px; font-weight: 700; margin-bottom: 16px;
}
.cert-result-name-ar { font-size: 24px; font-weight: 700; color: #1a1a1a; margin-bottom: 2px; }
.cert-result-name-en { font-size: 15px; color: #666; margin-bottom: 20px; }

.cert-info-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.cert-info-table td { padding: 9px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.cert-info-table td:first-child { color: #888; width: 160px; }
.cert-info-table td:last-child  { font-weight: 600; color: #1a1a1a; }
.cert-info-table tr:last-child td { border-bottom: none; }

.cert-code-display { font-family: monospace; font-size: 18px; letter-spacing: 3px;
  background: #f5f5f5; padding: 4px 10px; border-radius: 5px; }

.cert-programs-list { margin-bottom: 20px; }
.cert-programs-list h4 { font-size: 13px; color: #888; margin: 0 0 8px; }
.cert-prog-tag {
  display: inline-block; background: #e8f3fc; color: #1a5a9e; border: 1px solid #b3d4f0;
  border-radius: 6px; padding: 5px 12px; font-size: 13px; margin: 3px; line-height: 1.4;
}

.cert-download-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: #1a3a6b; color: #fff; border: none; border-radius: 10px;
  padding: 14px 26px; font-size: 15px; font-weight: 700; cursor: pointer;
  text-decoration: none; transition: background .15s; width: 100%; justify-content: center;
}
.cert-download-btn:hover { background: #0f2a55; color: #fff; }
.cert-no-pdf { text-align: center; padding: 12px; background: #f9f9f9;
  border-radius: 8px; color: #999; font-size: 13px; }

/* ===== BILINGUAL LABELS ===== */
.lbl-ar { display: block; font-weight: 700; color: #1a1a1a; font-size: 13px; }
.lbl-en { display: block; font-weight: 400; color: #888; font-size: 11px; margin-top: 1px; }

/* ===== PROGRAMS TAGS INPUT ===== */
.programs-input-wrap,
.cert-programs-input-wrap {
  border: 1.5px solid #ddd; border-radius: 8px; background: #fafafa; padding: 8px 10px;
  transition: border .12s;
}
.programs-input-wrap:focus-within,
.cert-programs-input-wrap:focus-within { border-color: #1a3a6b; background: #fff; }

.programs-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; min-height: 0; }

.prog-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: #e8f0fb; color: #1a3a6b; border: 1px solid #b3c9f0;
  border-radius: 20px; padding: 4px 10px 4px 8px; font-size: 13px; line-height: 1.3;
}
.prog-tag-remove {
  background: none; border: none; cursor: pointer; color: #1a3a6b; font-size: 15px;
  padding: 0; line-height: 1; opacity: .6; transition: opacity .1s;
}
.prog-tag-remove:hover { opacity: 1; }

.programs-add-row { display: flex; gap: 8px; align-items: center; }
.prog-text-field {
  flex: 1; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px;
  font-size: 13px; outline: none; background: #fff;
}
.prog-text-field:focus { border-color: #1a3a6b; }
.prog-add-btn {
  padding: 8px 14px; background: #1a3a6b; color: #fff; border: none; border-radius: 6px;
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background .12s;
}
.prog-add-btn:hover { background: #0f2a55; }

.cert-field-hint { font-size: 11px; color: #999; margin: 5px 0 0; line-height: 1.5; }

/* ===== LOGIN FORM ===== */
.cert-login-wrap { direction: rtl; display: flex; justify-content: center; padding: 40px 16px; }
.cert-login-box  { background: #fff; border-radius: 14px; box-shadow: 0 6px 32px rgba(0,0,0,.1);
  padding: 40px 36px; text-align: center; max-width: 380px; width: 100%; }
.cert-login-icon { font-size: 40px; margin-bottom: 12px; }
.cert-login-box h2 { font-size: 20px; margin: 0 0 6px; color: #1a1a1a; }
.cert-login-box p  { color: #888; font-size: 14px; margin-bottom: 24px; }
.cert-login-form { display: flex; flex-direction: column; gap: 12px; }
.cert-login-form input[type="password"] {
  padding: 11px 14px; border: 1.5px solid #ddd; border-radius: 8px; font-size: 15px;
  text-align: center; outline: none; direction: ltr;
}
.cert-login-form input:focus { border-color: #1a3a6b; }
.cert-login-form button {
  padding: 11px; background: #1a3a6b; color: #fff; border: none; border-radius: 8px;
  font-size: 15px; font-weight: 700; cursor: pointer; transition: background .15s;
}
.cert-login-form button:hover { background: #0f2a55; }
.cert-front-error { background: #fce8e8; color: #c62828; border: 1px solid #f5c6c6;
  border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; text-align: center; }

/* ===== ENTRY FORM ===== */
.cert-entry-wrap { direction: rtl; max-width: 860px; margin: 0 auto;
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif; }
.cert-entry-header { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; padding-bottom: 14px; border-bottom: 2px solid #e8e8e8; }
.cert-entry-header h2 { margin: 0; font-size: 20px; color: #1a1a1a; }
.cert-logout-btn { background: none; border: 1px solid #ccc; border-radius: 6px;
  padding: 6px 14px; cursor: pointer; font-size: 13px; color: #666; }

.cert-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.cert-field { margin-bottom: 16px; }
.cert-field label { display: block; margin-bottom: 5px; }
.cert-field input[type="text"],
.cert-field input[type="date"] {
  width: 100%; padding: 10px 12px; border: 1.5px solid #ddd; border-radius: 8px;
  font-size: 14px; direction: rtl; background: #fafafa; transition: border .12s; box-sizing: border-box;
}
.cert-field input:focus { border-color: #1a3a6b; background: #fff; outline: none; }
.cert-code-input { font-family: monospace; letter-spacing: 2px; text-transform: uppercase; }

.cert-file-upload { position: relative; border: 2px dashed #ccc; border-radius: 10px;
  padding: 24px; text-align: center; cursor: pointer; transition: all .15s; background: #fafafa; }
.cert-file-upload:hover { border-color: #1a3a6b; background: #f0f4ff; }
.cert-file-upload.has-file { border-color: #1a7a3c; background: #f0faf4; border-style: solid; }
.cert-file-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.cert-file-label { pointer-events: none; }
.cert-file-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.cert-file-label span { display: block; font-size: 14px; color: #555; }
.cert-file-label small { color: #999; font-size: 12px; }

.cert-form-actions { display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end; }
.cert-submit-btn { background: #1a3a6b; color: #fff; border: none; border-radius: 9px;
  padding: 12px 30px; font-size: 15px; font-weight: 700; cursor: pointer; transition: background .15s; }
.cert-submit-btn:hover { background: #0f2a55; }
.cert-submit-btn:disabled { opacity: .6; cursor: not-allowed; }
.cert-reset-btn { background: none; border: 1.5px solid #ccc; border-radius: 9px;
  padding: 12px 20px; font-size: 14px; cursor: pointer; color: #666; }

#cert-entry-alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.cert-alert-success { background: #e8f8f0; color: #1a7a3c; border: 1px solid #a7e0be; }
.cert-alert-error   { background: #fce8e8; color: #c62828; border: 1px solid #f5c6c6; }

@media (max-width: 600px) {
  .cert-form-grid { grid-template-columns: 1fr; }
  .cert-search-box { flex-direction: column; border-radius: 10px; }
  .cert-search-box input, .cert-search-box button { border-radius: 0; }
  .programs-add-row { flex-direction: column; }
}

/* ══════════════════════════════════════
   TRAINEE TYPE TABS — Front End
══════════════════════════════════════ */
.cert-type-tabs-front {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.cert-type-tab-front {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border: 2px solid #ddd;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all .2s;
    color: #555;
}
.cert-type-tab-front:hover {
    border-color: var(--cert-primary, #1a6e9e);
    color: var(--cert-primary, #1a6e9e);
    background: #f0f7fc;
}
.cert-type-tab-front.active {
    border-color: var(--cert-primary, #1a6e9e);
    background: var(--cert-primary, #1a6e9e);
    color: #fff;
}

/* ══════════════════════════════════════
   COMPANY NAMES — Front End
══════════════════════════════════════ */
.cert-company-names-wrap {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    background: #fafafa;
}
.company-names-tags {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}
.company-name-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #c3d4e5;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
}
.company-name-tag .cn-label {
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}
.company-name-tag .cn-label small {
    color: #888;
    font-size: 12px;
}
.company-name-tag .prog-tag-remove {
    background: none;
    border: none;
    color: #c00;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}
.company-name-add-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.comp-name-field {
    flex: 1;
    min-width: 140px;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* ── v4: Action row (PDF + QR) ── */
.cert-action-row {
  display: flex; align-items: flex-start; gap: 16px; margin-top: 16px;
}
.cert-pdf-wrap { flex: 1; }
.cert-qr-wrap  { flex-shrink: 0; text-align: center; }
.cert-qr-label { font-size: 10px; color: #aaa; margin-top: 4px; }

/* ── Company names list ── */
.cert-company-list { margin: 12px 0 16px; }
.cert-company-list h4 { font-size: 12px; color: #888; margin: 0 0 8px; font-weight: 600; text-transform: uppercase; letter-spacing:.4px; }
.cert-company-item {
  display: flex; flex-direction: column; padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0; font-size: 13px;
}
.cert-company-item span { font-weight: 600; }
.cert-company-item small { color: #888; font-size: 11px; }

/* ── Mobile fixes ── */
@media (max-width: 480px) {
  .cert-action-row { flex-direction: column; }
  .cert-qr-wrap { align-self: center; }
  .cert-result-name-ar { font-size: 19px; }
  .cert-download-btn { font-size: 14px; padding: 12px 16px; }
  .cert-search-hero { padding: 32px 18px; }
  .cert-search-hero h2 { font-size: 20px; }
}

/* ══════════════════════════════════════
   BULK PASTE — Front-end
══════════════════════════════════════ */
.cert-bulk-toggle-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    background: #eaf4fb;
    border: 1.5px dashed #1a6e9e;
    color: #1a6e9e;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all .15s;
    font-family: inherit;
}
.cert-bulk-toggle-btn:hover {
    background: #d5e9f5;
    border-style: solid;
}
.cert-bulk-paste-area {
    margin-top: 12px;
    padding: 16px;
    background: #fff;
    border: 2px solid #1a6e9e;
    border-radius: 10px;
}
.cert-bulk-instructions {
    background: #f6f9fc;
    border: 1px solid #e1e8ee;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.8;
    color: #444;
}
.cert-bulk-instructions code {
    background: #fff;
    border: 1px solid #ddd;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 12px;
    color: #c7254e;
    margin: 0 2px;
    display: inline-block;
    font-family: monospace;
}
.cert-bulk-instructions small {
    color: #666;
    display: block;
    margin-top: 8px;
    line-height: 1.9;
}
.cert-bulk-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.7;
    resize: vertical;
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
    background: #fafbfc;
}
.cert-bulk-textarea:focus {
    border-color: #1a6e9e;
    box-shadow: 0 0 0 2px rgba(26,110,158,.15);
    outline: none;
    background: #fff;
}
.cert-bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.cert-bulk-add-btn {
    padding: 10px 18px;
    background: #1a6e9e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}
.cert-bulk-add-btn:hover { background: #155680; }
.cert-bulk-clear-btn {
    padding: 10px 18px;
    background: #f0f0f0;
    color: #555;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}
.cert-bulk-clear-btn:hover { background: #e0e0e0; }
.cert-bulk-feedback {
    flex: 1;
    min-width: 200px;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    background: #f0f9f0;
    border: 1px solid #c3e6c3;
    border-radius: 6px;
    color: #2a6e2a;
}
