/* =========================================
   HabibiFood Auth — Frontend Styles
   ========================================= */

:root {
    --hf-primary:   #e8521a;
    --hf-secondary: #1a1a2e;
    --hf-accent:    #f7c59f;
    --hf-font:      'Vazirmatn', Tahoma, sans-serif;
    --hf-radius:    14px;
    --hf-white:     #ffffff;
    --hf-gray-50:   #f9f9f9;
    --hf-gray-100:  #f0f0f0;
    --hf-gray-300:  #cccccc;
    --hf-gray-500:  #888888;
    --hf-gray-900:  #111111;
    --hf-success:   #22c55e;
    --hf-error:     #ef4444;
    --hf-shadow:    0 8px 32px rgba(0,0,0,.12);
    --hf-shadow-lg: 0 20px 60px rgba(0,0,0,.18);
    --hf-transition: all .25s cubic-bezier(.4,0,.2,1);
}

/* ---- Wrap ---- */
.habibi-auth-wrap {
    font-family: var(--hf-font);
    direction: rtl;
    text-align: right;
}

.habibi-auth-inner {
    background: var(--hf-white);
    border-radius: var(--hf-radius);
    box-shadow: var(--hf-shadow);
    padding: 40px 36px;
    max-width: 420px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.habibi-auth-inner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--hf-primary), var(--hf-accent));
    border-radius: var(--hf-radius) var(--hf-radius) 0 0;
}

/* ---- Brand Logo ---- */
.habibi-brand {
    text-align: center;
    margin-bottom: 20px;
}
.habibi-logo {
    max-height: 56px;
    width: auto;
}

/* ---- Step ---- */
.habibi-step {
    animation: hf-fadein .3s ease;
}

@keyframes hf-fadein {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.habibi-step-icon {
    font-size: 2.4rem;
    text-align: center;
    margin-bottom: 8px;
}

/* ---- Title ---- */
.habibi-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--hf-secondary);
    margin: 0 0 6px 0;
    text-align: center;
}

.habibi-sub {
    font-size: .875rem;
    color: var(--hf-gray-500);
    text-align: center;
    margin: 0 0 24px 0;
}

/* ---- Fields ---- */
.habibi-field-group {
    margin-bottom: 20px;
}

.habibi-label {
    display: block;
    font-size: .825rem;
    font-weight: 600;
    color: var(--hf-secondary);
    margin-bottom: 6px;
}

.habibi-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.habibi-input-icon {
    position: absolute;
    right: 12px;
    font-size: 1.1rem;
    pointer-events: none;
}

.habibi-input {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 44px 13px 16px;
    border: 2px solid var(--hf-gray-100);
    border-radius: calc(var(--hf-radius) - 2px);
    font-family: var(--hf-font);
    font-size: 1rem;
    color: var(--hf-gray-900);
    background: var(--hf-gray-50);
    transition: var(--hf-transition);
    outline: none;
    direction: ltr;
    text-align: center;
    letter-spacing: 1px;
}

.habibi-input:focus {
    border-color: var(--hf-primary);
    background: var(--hf-white);
    box-shadow: 0 0 0 4px rgba(232,82,26,.1);
}

/* input without icon */
input.habibi-input[id="hf-fullname"] {
    padding: 13px 16px;
    direction: rtl;
    text-align: right;
    letter-spacing: 0;
}

/* ---- OTP Fields ---- */
.habibi-otp-fields {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    direction: ltr;
}

.habibi-otp-digit {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--hf-font);
    border: 2px solid var(--hf-gray-100);
    border-radius: var(--hf-radius);
    background: var(--hf-gray-50);
    color: var(--hf-secondary);
    outline: none;
    transition: var(--hf-transition);
    caret-color: var(--hf-primary);
}

.habibi-otp-digit:focus {
    border-color: var(--hf-primary);
    background: var(--hf-white);
    box-shadow: 0 0 0 4px rgba(232,82,26,.1);
    transform: scale(1.06);
}

.habibi-otp-digit.filled {
    border-color: var(--hf-primary);
    color: var(--hf-primary);
}

.habibi-otp-digit.error {
    border-color: var(--hf-error);
    animation: hf-shake .4s;
}

@keyframes hf-shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-6px); }
    75%       { transform: translateX(6px); }
}

/* ---- Timer ---- */
.habibi-otp-timer {
    text-align: center;
    font-size: .825rem;
    color: var(--hf-gray-500);
    margin-bottom: 16px;
}

/* ---- Buttons ---- */
.habibi-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--hf-radius);
    font-family: var(--hf-font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--hf-transition);
    position: relative;
    overflow: hidden;
}

.habibi-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.habibi-btn-primary {
    background: var(--hf-primary);
    color: var(--hf-white);
}

.habibi-btn-primary:hover:not(:disabled) {
    background: #c43d10;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232,82,26,.35);
}

.habibi-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.habibi-btn-ghost {
    background: transparent;
    color: var(--hf-gray-500);
    border: 2px solid var(--hf-gray-100);
    font-size: .875rem;
    padding: 10px;
    margin-top: 8px;
}

.habibi-btn-ghost:hover:not(:disabled) {
    border-color: var(--hf-primary);
    color: var(--hf-primary);
}

.habibi-btn-link {
    background: none;
    border: none;
    color: var(--hf-primary);
    font-family: var(--hf-font);
    font-size: .825rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0 4px;
}

/* Loader spinner inside button */
.btn-loader {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hf-spin .7s linear infinite;
    vertical-align: middle;
}

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

/* ---- Messages ---- */
.habibi-msg {
    margin-top: 12px;
    font-size: .825rem;
    text-align: center;
    min-height: 18px;
    border-radius: 8px;
    padding: 0;
    transition: var(--hf-transition);
}

.habibi-msg.error {
    color: var(--hf-error);
    background: rgba(239,68,68,.08);
    padding: 8px 12px;
}

.habibi-msg.success {
    color: var(--hf-success);
    background: rgba(34,197,94,.08);
    padding: 8px 12px;
}

/* ---- Already logged in ---- */
.habibi-auth-logged-in {
    font-family: var(--hf-font);
    background: var(--hf-gray-50);
    border: 2px solid var(--hf-gray-100);
    border-radius: var(--hf-radius);
    padding: 20px 24px;
    text-align: center;
    color: var(--hf-gray-500);
    max-width: 420px;
    margin: 0 auto;
}

/* ---- Success State ---- */
.habibi-success-anim {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.habibi-checkmark {
    width: 70px; height: 70px;
}

.habibi-checkmark-circle {
    stroke: var(--hf-success);
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: hf-circle .6s ease forwards;
}

.habibi-checkmark-check {
    stroke: var(--hf-success);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: hf-check .4s .5s ease forwards;
}

@keyframes hf-circle {
    to { stroke-dashoffset: 0; }
}
@keyframes hf-check {
    to { stroke-dashoffset: 0; }
}

.habibi-success-msg {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--hf-secondary);
    text-align: center;
    margin: 0 0 6px;
}

.habibi-redirect-msg {
    font-size: .825rem;
    color: var(--hf-gray-500);
    text-align: center;
    margin: 0;
}

/* =========================================
   MODAL
   ========================================= */

.habibi-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex !important;
    align-items: center;
    justify-content: center;
    animation: hf-fadein .25s ease;
}

.habibi-modal-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    margin: 16px;
}

.habibi-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background: var(--hf-gray-100);
    border: none;
    width: 30px; height: 30px;
    border-radius: 50%;
    font-size: .85rem;
    cursor: pointer;
    color: var(--hf-gray-500);
    transition: var(--hf-transition);
    display: flex; align-items: center; justify-content: center;
}

.habibi-modal-close:hover {
    background: var(--hf-error);
    color: var(--hf-white);
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 480px) {
    .habibi-auth-inner {
        padding: 28px 20px;
    }
    .habibi-otp-digit {
        width: 44px; height: 52px;
        font-size: 1.3rem;
    }
    .habibi-otp-fields {
        gap: 7px;
    }
}
