/* ============================================================
   Sehaty Mock Services — embedded entity service UI
   Uses CSS variable --brand set by _Layout from the entity color.
   ============================================================ */
:root {
    --brand: #2c3e50;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #e3e6ea;
    --text: #1c2733;
    --muted: #6b7785;
    --ok: #1e8449;
    --warn: #d68910;
    --info: #2874a6;
    --danger: #c0392b;
    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Arabic", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
}
.muted { color: var(--muted); font-size: 13px; }
.en { font-style: italic; opacity: .85; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em;
       background: #eef0f3; padding: 1px 6px; border-radius: 4px; }

.mock-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ========== Header ========== */
.mock-header { color: #fff; padding: 18px 24px; box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.mock-header-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}
.mock-logo { display: flex; align-items: center; gap: 14px; }
.mock-logo-mark {
    width: 48px; height: 48px;
    background: #fff;
    color: var(--brand);
    display: grid; place-items: center;
    font-weight: 700; font-size: 16px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}
.mock-entity-ar { font-size: 17px; font-weight: 600; }
.mock-entity-en { font-size: 12px; opacity: .9; }
.mock-tagline { font-size: 13px; opacity: .9; max-width: 320px; text-align: end; }

/* ========== Main / page ========== */
.mock-main { flex: 1; padding: 28px 24px; }
.mock-page { max-width: 980px; margin: 0 auto; }

.mock-service-header h1 { margin: 0 0 4px; font-size: 24px; font-weight: 600; color: var(--brand); }
.mock-service-subtitle { margin: 0 0 12px; font-style: italic; color: var(--muted); font-size: 15px; }

/* ========== Forms ========== */
.mock-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
}
.mock-form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.mock-form-row label { font-weight: 500; font-size: 13px; }
.mock-form-row input[type=text],
.mock-form-row input[type=date],
.mock-form-row input[type=email],
.mock-form-row input[type=tel],
.mock-form-row select,
.mock-form-row textarea {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}
.mock-form-row input:focus,
.mock-form-row select:focus,
.mock-form-row textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .06);
}
.mock-form-checkbox { flex-direction: row; align-items: flex-start; gap: 12px; }
.mock-form-checkbox input { margin-top: 4px; }
.mock-form-actions {
    display: flex; gap: 12px; margin-top: 24px;
    padding-top: 20px; border-top: 1px solid var(--border);
}

/* ========== Buttons ========== */
.mock-btn {
    display: inline-block;
    padding: 9px 18px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}
.mock-btn:hover { background: #f7f9fb; }
.mock-btn:disabled { opacity: .5; cursor: not-allowed; }
.mock-btn-primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
.mock-btn-primary:hover { filter: brightness(1.07); }

/* ========== Directory / tables ========== */
.mock-directory {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.mock-search-bar {
    display: flex; gap: 8px;
    padding: 16px;
    background: #fafbfc;
    border-bottom: 1px solid var(--border);
}
.mock-search-input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.mock-table-wrap { overflow-x: auto; }
.mock-table { width: 100%; border-collapse: collapse; }
.mock-table th, .mock-table td {
    padding: 12px 16px;
    text-align: start;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 13.5px;
}
.mock-table th {
    background: #fafbfc;
    font-weight: 600;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.mock-table tbody tr:hover { background: #fafbfc; }
.mock-pagination {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-top: 1px solid var(--border);
    background: #fafbfc;
}
.mock-pager { display: flex; gap: 6px; align-items: center; }
.mock-page-current {
    background: var(--brand); color: #fff; padding: 4px 12px;
    border-radius: 6px; font-weight: 600;
}

/* ========== Status card ========== */
.mock-status-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
}
.mock-status-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.mock-status-head h2 { margin: 0; font-size: 18px; }
.mock-status-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.mock-status-badge.ok    { background: #d4edda; color: #155724; }
.mock-status-badge.info  { background: #d1ecf1; color: #0c5460; }
.mock-status-badge.warn  { background: #fff3cd; color: #856404; }
.mock-status-badge.bad   { background: #f8d7da; color: #721c24; }

.mock-status-fields {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 10px 16px;
    margin: 0 0 24px 0;
}
.mock-status-fields dt { font-weight: 600; color: var(--muted); font-size: 13px; }
.mock-status-fields dd { margin: 0; font-size: 14px; }
.mock-status-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ========== Info template ========== */
.mock-info { margin-top: 16px; }
.mock-info-hero {
    background: linear-gradient(135deg, var(--brand) 0%, rgba(0,0,0,.45) 200%);
    color: #fff;
    padding: 28px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.mock-info-hero h2 { margin: 0 0 12px; font-size: 22px; }
.mock-info-hero p { margin: 6px 0; line-height: 1.6; }
.mock-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.mock-info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.mock-info-card h3 { margin: 0 0 14px; font-size: 15px; color: var(--brand); }
.mock-info-card ul { margin: 0; padding-inline-start: 18px; }
.mock-info-card li { margin-bottom: 8px; }
.mock-info-card a { color: var(--brand); text-decoration: none; }
.mock-info-card a:hover { text-decoration: underline; }
.mock-kpi-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.mock-kpi-list > div {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px; border-radius: 6px;
    background: #fafbfc;
}
.kpi-num { font-size: 20px; font-weight: 700; color: var(--brand); }
.kpi-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mock-timeline { list-style: none; padding: 0; margin: 0; }
.mock-timeline li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13px;
}
.mock-timeline li:last-child { border-bottom: 0; }
.mock-timeline strong { color: var(--brand); }

/* ========== Submission confirmation ========== */
.mock-submitted {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.mock-check {
    width: 72px; height: 72px;
    background: var(--ok);
    color: #fff;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 40px;
    margin: 0 auto 18px;
}
.mock-submitted h1 { margin: 6px 0; font-size: 22px; color: var(--ok); }
.mock-submitted h2 { margin: 0 0 18px; font-size: 16px; color: var(--muted); font-weight: 400; }
.mock-submitted .mock-status-fields { max-width: 540px; margin: 0 auto 24px; text-align: start; }
.mock-submitted .mock-form-actions { justify-content: center; border: 0; padding-top: 0; }

/* ========== Index landing page ========== */
.mock-page h1 { margin: 0 0 8px; font-size: 26px; }
.lead { font-size: 15px; line-height: 1.6; color: var(--muted); max-width: 760px; }
.mock-entity-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-inline-start: 4px solid #ccc;
    border-radius: var(--radius);
    padding: 20px 24px;
    margin: 20px 0;
    box-shadow: var(--shadow-sm);
}
.mock-entity-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.mock-entity-mark {
    width: 44px; height: 44px;
    color: #fff;
    border-radius: 8px;
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 13px;
}
.mock-entity-head h2 { margin: 0; font-size: 17px; }
.mock-entity-head p { margin: 2px 0 0; font-size: 12px; }
.mock-service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.mock-service-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 14px;
    text-decoration: none;
    color: var(--text);
    background: #fafbfc;
    display: flex; flex-direction: column; gap: 3px;
}
.mock-service-card:hover { background: #f0f3f7; border-color: #c4cad2; }
.mock-service-template {
    align-self: flex-end;
    background: var(--brand); color: #fff;
    font-size: 10px; padding: 2px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.mock-service-name-en { font-size: 13px; font-weight: 600; }
.mock-service-name-ar { font-size: 13px; color: var(--muted); }
.mock-service-card code { align-self: flex-start; margin-top: 4px; font-size: 11px; }

/* ========== Footer ========== */
.mock-footer {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 16px 24px;
    font-size: 12px;
    text-align: center;
    line-height: 1.7;
}

/* ========== Responsive ========== */
@media (max-width: 700px) {
    .mock-status-fields { grid-template-columns: 1fr; }
    .mock-status-fields dt { padding-top: 8px; }
    .mock-tagline { text-align: start; }
    .mock-kpi-list { grid-template-columns: 1fr; }
}

/* ============================================================
   Authenticated-user UI
   ============================================================ */
.mock-user-chip {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 24px;
    padding: 4px 6px 4px 14px;
    color: #fff;
}
.mock-user-chip-avatar {
    width: 32px; height: 32px;
    background: #fff;
    color: var(--brand);
    border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 700; font-size: 13px;
}
.mock-user-chip-text { display: flex; flex-direction: column; }
.mock-user-chip-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.mock-user-chip-meta { font-size: 11px; opacity: .85; line-height: 1.2; }
.mock-user-chip-form button {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
    width: 28px; height: 28px;
    cursor: pointer;
    font-size: 13px;
}
.mock-user-chip-form button:hover { background: rgba(255, 255, 255, .15); }

.mock-identity-bar {
    background: linear-gradient(135deg, rgba(30, 132, 73, .08), rgba(30, 132, 73, .02));
    border-bottom: 1px solid #d0e8d8;
}
.mock-identity-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; }
.mock-identity-title {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 13px; margin-bottom: 10px;
}
.mock-identity-title strong { color: var(--ok); }
.mock-identity-icon { font-size: 16px; }
.mock-identity-sub { color: var(--muted); font-size: 12px; }
.mock-identity-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 6px 18px;
    margin: 0;
}
.mock-identity-field { display: flex; flex-direction: column; padding: 0; }
.mock-identity-field dt {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.mock-identity-field dd {
    font-size: 13.5px;
    color: var(--text);
    margin: 0;
    font-weight: 500;
}
.mock-identity-field dt .muted { font-weight: 400; text-transform: none; }

.locked-badge {
    display: inline-block;
    background: #e8f5ee;
    color: var(--ok);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 6px;
    margin-inline-start: 6px;
    font-weight: 500;
    letter-spacing: .03em;
}
input[readonly], textarea[readonly] {
    background: #f1f4f7 !important;
    color: var(--muted) !important;
    cursor: not-allowed;
}
.mock-form-divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* Ticket rejected / not authenticated */
.mock-ticket-error {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    max-width: 620px;
    margin: 24px auto;
}
.mock-ticket-error-icon {
    font-size: 56px;
    margin-bottom: 14px;
}
.mock-ticket-error h1 { margin: 6px 0; font-size: 22px; color: var(--danger); }
.mock-ticket-error h2 { margin: 0 0 18px; font-size: 16px; color: var(--muted); font-weight: 400; }
.mock-ticket-error-reason {
    background: #fef0ef;
    border: 1px solid #f5c6c2;
    color: #722;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 18px auto;
    max-width: 480px;
    text-align: start;
    font-size: 13px;
}

/* ============================================================
   Embed mode — hide the mock's own chrome so the embedded
   service looks like a native part of the host portal.
   The .is-embedded class is set on <html> by the inline script
   in the layout BEFORE the stylesheet loads, so there's no
   flash of unstyled header/footer.
   ============================================================ */
html.is-embedded,
html.is-embedded body { background: transparent; }

html.is-embedded .mock-header,
html.is-embedded .mock-footer { display: none !important; }

/* The identity bar is hidden by default in embed mode, but you can
   uncomment the line below if you want it visible inside the iframe
   for debugging.                                                   */
html.is-embedded .mock-identity-bar { display: none !important; }

html.is-embedded .mock-main { padding: 16px 22px 22px; }
html.is-embedded .mock-shell { min-height: 0; }
html.is-embedded .mock-page  { max-width: none; }

/* Hide scrollbars in embed mode — the parent iframe will be sized
   to our content height so internal scrolling is unnecessary.    */
html.is-embedded, html.is-embedded body {
    overflow: hidden;
}
