/**
 * Mobile Login IPPanel - Styles
 */

@font-face {
  font-family: 'Vazir';
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v27.0.2/dist/Vazir-Regular.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v27.0.2/dist/Vazir-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Modal popup */
.ml-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    height: 100vh;
    width: 100vw;
}

.ml-modal.is-open { display: block; }

.ml-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    cursor: pointer;
    z-index: 1;
}

.ml-modal-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
    pointer-events: none;
}

.ml-modal-dialog > * {
    pointer-events: auto;
}

.ml-modal-content-wrapper {
    position: relative;
    width: 100%;
    max-width: 420px;
}

.ml-modal .ml-login-container {
    min-height: auto;
    padding: 0;
    background: transparent;
}

.ml-modal .ml-login-box {
    margin: 0 auto;
    position: relative;
}

.ml-login-header {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-bottom: 32px;
}

.ml-modal-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    left: auto !important;
    inset-inline-end: 12px !important;
    inset-inline-start: auto !important;

    background: var(--ml-white) !important;
    border: 0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    border-radius: 50% !important;

    width: 44px !important;
    height: 44px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;

    font-size: 24px;
    line-height: 1 !important;
    cursor: pointer;
    color: var(--ml-text) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
}

.ml-modal-close:hover {
    background: var(--ml-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 480px) {
    .ml-modal-dialog {
        padding: 12px;
        min-height: auto;
    }

    .ml-modal-close {
        top: 12px !important;
        right: 12px !important;
        inset-inline-end: 12px !important;
        font-size: 28px;
    }
}

body.ml-modal-open { overflow: hidden; }

@font-face {
  font-family: 'Vazir';
  src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v27.0.2/dist/Vazir-Bold.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v27.0.2/dist/Vazir-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
    --ml-primary: var(--wd-primary-color, var(--wd-link-color, #6366f1));
    --ml-primary-dark: var(--wd-primary-color, #4f46e5);
    --ml-success: #10b981;
    --ml-error: #ef4444;
    --ml-warning: #f59e0b;
    --ml-text: #1f2937;
    --ml-text-light: #6b7280;
    --ml-border: #e5e7eb;
    --ml-bg: #f9fafb;
    --ml-white: #ffffff;
    --ml-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --ml-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Inside Woodmart login sidebar overlay */
.login-form-side .ml-login-container {
    min-height: auto;
    padding: 0;
    background: transparent;
}

.login-form-side .ml-login-box {
    width: 100%;
    max-width: none;
    padding: 0;
    box-shadow: none;
}

* {
    box-sizing: border-box;
}

.ml-login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: transparent;
    font-family: 'Vazir', Vazir, Tahoma, Arial, sans-serif;
    direction: rtl;
}

.ml-login-box {
    background: var(--ml-white);
    border-radius: 16px;
    box-shadow: var(--ml-shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px 32px;
    animation: mlFadeIn 0.3s ease-out;
}

@keyframes mlFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.ml-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--ml-primary) 0%, var(--ml-primary-dark) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ml-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--ml-text);
    margin: 0 0 8px;
}

.ml-subtitle {
    font-size: 14px;
    color: var(--ml-text-light);
    margin: 0;
}

.ml-login-form {
    margin-top: 32px;
}

.ml-form-group {
    margin-bottom: 24px;
}

.ml-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ml-text);
    margin-bottom: 8px;
}

.ml-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    direction: ltr;
    border: 2px solid var(--ml-border);
    border-radius: 12px;
    background: var(--ml-white);
    transition: all 0.2s;
}

.ml-input-wrapper:focus-within {
    border-color: var(--ml-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ml-input-prefix {
    padding: 0 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ml-text-light);
    border-right: 1px solid var(--ml-border);
    margin-right: 12px;
}

.ml-input,
.ml-code-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 16px;
    font-size: 16px;
    color: var(--ml-text);
    background: transparent;
    direction: ltr;
    text-align: left;
}

.ml-input::placeholder,
.ml-code-input::placeholder {
    color: #9ca3af;
}

.ml-code-input-wrapper {
    position: relative;
}

.ml-code-input {
    width: 100%;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 8px;
    border: 2px solid var(--ml-border);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
}

.ml-code-input:focus {
    border-color: var(--ml-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ml-resend-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
}

.ml-timer {
    color: var(--ml-text-light);
}

.ml-resend-btn {
    background: none;
    border: none;
    color: var(--ml-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.ml-resend-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}

.ml-error {
    display: block;
    color: var(--ml-error);
    font-size: 12px;
    margin-top: 6px;
    min-height: 18px;
}

.ml-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.ml-message.ml-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
    display: block;
}

.ml-message.ml-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    display: block;
}

.ml-submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--ml-primary) 0%, var(--ml-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ml-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.ml-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ml-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ml-btn-loader {
    display: inline-flex;
    align-items: center;
}

.ml-btn-loader svg {
    animation: mlSpin 1s linear infinite;
}

@keyframes mlSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.ml-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: var(--ml-text-light);
}

.ml-footer a {
    color: var(--ml-primary);
    text-decoration: none;
}

.ml-footer a:hover {
    text-decoration: underline;
}

.ml-logged-in {
    padding: 20px;
    text-align: center;
    background: var(--ml-bg);
    border-radius: 12px;
    color: var(--ml-text);
}

/* Responsive */
@media (max-width: 768px) {
    .ml-login-box {
        max-width: 100%;
        padding: 32px 24px;
    }

    .ml-input-wrapper,
    .ml-code-input-wrapper {
        border-radius: 10px;
    }

    .ml-input,
    .ml-code-input {
        padding: 12px 14px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .ml-modal-dialog {
        padding: 12px;
    }

    .ml-login-container {
        padding: 0;
    }

    .ml-login-box {
        padding: 24px 18px;
        border-radius: 12px;
    }

    .ml-login-header {
        margin-bottom: 20px;
    }

    .ml-logo {
        width: 56px;
        height: 56px;
        margin: 0 auto 12px;
    }

    .ml-title {
        font-size: 17px;
        margin: 0 0 4px;
    }

    .ml-subtitle {
        font-size: 12px;
    }

    .ml-form-group {
        margin-bottom: 16px;
    }

    .ml-label {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .ml-input-wrapper,
    .ml-code-input-wrapper {
        border-radius: 8px;
    }

    .ml-input,
    .ml-code-input {
        padding: 10px 12px;
        font-size: 15px;
    }

    .ml-input-prefix {
        padding: 0 10px;
        font-size: 13px;
    }

    .ml-code-input {
        font-size: 18px;
        letter-spacing: 2px;
        padding: 10px;
    }

    .ml-submit-btn {
        padding: 12px;
        font-size: 14px;
        margin-top: 8px;
    }

    .ml-footer {
        font-size: 10px;
        margin-top: 12px;
    }

    .ml-error {
        font-size: 10px;
        margin-top: 4px;
    }

    .ml-message {
        font-size: 12px;
        padding: 8px 10px;
        margin-bottom: 12px;
    }

    .ml-resend-wrapper {
        font-size: 12px;
        margin-top: 8px;
    }
}

/* Loading state */
.ml-loading .ml-btn-text {
    display: none;
}

.ml-loading .ml-btn-loader {
    display: inline-flex !important;
}

/* Success animation */
@keyframes mlSuccess {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.ml-success-animation {
    animation: mlSuccess 0.3s ease-out;
}

/* Login Method Tabs */
.ml-login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--ml-bg);
    padding: 6px;
    border-radius: 12px;
}

.ml-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--ml-text-light);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    font-family: inherit;
}

.ml-tab-btn:hover {
    color: var(--ml-text);
    background: rgba(255, 255, 255, 0.5);
}

.ml-tab-btn.active {
    background: var(--ml-white);
    color: var(--ml-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ml-tab-btn svg {
    flex-shrink: 0;
}

/* Password field styles */
.ml-password-wrapper {
    position: relative;
    overflow: hidden;
}

.ml-password-wrapper input {
    direction: ltr;
    padding-inline-start: 16px;
    padding-inline-end: 44px;
}

.ml-toggle-password {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 10px !important;
    left: auto !important;
    inset-inline-end: 10px !important;
    inset-inline-start: auto !important;

    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    line-height: 1 !important;

    background: transparent !important;
    border: 0 !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    text-decoration: none !important;

    cursor: pointer;
    color: var(--ml-text-light);
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: color 0.2s;
}

.ml-toggle-password:hover {
    color: var(--ml-text);
}

.ml-password-hint {
    font-size: 12px;
    color: var(--ml-text-light);
    margin-top: 8px;
    text-align: center;
}

.ml-forgot-password {
    background: transparent;
    border: 0;
    padding: 0;
    margin-top: 10px;
    color: var(--ml-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: right;
}

.ml-forgot-password:hover {
    color: var(--ml-primary-dark);
}

/* Mobile responsive for tabs */
@media (max-width: 480px) {
    .ml-login-tabs {
        padding: 4px;
        gap: 4px;
        margin-bottom: 16px;
    }
    
    .ml-tab-btn {
        padding: 10px 12px;
        font-size: 12px;
        gap: 4px;
    }
    
    .ml-tab-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .ml-password-hint {
        font-size: 10px;
    }

    .ml-password-wrapper input {
        padding-inline-end: 40px;
    }

    .ml-toggle-password {
        right: 10px;
        left: auto;
        inset-inline-end: 10px;
        padding: 4px;
    }

    .ml-toggle-password svg {
        width: 18px;
        height: 18px;
    }
}

/* User Status Message */
.ml-user-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.ml-user-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ml-user-status-text {
    flex: 1;
}

/* Existing user status */
.ml-status-existing {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0369a1;
    border: 1px solid #7dd3fc;
}

.ml-status-existing .ml-user-status-icon {
    background: rgba(3, 105, 161, 0.15);
}

/* New user status */
.ml-status-new {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.ml-status-new .ml-user-status-icon {
    background: rgba(146, 64, 14, 0.15);
}

/* Confirm password group */
.ml-confirm-password-group {
    margin-top: -8px;
}

/* Mobile responsive for user status */
@media (max-width: 480px) {
    .ml-user-status {
        padding: 10px 12px;
        font-size: 12px;
        gap: 8px;
    }
    
    .ml-user-status-icon {
        width: 28px;
        height: 28px;
    }
    
    .ml-user-status-icon svg {
        width: 14px;
        height: 14px;
    }
}

