/**
 * Login Pages CSS - Ghonem POS
 * Activation-page identity (dark navy + green/gold). UI only - no logic here.
 * All hook classes used by auth.js / login.php are preserved.
 */

:root {
    color-scheme: dark;
    --login-bg: #050b16;
    --login-panel: #0b1628;
    --login-panel-2: #0d1b30;
    --login-input: rgba(3, 11, 22, 0.78);
    --login-border: rgba(124, 163, 210, 0.18);
    --login-border-strong: rgba(91, 145, 205, 0.34);
    --login-green: #16d6a4;
    --login-green-2: #00a97f;
    --login-green-deep: #00a67d;
    --login-green-soft: rgba(22, 214, 164, 0.14);
    --login-gold: #f5bd56;
    --login-text: #f4f8ff;
    --login-muted: #91a5c2;
    --login-faint: #5d6f8c;
    --login-success: #16d6a4;
    --login-error: #ff737d;
    --login-warning: #f5bd56;
    --login-info: #8cbaff;
    --login-radius: 24px;
    --login-input-radius: 13px;
    --login-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== Page base (activation identity) ===== */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    font-family: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
    color: var(--login-text);
    background:
        radial-gradient(ellipse at 82% 8%, rgba(10, 93, 107, 0.22), transparent 34%),
        radial-gradient(ellipse at 7% 95%, rgba(168, 109, 35, 0.14), transparent 32%),
        linear-gradient(135deg, #050a14 0%, #081426 50%, #050b16 100%);
}

.auth-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 25px 24px 18px;
    position: relative;
    z-index: 1;
}

.auth-background {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-pattern {
    position: absolute;
    inset: 0;
}

/* Layout-provided shapes reused as the 2 ambient lights */
.floating-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.floating-shapes .shape {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.floating-shapes .shape-1 {
    width: 400px;
    height: 400px;
    right: -190px;
    top: 24%;
    background: rgba(0, 220, 170, 0.06);
    box-shadow: 0 0 100px rgba(0, 220, 170, 0.05);
}

.floating-shapes .shape-2 {
    width: 320px;
    height: 320px;
    left: -180px;
    bottom: -110px;
    background: rgba(245, 189, 86, 0.06);
    box-shadow: 0 0 100px rgba(245, 189, 86, 0.05);
}

.floating-shapes .shape-3,
.floating-shapes .shape-4,
.floating-shapes .shape-5 {
    display: none;
}

.auth-content {
    width: 100%;
    max-width: 1180px;
    position: relative;
    z-index: 1;
}

/* ===== Centered composition (single panel, mobile-first) ===== */
.login-split {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
}

/* ===== Login panel ===== */
.auth-card {
    position: relative;
}

.login-panel {
    width: 100%;
    max-width: 430px;
    justify-self: center;
    background: linear-gradient(150deg, rgba(13, 28, 49, 0.95), rgba(5, 14, 27, 0.97));
    border: 1px solid var(--login-border-strong);
    border-radius: var(--login-radius);
    padding: 30px 30px 22px;
    box-shadow: 0 26px 75px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.035);
    overflow: hidden;
}

.login-panel::before {
    content: '';
    position: absolute;
    inset: 0 8% auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(25, 232, 188, 0.8), transparent);
    pointer-events: none;
}

.login-panel.is-success {
    animation: panelOut 0.45s ease forwards;
}

@keyframes panelOut {
    to { opacity: 0; transform: translateY(-10px) scale(0.98); }
}

.auth-card.shake {
    animation: panelShake 0.4s ease;
}

@keyframes panelShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(4px); }
    50% { transform: translateX(-4px); }
    75% { transform: translateX(2px); }
}

.panel-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.panel-logo img {
    width: 72px;
    height: 72px;
    border-radius: 19px;
    object-fit: cover;
    box-shadow: 0 14px 34px -8px rgba(16, 185, 129, 0.55);
    border: 1px solid rgba(46, 231, 184, 0.38);
}

.brand-logo-fallback {
    width: 72px;
    height: 72px;
    border-radius: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #eafff8;
    background: linear-gradient(145deg, rgba(19, 214, 164, 0.23), rgba(8, 95, 83, 0.15));
    border: 1px solid rgba(46, 231, 184, 0.38);
    box-shadow: 0 14px 34px -8px rgba(16, 185, 129, 0.55);
}

.brand-logo-fallback.sm {
    width: 72px;
    height: 72px;
    font-size: 32px;
    border-radius: 19px;
}

.panel-head {
    text-align: center;
    margin-bottom: 20px;
}

.panel-title {
    margin: 0;
    font-size: 22px;
    font-weight: 900;
    color: var(--login-text);
    letter-spacing: -0.2px;
}

.panel-sub {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--login-muted);
}

/* Entrance stagger */
.anim-item {
    animation: riseIn 0.55s var(--login-ease) both;
    animation-delay: var(--d, 0s);
    will-change: transform, opacity;
}

@keyframes riseIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* ===== Form ===== */
.auth-form {
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 13px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.input-wrapper {
    position: relative;
}

.login-input input {
    width: 100%;
    height: 53px;
    padding: 0 44px 0 46px;
    border: 1px solid rgba(119, 157, 201, 0.27);
    border-radius: var(--login-input-radius);
    background: var(--login-input);
    color: #f3f8ff;
    font-size: 14.5px;
    font-family: 'Tajawal', sans-serif;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-input input::placeholder {
    color: #536986;
    opacity: 1;
}

.login-input input:hover {
    border-color: rgba(119, 157, 201, 0.45);
}

.login-input input:focus {
    outline: none;
    border-color: rgba(22, 214, 164, 0.8);
    box-shadow: 0 0 0 3px rgba(22, 214, 164, 0.1), 0 0 22px rgba(22, 214, 164, 0.06);
}

.login-input .input-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #7392b8;
    font-size: 17px;
    pointer-events: none;
    transition: color 0.18s ease;
}

.login-input input:focus ~ .input-icon {
    color: var(--login-green);
}

.login-toggle {
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #7392b8;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, color 0.18s ease;
}

.login-toggle:hover {
    background: rgba(22, 214, 164, 0.1);
    color: #8af7d9;
}

.login-toggle:focus-visible {
    outline: 2px solid var(--login-green);
    outline-offset: 2px;
}

/* Remember me */
.login-options,
.form-options {
    margin: 2px 0 16px;
}

.login-checkbox,
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--login-muted);
}

.login-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.login-checkbox .checkbox-custom {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1.5px solid rgba(125, 168, 216, 0.4);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    flex-shrink: 0;
}

.login-checkbox .checkbox-custom::after {
    content: '\eb7b';
    font-family: 'remixicon';
    font-size: 12px;
    color: #03241d;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.18s ease;
}

.login-checkbox input:checked + .checkbox-custom {
    background: var(--login-green);
    border-color: var(--login-green);
}

.login-checkbox input:checked + .checkbox-custom::after {
    opacity: 1;
    transform: scale(1);
}

.login-checkbox input:focus-visible + .checkbox-custom {
    outline: 2px solid var(--login-green);
    outline-offset: 2px;
}

.checkbox-text {
    color: var(--login-muted);
}

/* Submit button (activation gradient) */
.login-btn {
    position: relative;
    width: 100%;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(104, 255, 213, 0.5);
    border-radius: var(--login-input-radius);
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    font-weight: 900;
    color: #03241d;
    background: linear-gradient(115deg, #2ce8b6 0%, #0cc99a 52%, #00a67d 100%);
    box-shadow: 0 10px 28px rgba(0, 191, 142, 0.17), inset 0 1px 0 rgba(255, 255, 255, 0.42);
    transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
    overflow: hidden;
}

.login-btn:hover:not(:disabled) {
    filter: brightness(1.07);
    box-shadow: 0 13px 32px rgba(0, 191, 142, 0.24);
    transform: translateY(-1px);
}

.login-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
}

.login-btn:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

.login-btn .btn-content,
.login-btn .btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn .btn-loader {
    display: none;
}

.login-btn.is-loading .btn-content {
    display: none;
}

.login-btn.is-loading .btn-loader {
    display: flex;
}

.btn-spinner {
    width: 17px;
    height: 17px;
    border: 2.5px solid rgba(3, 36, 29, 0.25);
    border-top-color: #03241d;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== OTP ===== */
.login-otp-group {
    text-align: center;
    animation: riseIn 0.4s var(--login-ease) both;
}

.otp-header {
    margin-bottom: 16px;
}

.otp-icon-wrap {
    width: 50px;
    height: 50px;
    margin: 0 auto 10px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    color: #68f4d1;
    background: rgba(22, 214, 164, 0.09);
    border: 1px solid rgba(22, 214, 164, 0.16);
}

.otp-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--login-text);
}

.otp-desc {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--login-muted);
}

.otp-single-wrap {
    display: flex;
    justify-content: center;
    margin: 14px 0 6px;
}

.otp-input-single {
    width: 100%;
    max-width: 260px;
    height: 58px;
    text-align: center;
    font-size: 25px;
    font-weight: 800;
    font-family: 'Tajawal', sans-serif;
    letter-spacing: 13px;
    /* keep digits left-to-right and centered even on an RTL page */
    direction: ltr;
    color: var(--login-text);
    background: var(--login-input);
    border: 1px solid rgba(119, 157, 201, 0.27);
    border-radius: 14px;
    outline: none;
    caret-color: var(--login-green);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.otp-input-single::placeholder {
    letter-spacing: 13px;
    color: var(--login-faint);
    opacity: 0.55;
}

.otp-input-single:focus {
    border-color: rgba(22, 214, 164, 0.8);
    box-shadow: 0 0 0 3px rgba(22, 214, 164, 0.1);
    transform: scale(1.015);
}

.otp-input-single.filled {
    border-color: rgba(22, 214, 164, 0.55);
}

.otp-input-single.success {
    border-color: var(--login-success);
}

.otp-input-single.error {
    border-color: var(--login-error);
    animation: panelShake 0.35s ease;
}

.otp-info {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 8px 0 14px;
    font-size: 12px;
    font-weight: 700;
}

.otp-timer {
    color: var(--login-muted);
}

.otp-timer.warning {
    color: var(--login-warning);
}

.otp-timer.danger {
    color: var(--login-error);
}

.otp-attempts {
    color: var(--login-muted);
    opacity: 0.8;
}

.otp-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.otp-verify-btn {
    max-width: 250px;
    margin: 0 auto;
}

.otp-secondary-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.login-btn-flat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    border: none;
    border-radius: 9px;
    background: rgba(125, 168, 216, 0.1);
    color: var(--login-muted);
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.login-btn-flat:hover:not(:disabled) {
    background: rgba(22, 214, 164, 0.12);
    color: #8af7d9;
}

.login-btn-flat:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ===== Messages (hook classes used by auth.js: premium-message <type> show) ===== */
.premium-message {
    display: none;
    margin-top: 14px;
    padding: 11px 13px;
    border-radius: 12px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.8;
    text-align: right;
    animation: riseIn 0.3s ease both;
}

.premium-message.show {
    display: flex;
}

.premium-message.loading {
    color: #8cbaff;
    background: rgba(83, 147, 229, 0.1);
    border: 1px solid rgba(111, 170, 245, 0.25);
}

.premium-message.success {
    color: #a7f9df;
    background: rgba(22, 214, 164, 0.09);
    border: 1px solid rgba(22, 214, 164, 0.3);
}

.premium-message.error {
    color: #ffb2b7;
    background: rgba(255, 89, 104, 0.09);
    border: 1px solid rgba(255, 89, 104, 0.3);
}

.premium-message.info {
    color: #f4d89d;
    background: rgba(245, 189, 86, 0.08);
    border: 1px solid rgba(245, 189, 86, 0.25);
}

/* ===== Success overlay ===== */
.success-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 20;
    align-items: center;
    justify-content: center;
    background: rgba(5, 14, 27, 0.96);
    border-radius: var(--login-radius);
}

.success-overlay.visible {
    display: flex;
    animation: overlayIn 0.4s ease both;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

/* LOADING wordmark shown after successful login */
.loading-word {
    position: relative;
    font-size: 46px;
    font-weight: 900;
    letter-spacing: 9px;
    text-indent: 9px;
    color: transparent;
    -webkit-text-stroke: 2px #1fe0b2;
    animation: loadPulse 1.6s ease-in-out infinite;
    user-select: none;
}

.loading-word::after {
    content: 'LOADING';
    position: absolute;
    inset: 0;
    font: inherit;
    letter-spacing: inherit;
    color: transparent;
    background: linear-gradient(100deg, transparent 20%, #a7f9df 45%, #eafff8 50%, #a7f9df 55%, transparent 80%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: loadSweep 1.6s linear infinite;
    pointer-events: none;
}

@keyframes loadSweep {
    from { background-position: 120% 0; }
    to { background-position: -120% 0; }
}

@keyframes loadPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.72; }
}

.success-circle {
    stroke-dasharray: 176;
    stroke-dashoffset: 176;
    animation: circleDraw 0.55s ease-out 0.15s forwards;
}

.success-path {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: checkDraw 0.35s ease-out 0.6s forwards;
}

@keyframes circleDraw {
    to { stroke-dashoffset: 0; }
}

@keyframes checkDraw {
    to { stroke-dashoffset: 0; }
}

.success-text {
    font-size: 19px;
    font-weight: 800;
    color: var(--login-text);
    opacity: 0;
    animation: riseIn 0.4s ease-out 0.85s forwards;
}

.success-username {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--login-muted);
    opacity: 0;
    animation: riseIn 0.4s ease-out 0.95s forwards;
}

/* ===== Panel footer (bilingual, under the form) ===== */
.panel-footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(121, 158, 199, 0.13);
    text-align: center;
}

.panel-footer p {
    margin: 3px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--login-muted);
    opacity: 0.85;
}

/* ===== Auth footer ===== */
.auth-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #627793;
    font-size: 12.5px;
}

.auth-footer p {
    margin: 3px 0;
}

.auth-footer strong {
    color: #e8f0fb;
    font-weight: 700;
}

.footer-custom {
    font-size: 12px;
    opacity: 0.7;
}

/* ===== Responsive (mobile-first, no clutter) ===== */
@media (max-width: 520px) {
    .auth-container {
        padding: 18px 11px;
    }

    .login-split {
        max-width: 100%;
    }

    .login-panel {
        padding: 26px 17px 20px;
        border-radius: 19px;
    }

    .panel-title {
        font-size: 20px;
    }

    .login-input input {
        height: 51px;
    }

    .login-btn {
        height: 51px;
    }

    .otp-input-single {
        max-width: 220px;
        height: 52px;
        font-size: 21px;
        letter-spacing: 10px;
    }

    .loading-word {
        font-size: 34px;
    }
}

/* Short screens: compress vertically */
@media (max-height: 760px) {
    .auth-container {
        padding: 12px;
        gap: 8px;
    }

    .login-panel {
        padding: 20px 24px 16px;
    }

    .panel-head {
        margin-bottom: 14px;
    }

    .form-group {
        margin-bottom: 10px;
    }

    .login-options,
    .form-options {
        margin-bottom: 12px;
    }

    .login-btn {
        height: 50px;
    }

    .auth-footer {
        display: none;
    }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    .anim-item,
    .login-panel.is-success,
    .auth-card.shake,
    .login-otp-group,
    .premium-message,
    .success-overlay.visible,
    .success-circle,
    .success-path,
    .success-text,
    .success-username,
    .loading-word,
    .loading-word::after,
    .btn-spinner,
    .otp-input-single,
    .otp-input-single:focus,
    .otp-input-single.error {
        animation: none !important;
        transition: none !important;
    }

    .otp-input-single:focus {
        transform: none;
    }
}
