Shader "Custom/ScrollingLine"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _Speed ("Scroll Speed", Float) = 1.0
        _Tiling ("Texture Tiling", Float) = 1.0
        _Color ("Color Tint", Color) = (1,1,1,1) // Add color support
    }

    SubShader
    {
        Tags { "RenderPipeline" = "UniversalRenderPipeline" "Queue"="Transparent" }
        Pass
        {
            Blend SrcAlpha OneMinusSrcAlpha // Enable transparency
            Cull Off
            ZWrite Off // Prevent depth writing (helps transparency)

            HLSLPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"

            struct appdata_t
            {
                float4 position : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float4 position : SV_POSITION;
                float2 uv : TEXCOORD0;
            };

            sampler2D _MainTex;
            float4 _MainTex_ST;
            float _Speed;
            float _Tiling;
            float4 _Color; // Color support

            v2f vert (appdata_t v)
            {
                v2f o;
                o.position = TransformObjectToHClip(v.position);
                float2 offset = float2(_Time.y * _Speed, 0); // Scroll the texture horizontally
                o.uv = TRANSFORM_TEX(v.uv, _MainTex) * float2(_Tiling, 1) + offset;
                return o;
            }

            half4 frag (v2f i) : SV_Target
            {
                half4 texColor = tex2D(_MainTex, i.uv);
                return texColor * _Color; // Apply color tint
            }
            ENDHLSL
        }
    }
}