/* Copyright (c) Zhmara X. All rights reserved.
   Proprietary and confidential. Unauthorized copying of this file, via any medium, is prohibited. See LICENSE.txt. */

/* portal.zhmarax.com: the same Zhmara X look as auth (copied, apps share no code) (navy header like the website's Home hero, orange main button).
   Logical properties (inline-start/end) so the same rules work for Arabic and Kurdish (right to left). */

:root {
    --zx-navy: #0d1523;
    --zx-navy-2: #18243a;
    --zx-orange: #f68d0b;
    --zx-orange-dark: #d97706;
    --zx-blue: #2f6fd6;
    --zx-text: #1d2433;
    --zx-muted: #5b6475;
    --zx-line: #dde2ea;
    --zx-page: #f2f4f8;
    --zx-white: #ffffff;
    --zx-ok: #12805c;
    --zx-ok-bg: #e7f6ef;
    --zx-error: #c62828;
    --zx-error-bg: #fdecec;
    --zx-warn: #8a5a00;
    --zx-warn-bg: #fff4dd;
    --zx-radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--zx-page);
    color: var(--zx-text);
    font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

a { color: var(--zx-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 .4rem; color: var(--zx-navy); }
h2 { font-size: 1.1rem; margin: 0 0 .9rem; color: var(--zx-navy); }

code { font-family: Consolas, "Courier New", monospace; }

/* ---- Page frame ---- */
.zx-page { min-height: 100vh; display: flex; flex-direction: column; }

.zx-top {
    background: var(--zx-navy);
    color: var(--zx-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 24px;
}
.zx-brand img { display: block; height: 36px; width: auto; }
.zx-top-end { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; margin-inline-start: auto; }

.zx-lang { display: flex; gap: 4px; }
.zx-lang a {
    color: #c9d2e3;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: .85rem;
}
.zx-lang a:hover { background: var(--zx-navy-2); color: var(--zx-white); text-decoration: none; }
.zx-lang a.active { color: var(--zx-white); background: var(--zx-navy-2); }

.zx-user { display: inline-flex; align-items: center; gap: 8px; }
.zx-user-name { font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.zx-main { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; }

.zx-card {
    width: 100%;
    max-width: 440px;
    background: var(--zx-white);
    border-radius: var(--zx-radius);
    box-shadow: 0 10px 30px rgba(13, 21, 35, .08);
    padding: 32px;
}

.zx-app-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff3e2;
    color: var(--zx-navy);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: .85rem;
    margin-bottom: 16px;
}
.zx-app-chip img { border-radius: 4px; }

.zx-lead { color: var(--zx-muted); margin: 0 0 1.25rem; }
.zx-muted { color: var(--zx-muted); font-size: .88rem; }

.zx-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 18px 24px;
    color: var(--zx-muted);
    font-size: .82rem;
    border-top: 1px solid var(--zx-line);
    background: var(--zx-white);
}
.zx-footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.zx-footer-links a { color: var(--zx-muted); }

/* ---- Forms ---- */
.zx-form { display: flex; flex-direction: column; gap: 14px; }

.zx-field { display: flex; flex-direction: column; gap: 5px; }
.zx-field > span { font-weight: 600; font-size: .9rem; }
.zx-field input, .zx-field select {
    width: 100%;
    font: inherit;
    color: var(--zx-text);
    background: var(--zx-white);
    border: 1px solid #c7cfdb;
    border-radius: 9px;
    padding: 10px 12px;
    min-height: 44px;
}
.zx-field input:focus, .zx-field select:focus {
    outline: none;
    border-color: var(--zx-orange);
    box-shadow: 0 0 0 3px rgba(246, 141, 11, .2);
}
.zx-field input.invalid { border-color: var(--zx-error); }
.zx-code { letter-spacing: .25em; font-size: 1.15rem; text-align: center; }
.zx-hint { color: var(--zx-muted); font-size: .8rem; }
.zx-error { color: var(--zx-error); font-size: .85rem; }
.validation-message { color: var(--zx-error); font-size: .85rem; }

.zx-readonly {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--zx-page);
    border-radius: 9px;
    min-height: 44px;
    word-break: break-all;
}

.zx-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: .92rem; }
.zx-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--zx-orange); flex: none; }

.zx-row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .92rem; }

.zx-small-link { font-size: .85rem; }

/* ---- Buttons ---- */
.zx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font: inherit;
    font-weight: 600;
    border-radius: 9px;
    padding: 10px 20px;
    min-height: 44px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.zx-btn:hover { text-decoration: none; }
.zx-btn-primary { background: var(--zx-orange); color: var(--zx-white); }
.zx-btn-primary:hover { background: var(--zx-orange-dark); }
.zx-btn-secondary { background: var(--zx-white); color: var(--zx-navy); border-color: #c7cfdb; }
.zx-btn-secondary:hover { border-color: var(--zx-navy); }
.zx-btn-ghost { background: transparent; color: var(--zx-blue); border-color: transparent; }
.zx-top .zx-btn-ghost { color: var(--zx-white); border-color: #3a4a66; }
.zx-btn-ghost:hover { background: rgba(47, 111, 214, .08); }
.zx-top .zx-btn-ghost:hover { background: var(--zx-navy-2); }
.zx-btn-danger { background: var(--zx-white); color: var(--zx-error); border-color: #efb3b3; }
.zx-btn-danger:hover { background: var(--zx-error-bg); }
.zx-btn-small { padding: 6px 14px; min-height: 36px; font-size: .88rem; }
.zx-btn-block { width: 100%; }

.zx-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.zx-inline-form { margin-top: 16px; }

.zx-card-links { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--zx-line); font-size: .92rem; }
.zx-card-links p { margin: 6px 0; }

/* ---- Messages ---- */
.zx-alert { border-radius: 9px; padding: 10px 14px; margin: 0 0 14px; font-size: .92rem; }
.zx-alert-ok { background: var(--zx-ok-bg); color: var(--zx-ok); }
.zx-alert-error { background: var(--zx-error-bg); color: var(--zx-error); }
.zx-alert-warn { background: var(--zx-warn-bg); color: var(--zx-warn); }

.zx-badge { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: .75rem; font-weight: 600; }
.zx-badge-ok { background: var(--zx-ok-bg); color: var(--zx-ok); }
.zx-badge-warn { background: var(--zx-warn-bg); color: var(--zx-warn); }

.zx-done { text-align: center; }
.zx-done .zx-btn { margin-top: 8px; }
.zx-done-icon {
    width: 56px; height: 56px; margin: 0 auto 14px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #fff3e2; color: var(--zx-orange);
    font-size: 1.6rem; font-weight: 700;
}
.zx-done-error { background: var(--zx-error-bg); color: var(--zx-error); }

/* ---- My account ---- */
.zx-manage {
    flex: 1;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 24px;
    padding: 32px 24px;
}
.zx-side { display: flex; flex-direction: column; gap: 2px; }
.zx-side-link {
    color: var(--zx-text);
    padding: 9px 14px;
    border-radius: 9px;
    font-weight: 500;
}
.zx-side-link:hover { background: var(--zx-white); text-decoration: none; }
.zx-side-link.active { background: var(--zx-white); color: var(--zx-navy); font-weight: 700; box-shadow: inset 3px 0 0 var(--zx-orange); }
[dir="rtl"] .zx-side-link.active { box-shadow: inset -3px 0 0 var(--zx-orange); }
.zx-manage-main { min-width: 0; }

.zx-panel {
    background: var(--zx-white);
    border-radius: var(--zx-radius);
    box-shadow: 0 4px 16px rgba(13, 21, 35, .05);
    padding: 22px;
    margin-bottom: 18px;
}
.zx-panel .zx-form { max-width: 440px; }

.zx-avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-block; }
.zx-avatar-letter {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--zx-orange); color: var(--zx-white); font-weight: 700;
}
.zx-picture-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.zx-picture-form { display: flex; flex-direction: column; gap: 8px; }
.zx-picture-form input[type=file] { font: inherit; font-size: .88rem; max-width: 100%; }

.zx-list { list-style: none; margin: 0; padding: 0; }
.zx-list-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--zx-line);
}
.zx-list-row:last-child { border-bottom: 0; }

.zx-table-wrap { overflow-x: auto; }
.zx-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.zx-table th, .zx-table td { text-align: start; padding: 9px 10px; border-bottom: 1px solid var(--zx-line); vertical-align: top; }
.zx-table th { color: var(--zx-muted); font-weight: 600; white-space: nowrap; }
.zx-row-warn td { background: var(--zx-warn-bg); }

.zx-steps { padding-inline-start: 20px; margin: 0 0 18px; }
.zx-steps li { margin-bottom: 12px; }
.zx-qr { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 10px; }
.zx-qr img { border: 1px solid var(--zx-line); border-radius: 8px; image-rendering: pixelated; }
.zx-qr code { background: var(--zx-page); padding: 6px 10px; border-radius: 6px; font-size: .95rem; }

.zx-codes { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 360px; }
.zx-codes code { display: block; background: var(--zx-page); padding: 6px 10px; border-radius: 6px; text-align: center; }

.zx-app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.zx-app-card {
    display: flex; gap: 14px; align-items: center;
    background: var(--zx-white); color: var(--zx-text);
    border-radius: var(--zx-radius); padding: 16px;
    box-shadow: 0 4px 16px rgba(13, 21, 35, .05);
    border: 1px solid transparent;
}
.zx-app-card:hover { border-color: var(--zx-orange); text-decoration: none; }
.zx-app-icon {
    width: 44px; height: 44px; flex: none; border-radius: 11px;
    background: var(--zx-navy); color: var(--zx-orange);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.2rem;
}
.zx-app-text { display: flex; flex-direction: column; min-width: 0; }

/* ---- ZX team pages (/admin) ---- */
.zx-manage-wide { max-width: 1280px; }
.zx-team-badge { background: var(--zx-orange); color: var(--zx-white); border-radius: 999px; padding: 2px 12px; font-size: .78rem; font-weight: 700; }
.zx-side-team { margin-top: 10px; border-top: 1px solid var(--zx-line); padding-top: 14px; color: var(--zx-orange-dark); font-weight: 600; }
.zx-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.zx-badge-error { background: var(--zx-error-bg); color: var(--zx-error); }
.zx-badge-team { background: var(--zx-navy); color: var(--zx-white); }
.zx-search { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.zx-search input, .zx-search select { font: inherit; border: 1px solid #c7cfdb; border-radius: 9px; padding: 7px 12px; min-height: 38px; background: var(--zx-white); }
.zx-search input { flex: 1 1 260px; }
.zx-pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 8px 0 18px; font-size: .9rem; }
.zx-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 14px 0 0; font-size: .92rem; }
.zx-facts dt { color: var(--zx-muted); }
.zx-facts dd { margin: 0; word-break: break-all; }

/* ---- Portal ---- */
.zx-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--zx-white); }
.zx-brand:hover { text-decoration: none; }
.zx-brand-app { font-weight: 700; color: var(--zx-orange); font-size: 1.05rem; }
.zx-top-link { color: #c9d2e3; font-weight: 600; }
.zx-top-link:hover { color: var(--zx-white); }
.zx-user { color: var(--zx-white); }
.zx-user:hover { text-decoration: none; }
.zx-avatar-letter { width: 32px; height: 32px; font-size: 16px; }
.zx-inline { display: inline; margin: 0; }
.zx-main { display: block; padding: 0; }

.zx-hero { background: var(--zx-navy); color: var(--zx-white); padding: 56px 24px 72px; }
.zx-hero-inner { max-width: 1080px; margin: 0 auto; }
.zx-hero h1 { color: var(--zx-white); font-size: 2.1rem; margin-bottom: 10px; }
.zx-hero p { color: #c9d2e3; font-size: 1.1rem; max-width: 640px; margin: 0; }
.zx-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.zx-btn-outline { background: transparent; color: var(--zx-white); border-color: #47b2e4; }
.zx-btn-outline:hover { background: rgba(71, 178, 228, .15); }

.zx-section { max-width: 1080px; margin: 0 auto; padding: 32px 24px 48px; }
.zx-hero + .zx-section { margin-top: -40px; padding-top: 0; }

.zx-app-card { position: relative; }
.zx-app-coming { opacity: .75; }
.zx-app-status {
    position: absolute; top: 10px; inset-inline-end: 10px;
    background: #fff3e2; color: var(--zx-orange-dark);
    border-radius: 999px; padding: 1px 10px; font-size: .72rem; font-weight: 700;
}

.zx-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.zx-tabs a { padding: 7px 16px; border-radius: 999px; background: var(--zx-white); color: var(--zx-text); font-weight: 600; }
.zx-tabs a.active { background: var(--zx-navy); color: var(--zx-white); }
.zx-tabs a:hover { text-decoration: none; }

.zx-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.zx-panel .zx-form { max-width: none; }
.zx-field textarea { width: 100%; font: inherit; border: 1px solid #c7cfdb; border-radius: 9px; padding: 10px 12px; resize: vertical; }
.zx-check-field { align-self: end; min-height: 44px; align-items: center; }
.zx-form-inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.zx-form-inline .zx-field { flex: 1 1 260px; }
.zx-cut { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zx-row-between h1 { margin: 0; }
.zx-row-between { margin-bottom: 14px; }

/* ---- Phone ---- */
@media (max-width: 760px) {
    .zx-top { padding: 10px 16px; }
    .zx-user-name { display: none; }
    .zx-hero { padding: 36px 16px 60px; }
    .zx-hero h1 { font-size: 1.6rem; }
    .zx-section { padding: 24px 12px 36px; }
    .zx-grid-3 { grid-template-columns: 1fr; }
    .zx-panel { padding: 16px; }
    .zx-list-row { flex-direction: column; align-items: flex-start; }
    .zx-footer { padding: 14px 16px; }
}
