/**
 * AYLogin - Modern RTL Styles
 * Minimalist design optimized for Iranian women 25-45
 */

/* ========================================================================
   Variables
   ======================================================================== */
:root {
    --aylogin-primary: #ff6b6b;
    --aylogin-primary-hover: #ff5252;
    --aylogin-success: #51cf66;
    --aylogin-error: #ff6b6b;
    --aylogin-text: #212529;
    --aylogin-text-light: #6c757d;
    --aylogin-border: #dee2e6;
    --aylogin-bg: #ffffff;
    --aylogin-bg-light: #f8f9fa;
    --aylogin-shadow: rgba(0, 0, 0, 0.1);
    --aylogin-shadow-lg: rgba(0, 0, 0, 0.15);
    --aylogin-radius: 12px;
    --aylogin-radius-sm: 8px;
}

/* ========================================================================
   Navigation Button
   ======================================================================== */
.aylogin-nav-btn,
.aylogin-nav-btn-account {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--aylogin-radius-sm);
    background: var(--aylogin-primary);
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.aylogin-nav-btn:hover,
.aylogin-nav-btn-account:hover {
    background: var(--aylogin-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--aylogin-shadow);
}

.aylogin-nav-btn .fa,
.aylogin-nav-btn-account .fa {
    font-size: 16px;
}

/* ========================================================================
   Header Button (Icon on Top)
   ======================================================================== */

.aylogin-header-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    min-width: 70px;
}

.aylogin-header-btn:hover {
    /* Disable translate and background change for header buttons on hover */
    background: transparent;
    transform: none;
    box-shadow: none;
}

.aylogin-header-btn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.aylogin-header-btn__icon .fa {
    font-size: 24px;
    color: var(--aylogin-primary);
    transition: color 0.3s ease;
}

.aylogin-header-btn:hover .aylogin-header-btn__icon .fa {
    color: var(--aylogin-primary-hover);
}

.aylogin-header-btn__text {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    direction: rtl;
}

.aylogin-header-btn--logged .aylogin-header-btn__icon .fa {
    color: var(--aylogin-success);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .aylogin-header-btn {
        padding: 6px 10px;
        min-width: 60px;
    }
    
    .aylogin-header-btn__icon .fa {
        font-size: 20px;
    }
    
    .aylogin-header-btn__text {
        font-size: 11px;
    }
}

/* ========================================================================
   Modal
   ======================================================================== */
.aylogin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ayloginFadeIn 0.3s ease;
}

@keyframes ayloginFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.aylogin-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.aylogin-modal-container {
    position: relative;
    background: var(--aylogin-bg);
    border-radius: var(--aylogin-radius);
    box-shadow: 0 20px 60px var(--aylogin-shadow-lg);
    max-width: 440px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: ayloginSlideUp 0.3s ease;
    direction: rtl;
}

@keyframes ayloginSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aylogin-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--aylogin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aylogin-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--aylogin-text);
    margin: 0;
}

.aylogin-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--aylogin-text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.aylogin-modal-close:hover {
    background: var(--aylogin-bg-light);
    color: var(--aylogin-text);
}

.aylogin-modal-body {
    padding: 24px;
}

.aylogin-modal-subtitle {
    font-size: 15px;
    color: var(--aylogin-text-light);
    margin: 0 0 24px;
    text-align: center;
}

/* ========================================================================
   Form Elements
   ======================================================================== */
.aylogin-form {
    width: 100%;
}

.aylogin-form-group {
    margin-bottom: 20px;
}

.aylogin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.aylogin-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--aylogin-text);
    margin-bottom: 8px;
}

.aylogin-required {
    color: var(--aylogin-error);
}

.aylogin-input-wrapper {
    position: relative;
}

.aylogin-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--aylogin-border);
    border-radius: var(--aylogin-radius-sm);
    font-size: 15px;
    color: var(--aylogin-text);
    background: var(--aylogin-bg);
    transition: all 0.2s ease;
    font-family: inherit;
    direction: ltr;
    text-align: right;
}

.aylogin-input-phone {
    padding-right: 44px;
}

.aylogin-input:focus {
    outline: none;
    border-color: var(--aylogin-primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.aylogin-input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--aylogin-text-light);
}

.aylogin-input-icon .fa {
    font-size: 18px;
}

.aylogin-input-otp {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 8px;
    direction: ltr;
}

.aylogin-hint {
    display: block;
    font-size: 13px;
    color: var(--aylogin-text-light);
    margin-top: 6px;
}

/* Password input wrapper */
.aylogin-password-wrapper {
    position: relative;
}

.aylogin-password-wrapper .aylogin-input {
    padding-left: 50px; /* RTL: padding on left for toggle button */
}

.aylogin-password-toggle {
    position: absolute;
    left: 12px; /* RTL: button on left side */
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--aylogin-text-light);
    transition: color 0.2s ease;
}

.aylogin-password-toggle:hover {
    color: var(--aylogin-text);
}

.aylogin-password-toggle .fa {
    font-size: 18px;
}

/* ========================================================================
   Buttons
   ======================================================================== */
.aylogin-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--aylogin-radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.aylogin-btn-primary {
    background: var(--aylogin-primary);
    color: #ffffff;
}

.aylogin-btn-primary:hover:not(:disabled) {
    background: var(--aylogin-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

.aylogin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.aylogin-btn-loader {
    display: none;
}

.aylogin-btn.loading .aylogin-btn-text {
    opacity: 0;
}

.aylogin-btn.loading .aylogin-btn-loader {
    display: flex;
}

.aylogin-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: ayloginSpin 0.6s linear infinite;
}

@keyframes ayloginSpin {
    to { transform: rotate(360deg); }
}

.aylogin-back-btn {
    background: transparent;
    border: none;
    color: var(--aylogin-text-light);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 16px;
    transition: color 0.2s ease;
}

.aylogin-back-btn:hover {
    color: var(--aylogin-text);
}

.aylogin-back-btn .fa {
    font-size: 16px;
}

.aylogin-link-secondary {
    display: inline-block;
    color: var(--aylogin-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.aylogin-link-secondary:hover {
    color: var(--aylogin-primary-hover);
    text-decoration: underline;
}

.aylogin-link-small {
    font-size: 13px;
}

.aylogin-links-wrapper {
    margin-top: 12px;
    text-align: center;
}

/* ========================================================================
   Divider
   ======================================================================== */
.aylogin-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: var(--aylogin-text-light);
    font-size: 13px;
}

.aylogin-divider::before,
.aylogin-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--aylogin-border);
}

.aylogin-divider span {
    padding: 0 12px;
}

/* ========================================================================
   Steps
   ======================================================================== */
.aylogin-step {
    display: none;
}

.aylogin-step-active {
    display: block;
    animation: ayloginFadeIn 0.3s ease;
}

.aylogin-otp-description {
    text-align: center;
    font-size: 15px;
    color: var(--aylogin-text);
    margin-bottom: 24px;
}

.aylogin-otp-description strong {
    color: var(--aylogin-primary);
    font-weight: 600;
    direction: ltr;
    display: inline-block;
}

.aylogin-resend-wrapper {
    text-align: center;
    margin-top: 16px;
}

.aylogin-welcome-text {
    text-align: center;
    font-size: 16px;
    color: var(--aylogin-text);
    margin-bottom: 24px;
    font-weight: 500;
}

/* ========================================================================
   Alerts
   ======================================================================== */
.aylogin-alert {
    padding: 12px 16px;
    border-radius: var(--aylogin-radius-sm);
    font-size: 14px;
    margin-top: 16px;
    animation: ayloginSlideDown 0.3s ease;
}

@keyframes ayloginSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aylogin-alert-success {
    background: rgba(81, 207, 102, 0.1);
    color: #2f9e44;
    border: 1px solid rgba(81, 207, 102, 0.3);
}

.aylogin-alert-error {
    background: rgba(255, 107, 107, 0.1);
    color: #c92a2a;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* ========================================================================
   Responsive
   ======================================================================== */
@media (max-width: 576px) {
    .aylogin-modal-container {
        width: 95%;
        max-width: none;
        margin: 0 2.5%;
    }
    
    .aylogin-modal-header,
    .aylogin-modal-body {
        padding: 20px;
    }
    
    .aylogin-form-row {
        grid-template-columns: 1fr;
    }
    
    .aylogin-modal-title {
        font-size: 20px;
    }
}

/* ========================================================================
   Accessibility
   ======================================================================== */
.aylogin-btn:focus,
.aylogin-input:focus,
.aylogin-modal-close:focus {
    outline: 2px solid var(--aylogin-primary);
    outline-offset: 2px;
}

/* Screen reader only */
.aylogin-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
