/*
 * Auth portal: login, subscription registration (WhatsApp), forgot password, reset password.
 *
 * Colours come from the same --theme-700/800/900 variables the rest of the
 * system uses (see layouts/partials/css.blade.php); the fallbacks are the
 * system's default "primary" theme so the page matches before anyone signs in.
 * Layout uses logical properties so Arabic / Hebrew (RTL) mirror correctly.
 */

/* ---- Tajawal (self-hosted, SIL OFL) ---- */
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('../fonts/tajawal/tajawal-arabic-400-normal.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('../fonts/tajawal/tajawal-latin-400-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url('../fonts/tajawal/tajawal-arabic-500-normal.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-display: swap;
    font-weight: 500;
    src: url('../fonts/tajawal/tajawal-latin-500-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-display: swap;
    font-weight: 700;
    src: url('../fonts/tajawal/tajawal-arabic-700-normal.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Tajawal';
    font-style: normal;
    font-display: swap;
    font-weight: 700;
    src: url('../fonts/tajawal/tajawal-latin-700-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.ap-body {
    --ap-t700: rgb(var(--theme-700, 29, 78, 216));
    --ap-t800: rgb(var(--theme-800, 20, 58, 143));
    --ap-t900: rgb(var(--theme-900, 10, 36, 99));
    --ap-ink: #0f172a;
    --ap-muted: #4b5565;
    --ap-line: #dde3ec;
    --ap-page: #f7f8fb;
    --ap-danger: #b42318;
    --ap-wa: #0c7a45;
    --ap-wa-hover: #096236;
    --ap-paper: #f8fafc;
    --ap-teal: #0f9f8a;

    margin: 0;
    font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ap-ink);
    background: var(--ap-page);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.ap-body *,
.ap-body *::before,
.ap-body *::after {
    box-sizing: border-box;
}

.ap-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Shell: form pane first, brand pane second (mirrors automatically in RTL) ---- */
.ap-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
}

/* ---- Form pane ---- */
.ap-form-pane {
    display: flex;
    flex-direction: column;
    padding: 24px 40px;
    background: var(--ap-page);
}

.ap-form-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ap-lang {
    height: 40px;
    padding-inline: 12px;
    font: inherit;
    font-size: 14px;
    color: var(--ap-ink);
    background: #fff;
    border: 1px solid var(--ap-line);
    border-radius: 10px;
    cursor: pointer;
}

.ap-form-main {
    flex: 1;
    width: 100%;
    max-width: 400px;
    margin-inline: auto;
    padding-block: 32px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ap-form-main--wide {
    max-width: 560px;
    padding-block: 20px 32px;
}

.ap-h1 {
    margin: 0 0 6px;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ap-ink);
    text-wrap: balance;
}

.ap-sub {
    margin: 0 0 24px;
    font-size: 16px;
    color: var(--ap-muted);
}

/* ---- Notices ---- */
.ap-notice {
    margin: 0 0 20px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
    border-radius: 10px;
    border: 1px solid;
}
.ap-notice--error {
    color: #912018;
    background: #fef3f2;
    border-color: #fecdca;
}
.ap-notice--ok {
    color: #05603a;
    background: #ecfdf3;
    border-color: #a6f4c5;
}
.ap-notice--info {
    color: #0b3b8f;
    background: #eff6ff;
    border-color: #bfdbfe;
}

/* ---- Fields ---- */
.ap-field {
    margin-bottom: 16px;
}

.ap-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.ap-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ap-ink);
}

.ap-label-hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--ap-muted);
}

.ap-input,
.ap-select,
.ap-textarea {
    display: block;
    width: 100%;
    height: 46px;
    padding-inline: 14px;
    font: inherit;
    font-size: 15px;
    color: var(--ap-ink);
    background: #fff;
    border: 1px solid #c3cbd8;
    border-radius: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ap-textarea {
    height: auto;
    min-height: 76px;
    padding-block: 10px;
    resize: vertical;
}

.ap-input::placeholder,
.ap-textarea::placeholder {
    color: #8b95a7;
}

.ap-input:hover,
.ap-select:hover,
.ap-textarea:hover {
    border-color: #9aa5b8;
}

.ap-input:focus,
.ap-select:focus,
.ap-textarea:focus {
    outline: none;
    border-color: var(--ap-t700);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ap-t700) 22%, transparent);
}

.ap-field--error .ap-input,
.ap-field--error .ap-select,
.ap-field--error .ap-textarea {
    border-color: var(--ap-danger);
}

.ap-error {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--ap-danger);
}

/* ---- Subscription Plans & Billing Cycles ---- */
.ap-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 10px;
    padding-bottom: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--ap-ink);
    border-bottom: 1px solid var(--ap-line);
}

.ap-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--ap-t800);
    border-radius: 6px;
}

.ap-plans {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.ap-plan {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 12px;
    background: #fff;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.ap-plan:hover {
    border-color: #94a3b8;
}

.ap-plan input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ap-plan--active {
    border-color: var(--ap-t700);
    background: #eff6ff;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ap-t700) 18%, transparent);
}

.ap-plan-badge {
    align-self: flex-start;
    margin-bottom: 4px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    color: #05603a;
    background: #d1fae5;
    border-radius: 6px;
}

.ap-plan-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ap-ink);
}

.ap-plan-desc {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--ap-muted);
}

.ap-cycles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: #e9eef6;
    border-radius: 10px;
}

.ap-cycle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding-inline: 8px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    color: var(--ap-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.ap-cycle input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ap-cycle--active {
    font-weight: 700;
    color: var(--ap-ink);
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

/* ---- Password Eye ---- */
.ap-pass {
    position: relative;
}
.ap-pass .ap-input {
    padding-inline-end: 48px;
}
.ap-eye {
    position: absolute;
    inset-block: 0;
    inset-inline-end: 4px;
    width: 40px;
    margin-block: auto;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ap-muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}
.ap-eye:hover {
    color: var(--ap-ink);
    background: #f0f3f8;
}
.ap-eye svg {
    width: 22px;
    height: 22px;
}
.ap-eye .ap-eye-off {
    display: none;
}
.ap-eye[aria-pressed='true'] .ap-eye-on {
    display: none;
}
.ap-eye[aria-pressed='true'] .ap-eye-off {
    display: block;
}

.ap-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -2px 0 20px;
    font-size: 14px;
}

.ap-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--ap-ink);
}
.ap-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--ap-t800);
}

.ap-link {
    color: var(--ap-t800);
    font-weight: 500;
    text-decoration: none;
}
.ap-link:hover {
    text-decoration: underline;
}

/* ---- Buttons ---- */
.ap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    padding-inline: 18px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    color: #fff;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s;
}
.ap-btn--primary {
    background: var(--ap-t800);
}
.ap-btn--primary:hover {
    background: var(--ap-t700);
}
.ap-btn--wa {
    background: var(--ap-wa);
}
.ap-btn--wa:hover {
    background: var(--ap-wa-hover);
    color: #fff;
}
.ap-btn--outline {
    color: var(--ap-t800);
    background: #fff;
    border: 1.5px solid var(--ap-t800);
}
.ap-btn--outline:hover {
    background: #eff6ff;
}
.ap-btn svg {
    flex: none;
    width: 22px;
    height: 22px;
}

/* ---- Registration / Subscription Box on Login ---- */
.ap-closed {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--ap-line);
}
.ap-closed-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
}
.ap-closed-body {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--ap-muted);
}
.ap-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ap-alt {
    margin: 18px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--ap-muted);
}
.ap-back {
    margin: 20px 0 0;
    text-align: center;
    font-size: 14px;
}

/* ---- Brand pane & Till Receipt ---- */
.ap-brand-pane {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 40px 56px;
    color: #fff;
    background: linear-gradient(
        160deg,
        color-mix(in srgb, var(--ap-t800) 78%, #04102e) 0%,
        color-mix(in srgb, var(--ap-t900) 55%, #030b22) 100%
    );
}
.ap-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.ap-logo {
    width: 52px;
    height: 52px;
    flex: none;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.ap-brand-name {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}
.ap-brand-title {
    margin: 2px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.72);
}
.ap-showcase {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding-block: 32px;
}
.ap-headline {
    max-width: 440px;
    margin: 0 0 36px;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
    text-wrap: balance;
}
.ap-foot {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

/* The till receipt card */
.ap-receipt {
    position: relative;
    width: min(360px, 100%);
    padding: 22px 24px 20px;
    color: var(--ap-ink);
    background: var(--ap-paper);
    border-radius: 6px 6px 0 0;
    box-shadow: 0 28px 50px -18px rgba(0, 0, 0, 0.5);
    transform: rotate(-1.5deg);
}
[dir='rtl'] .ap-receipt {
    transform: rotate(1.5deg);
}
.ap-receipt::after {
    content: '';
    position: absolute;
    inset-inline: 0;
    bottom: -9px;
    height: 9px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M0 0h14L7 9z' fill='%23f8fafc'/%3E%3C/svg%3E") repeat-x left top;
}
.ap-receipt-title {
    margin: 0 0 14px;
    padding-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    color: var(--ap-muted);
    border-bottom: 2px dashed #c3cbd8;
}
.ap-receipt-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.ap-receipt-list li,
.ap-receipt-total {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.ap-receipt-list li {
    padding-block: 6px;
    font-size: 15px;
}
.ap-receipt-val {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ap-t800);
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ap-leader {
    flex: 1;
    min-width: 12px;
    border-bottom: 2px dotted #aab4c5;
    transform: translateY(-4px);
}
.ap-tick {
    flex: none;
    width: 16px;
    height: 16px;
    align-self: center;
    color: var(--ap-teal);
}
.ap-receipt-total {
    margin-top: 12px;
    padding-top: 12px;
    font-size: 16px;
    font-weight: 700;
    border-top: 2px solid var(--ap-ink);
}
.ap-receipt-total .ap-tick {
    width: 20px;
    height: 20px;
}
.ap-barcode {
    height: 34px;
    margin-top: 18px;
    background: repeating-linear-gradient(
        90deg,
        var(--ap-ink) 0 2px,
        transparent 2px 4px,
        var(--ap-ink) 4px 5px,
        transparent 5px 8px,
        var(--ap-ink) 8px 11px,
        transparent 11px 13px
    );
    opacity: 0.85;
}

@media (max-width: 900px) {
    .ap-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .ap-brand-pane {
        order: -1;
        padding: 18px 20px;
    }
    .ap-showcase,
    .ap-foot {
        display: none;
    }
    .ap-form-pane {
        padding: 12px 20px 24px;
    }
    .ap-plans,
    .ap-grid-2 {
        grid-template-columns: 1fr;
    }
}
