@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap");

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Vazirmatn", "Tahoma", "Arial", sans-serif;
    color: #fff;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    direction: rtl;
}

.container {
    position: relative;
    width: 750px;
    height: auto !important;
    min-height: 490px;
    transition: min-height 0.6s ease;
    border: 2px solid #4a9eff;
    box-shadow: 0 0 25px #4a9eff;
    overflow: hidden;
    border-radius: 15px;
}

.container .form-box {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    display: flex;
    justify-content: center;
    flex-direction: column;
}

.form-box.Login {
    left: 0;
    padding: 0 40px;
}

.form-box.Login .animation {
    transform: translateX(0%);
    transition: 0.7s;
    opacity: 1;
    transition-delay: calc(0.1s * var(--S));
}

.container.active .form-box.Login .animation {
    transform: translateX(-120%);
    opacity: 0;
    transition-delay: calc(0.1s * var(--D));
}

.form-box.Register {
    /* display: none; */
    right: 0;
    padding: 0 60px;
}

.form-box.Register .animation {
    transform: translateX(120%);
    transition: 0.7s ease;
    opacity: 0;
    filter: blur(10px);
    transition-delay: calc(0.1s * var(--S));
}

.container.active .form-box.Register .animation {
    transform: translateX(0%);
    opacity: 1;
    filter: blur(0px);
    transition-delay: calc(0.1s * var(--li));
}

.form-box h2 {
    font-size: 32px;
    text-align: center;
}

.form-box .input-box {
    position: relative;
    width: 100%;
    height: 50px;
    margin-top: 25px;
}

.input-box input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-size: 16px;
    color: #fff;
    font-weight: 600;
    border-bottom: 2px solid #fff;
    padding-right: 23px;
    padding-left: 23px;
    text-align: right;
    direction: rtl;
    transition: 0.5s;
}

.input-box input:focus,
.input-box input:valid {
    border-bottom: 2px solid #4a9eff;
}

.input-box label {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    font-size: 16px;
    color: #fff;
    visibility: hidden;
    opacity: 0;
    transition: 0.5s;
}

.input-box input:focus ~ label,
.input-box input:valid ~ label {
    visibility: visible;
    opacity: 1;
    top: -13px;
    color: #4a9eff;
}

.input-box box-icon {
    position: absolute;
    top: 50%;
    left: 0;
    font-size: 18px;
    transform: translateY(-50%);
    color: #fff;
}

.input-box input:focus ~ box-icon,
.input-box input:valid ~ box-icon {
    color: #4a9eff;
}

.btn {
    position: relative;
    width: 100%;
    height: 45px;
    background: transparent;
    border-radius: 40px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid #4a9eff;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: "";
    position: absolute;
    height: 300%;
    width: 100%;
    background: linear-gradient(#1a1a2e, #4a9eff, #1a1a2e, #4a9eff);
    top: -100%;
    left: 0;
    z-index: -1;
    transition: 0.5s;
}

.btn:hover:before {
    top: 0;
}

.regi-link {
    font-size: 14px;
    text-align: center;
    margin: 20px 0 10px;
}

.regi-link a {
    text-decoration: none;
    color: #4a9eff;
    font-weight: 600;
}

.regi-link a:hover {
    text-decoration: underline;
}

.info-content {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    display: flex;
    justify-content: center;
    flex-direction: column;
}

.info-content.Login {
    right: 0;
    text-align: right;
    padding: 0 40px 60px 150px;
}

.info-content.Login .animation {
    transform: translateX(0);
    transition: 0.7s ease;
    transition-delay: calc(0.1s * var(--S));
    opacity: 1;
    filter: blur(0px);
}

.container.active .info-content.Login .animation {
    transform: translateX(120%);
    opacity: 0;
    filter: blur(10px);
    transition-delay: calc(0.1s * var(--D));
}

.info-content.Register {
    /* display: none; */
    left: 0;
    text-align: left;
    padding: 0 150px 60px 38px;
    pointer-events: none;
}

.info-content.Register .animation {
    transform: translateX(-120%);
    transition: 0.7s ease;
    opacity: 0;
    filter: blur(10px);
    transition-delay: calc(0.1s * var(--S));
}

.container.active .info-content.Register .animation {
    transform: translateX(0%);
    opacity: 1;
    filter: blur(0);
    transition-delay: calc(0.1s * var(--li));
}

.info-content h2 {
    text-transform: uppercase;
    font-size: 36px;
    line-height: 1.3;
}

.info-content p {
    font-size: 16px;
    text-align: center;
}

.container .curved-shape {
    position: absolute;
    right: 0;
    top: -5px;
    height: 600px;
    width: 850px;
    background: linear-gradient(45deg, #1a1a2e, #4a9eff);
    /*transform: rotate(10deg) skewY(40deg);*/
    transform: rotate(10deg) skewY(40deg);
    transform-origin: bottom right;
    transition: 1.5s ease;
    transition-delay: 1.6s;
}

.container.active .curved-shape {
    transform: rotate(0deg) skewY(0deg);
    transition-delay: 0.5s;
}

.container .curved-shape2 {
    position: absolute;
    left: 250px;
    top: 100%;
    height: 700px;
    width: 850px;
    background: #1a1a2e;
    border-top: 3px solid #4a9eff;
    transform: rotate(0deg) skewY(0deg);
    transform-origin: bottom left;
    transition: 1.5s ease;
    transition-delay: 0.5s;
}

.container.active .curved-shape2 {
    transform: rotate(-11deg) skewY(-41deg);
    transition-delay: 1.2s;
}

/* خطای ورود */

/* بکگراند بلور شده هنگام نمایش خطا */
.container.blur {
    filter: blur(5px);
    pointer-events: none; /* غیرفعال کردن کلیک روی پشت صفحه */
}

/* پنجره خطا */
.error-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* پشت زمینه نیمه شفاف */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.error-content {
    background: #fff;
    padding: 30px 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.error-content h2 {
    color: #e74c3c;
    margin-bottom: 15px;
}

.error-content p {
    font-size: 16px;
    color: #333;
    margin-bottom: 20px;
}

.close-btn {
    background: #e74c3c;
    border: none;
    color: #fff;
    font-size: 20px;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
}

/* =========================
   Responsive & UI Polish
   ========================= */

/* نرم‌تر شدن انیمیشن‌ها */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* بهبود خوانایی متن */
h2 {
    letter-spacing: 0.5px;
}

p {
    line-height: 1.8;
}

/* زیباسازی input در موبایل */
.input-box input {
    font-size: 15px;
}

/* hover نرم‌تر دکمه */
.btn {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 158, 255, 0.4);
}

/* =========================
   Tablet (<= 1024px)
   ========================= */
@media (max-width: 1024px) {
    .container {
        width: 90%;
        height: auto;
        min-height: 500px;
    }

    .info-content.Login,
    .info-content.Register {
        padding: 40px;
    }

    .container .curved-shape,
    .container .curved-shape2 {
        width: 700px;
    }
}

/* =========================
   Mobile (<= 768px)
   ========================= */
@media (max-width: 768px) {
    body {
        padding: 20px;
    }

    .container {
        width: 100%;
        height: auto;
        min-height: 100vh;
        border-radius: 20px;
    }

    /* مخفی شدن بخش اطلاعات در موبایل */
    .info-content {
        display: none;
    }

    /* فرم‌ها فول‌ویدث */
    .container .form-box {
        width: 100%;
        position: relative;
        padding: 40px 25px;
        position: relative;
        min-height: 420px;
    }

    .form-box {
        position: relative;
        min-height: 420px;
    }

    /* وقتی لاگین فعاله */
    .container:not(.active) {
        min-height: 420px;
    }

    /* وقتی رجیستر فعاله */
    .container.active {
        min-height: 480px;
    }

    .container:not(.active) .form-box.Register {
        position: absolute;
        pointer-events: none;
    }

    .container.active .form-box.Login {
        position: absolute;
        pointer-events: none;
    }

    .form-box.Login,
    .form-box.Register {
        left: 0;
        right: 0;
    }

    /* غیرفعال کردن شکل‌های سنگین */
    .container .curved-shape,
    .container .curved-shape2 {
        display: none;
    }

    .form-box h2 {
        font-size: 28px;
        margin-bottom: 10px;
    }

    .regi-link {
        font-size: 13px;
    }
}

/* =========================
   Small Mobile (<= 480px)
   ========================= */
@media (max-width: 480px) {
    .form-box h2 {
        font-size: 24px;
    }

    .input-box {
        margin-top: 20px;
    }

    .btn {
        height: 42px;
        font-size: 15px;
    }
}

/* =========================
   Error Popup Animation
   ========================= */
.error-popup {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.error-content {
    animation: slideUp 0.5s ease forwards;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
