/* Hide Porto's default login dropdown */
.block-header-customer-login {
    display: none !important;
}

/* Override Porto's CSS that hides .greet - show welcome message inline */
.header.links > li.greet.welcome,
.panel.header .greet.welcome,
li.greet.welcome {
    display: inline-block !important;
    vertical-align: middle;
}

li.greet.welcome .logged-in,
li.greet.welcome .not-logged-in {
    display: inline !important;
}

/* ==================== POPUP OVERLAY ==================== */
.login-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

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

/* ==================== POPUP CONTAINER ==================== */
.login-popup-container {
    background: #fff;
    border-radius: 12px;
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==================== CLOSE BUTTON ==================== */
.login-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    line-height: 1 !important;
    padding: 4px !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    margin: 0 !important;
    z-index: 10;
    border-radius: 50% !important;
}

.login-popup-close:hover {
    transform: rotate(90deg);
    opacity: 0.8;
}

.login-popup-close svg {
    display: block;
    width: 28px;
    height: 28px;
}

/* ==================== CONTENT ==================== */
.login-popup-content {
    padding: 40px 30px 30px;
    text-align: center;
}

/* ==================== LOGO ==================== */
.login-popup-logo {
    margin-bottom: 12px;
}

.login-popup-logo img {
    max-width: 118px;
    height: auto;
}

/* ==================== TITLE ==================== */
.login-popup-title {
    font-family: 'Open Sans', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #0E0D0D;
    margin: 0 0 6px;
    line-height: 1.36;
    text-transform: capitalize;
}

/* ==================== SUBTITLE ==================== */
.login-popup-subtitle {
    font-family: 'Open Sans', sans-serif;
    font-size: 18px;
    font-weight: 400;
    color: #333;
    margin: 0 0 24px;
    line-height: 1.36;
    background: linear-gradient(90deg, rgba(0, 0, 0, 1) 23%, rgba(102, 102, 102, 1) 67%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== OTP SUBTITLE ==================== */
.otp-subtitle {
    font-family: 'Poppins', 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #0E0D0D;
    margin: 0 0 28px;
    line-height: 1.5;
    text-align: center;
}

.otp-subtitle span {
    font-weight: 500;
}

/* ==================== MESSAGE ==================== */
.login-popup-message {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.login-popup-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.login-popup-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ==================== LOGIN STEPS ==================== */
.login-step {
    display: none !important;
}

.login-step.active {
    display: block !important;
}

/* ==================== FORM GROUP ==================== */
.form-group {
    margin-bottom: 15px;
}

/* ==================== FLOATING LABEL ==================== */
.floating-label-group {
    position: relative !important;
    margin-bottom: 15px;
    display: block !important;
}

.floating-label {
    position: absolute !important;
    left: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 18px !important;
    color: #999 !important;
    pointer-events: none !important;
    transition: all 0.3s ease !important;
    background: #fff !important;
    padding: 0 8px !important;
    z-index: 1 !important;
    line-height: 1.2 !important;
    display: inline-block !important;
    margin: 0 !important;
    text-transform: capitalize;
}

/* ==================== INPUT FIELDS ==================== */
.login-input {
    width: 100%;
    padding: 18px 20px !important;
    border: 1.5px solid #C5C5C5;
    border-radius: 8px !important;
    font-size: 16px !important;
    color: #0E0D0D;
    box-sizing: border-box;
    transition: all 0.3s;
    position: relative;
    z-index: 0;
    height: 64px !important;
    line-height: 1.4 !important;
    background: #fff;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
}

.login-input:focus {
    outline: none !important;
    border-color: #EE3E54 !important;
    box-shadow: none !important;
}

.login-input::placeholder {
    color: transparent;
}

/* Valid state */
.floating-label-group .login-input.input-valid,
.floating-label-group .login-input.has-value.input-valid,
.login-input.input-valid {
    border-color: #23AC00 !important;
}

.login-input.input-valid:focus,
.floating-label-group .login-input.input-valid:focus {
    border-color: #23AC00 !important;
}

/* Invalid state */
.floating-label-group .login-input.input-invalid,
.floating-label-group .login-input.has-value.input-invalid,
.login-input.input-invalid {
    border-color: #dc3545 !important;
}

.login-input.input-invalid:focus,
.floating-label-group .login-input.input-invalid:focus {
    border-color: #dc3545 !important;
}

/* Has value (active) state */
.floating-label-group .login-input.has-value {
    border-color: #C5C5C5 !important;
}

/* Float the label when input is focused or has value */
.floating-label-group .login-input:focus + .floating-label,
.floating-label-group .login-input.has-value + .floating-label {
    top: 12px !important;
    transform: none !important;
    font-size: 13px !important;
    color: #999 !important;
    font-weight: 400 !important;
    padding: 0 2px !important;
    background: transparent !important;
}

/* Provide room for floated label */
.floating-label-group .login-input:focus,
.floating-label-group .login-input.has-value {
    padding-top: 26px !important;
    padding-bottom: 5px !important;
    color: #0E0D0D !important;
}

/* ==================== SUBMIT BUTTON ==================== */
.login-submit-btn {
    width: 100%;
    padding: 16px 20px;
    background: #EE3E54 !important;
    border: none;
    border-radius: 12px !important;
    color: #fff !important;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Open Sans', sans-serif;
    text-transform: capitalize;
    line-height: 1.36;
}

.login-submit-btn:hover {
    background: #d63549 !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(238, 62, 84, 0.3);
}

.login-submit-btn:active {
    transform: translateY(0);
}

.login-submit-btn:disabled,
.login-submit-btn.disabled {
    background: #EE3E54 !important;
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

/* ==================== OTP BOXES ==================== */
.otp-boxes-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.otp-box {
    width: 60px;
    height: 58px;
    text-align: center;
    font-family: 'Poppins', 'Open Sans', sans-serif;
    font-size: 20px;
    font-weight: 500;
    color: #0E0D0D;
    border: 1px solid #C5C5C5;
    border-radius: 4px;
    background: #fff;
    transition: all 0.2s ease;
    outline: none;
    padding: 0;
    -moz-appearance: textfield;
}

.otp-box::-webkit-outer-spin-button,
.otp-box::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.otp-box:focus,
.otp-box.otp-box-focused {
    border-color: #EE3E54;
    box-shadow: 0 0 0 2px rgba(238, 62, 84, 0.15);
}

/* Filled OTP box */
.otp-box:not(:placeholder-shown) {
    border-color: #C5C5C5;
}

/* ==================== OTP TIMER ==================== */
.otp-timer-text {
    font-family: 'Poppins', 'Open Sans', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #747474;
    margin: 0 0 20px;
    text-align: left;
    text-transform: capitalize;
    line-height: 1.5;
}

.otp-timer-text span {
    font-weight: 500;
    color: #0E0D0D;
}

/* ==================== OR DIVIDER ==================== */
.otp-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0;
}

.otp-divider-line {
    flex: 1;
    height: 1px;
    background: #D8D8D8;
}

.otp-divider-text {
    font-family: 'Poppins', 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #747474;
    text-transform: uppercase;
    padding: 0 8px;
}

/* ==================== CHANGE NUMBER BUTTON ==================== */
.change-number-btn {
    width: 100%;
    background: #FEF1E9 !important;
    border: none;
    border-radius: 2px;
    color: #EE3E54 !important;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 24px;
    text-align: center;
    text-transform: capitalize;
    transition: all 0.3s;
    line-height: 1.36;
}

.change-number-btn:hover {
    background: #fde5d6 !important;
    transform: translateY(-1px);
}

/* ==================== LINK BUTTON ==================== */
.login-link-btn {
    background: transparent;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    margin-top: 10px;
    padding: 5px;
}

.login-link-btn:hover {
    color: #EE3E54;
    background-color: white;
}

#resend-register-otp-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==================== PASSWORD GROUP ==================== */
.password-group {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    z-index: 2;
}

.toggle-password img {
    display: block;
    width: 20px;
    height: 20px;
    opacity: 0.5;
    cursor: pointer;
}

.toggle-password:hover img {
    opacity: 1;
}

.toggle-password:hover {
    background: transparent !important;
    border: 0 !important;
}

/* ==================== CHECKBOX GROUP ==================== */
.checkbox-group {
    text-align: left;
    margin: 15px 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

/* ==================== FOOTER ==================== */
.login-popup-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.login-popup-footer p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.login-popup-footer a {
    color: #EE3E54;
    font-weight: 600;
    text-decoration: none;
}

.login-popup-footer a:hover {
    text-decoration: underline;
}

/* ==================== LOADING STATE ==================== */
.login-submit-btn.loading {
    position: relative;
    color: transparent !important;
}

.login-submit-btn.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
}

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

/* ==================== SOCIAL LOGIN ==================== */
.login-popup-content .block-sociallogin {
    margin: 20px 0 0 0;
}

.login-popup-content .block-sociallogin .block-title {
    margin-bottom: 15px;
    text-align: center;
    position: relative;
}

.login-popup-content .block-sociallogin .block-title strong {
    background: #fff;
    padding: 0 10px;
    position: relative;
    z-index: 1;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.login-popup-content .block-sociallogin .block-title:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.login-popup-content .social-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-popup-content .social-login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    border-radius: 8px !important;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    gap: 10px;
    font-size: 15px;
}

.login-popup-content .social-login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.login-popup-content .social-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.login-popup-content .facebook-login {
    background-color: #1877f2 !important;
    color: #fff !important;
    border: 1px solid #1877f2;
}

.login-popup-content .facebook-login:hover {
    background-color: #145dbf !important;
    border-color: #145dbf;
}

.login-popup-content .facebook-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z'/%3E%3C/svg%3E");
}

.login-popup-content .google-login {
    background-color: #fff !important;
    color: #757575 !important;
    border: 1px solid #dadce0;
}

.login-popup-content .google-login:hover {
    background-color: #f8f9fa !important;
    border-color: #d2d4d6;
}

.login-popup-content .google-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234285F4' d='M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z'/%3E%3Cpath fill='%2334A853' d='M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z'/%3E%3Cpath fill='%23FBBC05' d='M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z'/%3E%3Cpath fill='%23EA4335' d='M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z'/%3E%3C/svg%3E");
}

.login-popup-content .apple-login {
    background-color: #000 !important;
    color: #fff !important;
    border: 1px solid #000;
}

.login-popup-content .apple-login:hover {
    background-color: #333 !important;
    border-color: #333;
}

.login-popup-content .apple-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z'/%3E%3C/svg%3E");
}

/* ==================== RTL SUPPORT ==================== */
html[dir="rtl"] .login-popup-close {
    right: auto;
    left: 20px;
}

html[dir="rtl"] .toggle-password {
    right: auto;
    left: 15px;
}

html[dir="rtl"] .floating-label {
    left: auto !important;
    right: 20px !important;
}

html[lang="ar"] .floating-label {
    left: auto !important;
    right: 20px !important;
}

html[dir="rtl"] .otp-timer-text,
html[lang="ar"] .otp-timer-text {
    text-align: right;
}

html[dir="rtl"] .checkbox-group input[type="checkbox"] {
    margin-right: 0;
    margin-left: 8px;
}

html[lang="ar"] .toggle-password {
    left: 5px !important;
    right: unset !important;
}

html[lang="ar"] #register-mobile-input {
    text-align: right;
}

/* RTL OTP boxes - reverse direction */
html[dir="rtl"] .otp-boxes-container,
html[lang="ar"] .otp-boxes-container {
    direction: ltr;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 600px) {
    .login-popup-container {
        width: 95%;
        margin: 20px;
    }

    .login-popup-content {
        padding: 30px 20px;
    }

    .login-popup-title {
        font-size: 24px;
    }

    .login-popup-subtitle {
        font-size: 16px;
    }

    .otp-box {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .otp-boxes-container {
        gap: 6px;
    }

    .otp-timer-text {
        font-size: 13px;
    }

    .login-popup-content .social-login-button {
        font-size: 14px;
        padding: 12px 15px;
    }
}

@media (max-width: 400px) {
    .otp-box {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }

    .otp-boxes-container {
        gap: 4px;
    }
}
