@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700&display=swap');

/* =================================
   VARIABLES & GLOBAL STYLES
   ================================= */
:root {
    /* Color Palette - Unchanged as requested */
    --primary-color: #e4f04c;
    --primary-dark: #d4e03c;
    --primary-light: #f0f654;
    --secondary-color: #1a1a1a;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --background: #f8f9fa;
    --card-bg: #ffffff;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;

    /* Layout & Effects */
    --border-radius: 12px;
    --shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Smooth scrolling behavior */
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--background);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden; /* Prevents horizontal scroll, but layout should handle it */
    padding: 1rem 0; /* Add some vertical padding for very short screens */
}

/* =================================
   ANIMATED BACKGROUND
   ================================= */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    z-index: -2;
}

.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: var(--primary-color);
    top: -150px;
    right: -150px;
    animation-delay: 0s;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: #e3f2fd;
    bottom: -200px;
    left: -200px;
    animation-delay: 5s;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: #fce4ec;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    33% {
        transform: translateY(-30px) rotate(120deg);
    }
    66% {
        transform: translateY(30px) rotate(240deg);
    }
}

/* =================================
   CONTAINER & CARD
   ================================= */
.login-container,
.register-container {
    width: 100%;
    max-width: 450px;
    padding: 0 1rem; /* Horizontal padding for spacing from screen edges */
    margin: 2rem auto;
}

.register-container {
    max-width: 500px;
}

.login-card,
.register-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.login-card:hover,
.register-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* =================================
   CARD HEADER
   ================================= */
.login-header,
.register-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;
}

.login-header::after,
.register-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.5), transparent);
}

.logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--card-bg);
    border-radius: 50%;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.logo-container:hover {
    transform: scale(1.05);
}

.logo-container img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.login-title,
.register-title {
    color: var(--secondary-color);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-subtitle,
.register-subtitle {
    color: rgba(26, 26, 26, 0.7);
    font-size: 1rem;
    font-weight: 400;
}

/* =================================
   CARD BODY & FORM
   ================================= */
.login-body,
.register-body {
    padding: 2.5rem 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-label .required {
    color: var(--danger);
    margin-right: 0.25rem;
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
    pointer-events: none;
    transition: var(--transition);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: var(--transition);
    font-family: 'Vazirmatn', sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(228, 240, 76, 0.1);
}

.form-control:focus ~ .input-icon,
.input-group.focused .input-icon {
    color: var(--primary-color);
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Login Page specific options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin-left: 0.5rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.form-check-label {
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
}

.forgot-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.forgot-link:hover {
    color: var(--primary-color);
}

/* =================================
   COMPONENTS (Progress, Password, Buttons, Alerts)
   ================================= */

/* Progress bar container (for registration) */
.progress-bar-container {
    padding: 0 2rem;
    margin-top: -15px;
    position: relative;
    z-index: 1;
}

.progress {
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--success), var(--primary-color));
    transition: width 0.3s ease;
    width: 0%;
}

/* Password strength indicator */
.password-strength {
    margin-top: 0.5rem;
    height: 4px;
    background-color: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-bar.weak { width: 33%; background-color: var(--danger); }
.password-strength-bar.medium { width: 66%; background-color: var(--warning); }
.password-strength-bar.strong { width: 100%; background-color: var(--success); }

/* Buttons */
.btn-login,
.btn-register {
    width: 100%;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--secondary-color);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(228, 240, 76, 0.3);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-login::before,
.btn-register::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: 0;
}
.btn-login > *, .btn-register > * {
    position: relative; /* Ensure text/spinner is above the ::before ripple */
    z-index: 1;
}

.btn-login:hover::before,
.btn-register:hover::before {
    width: 300px;
    height: 300px;
}

.btn-login:hover,
.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(228, 240, 76, 0.4);
}

.btn-login:active,
.btn-register:active {
    transform: translateY(0);
}

.btn-login:disabled,
.btn-register:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Alert messages */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
}

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert i {
    margin-left: 0.5rem;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Success state icon */
.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.success-icon i {
    font-size: 2.5rem;
    color: #fff;
}

/* Loading spinner for button */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--secondary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =================================
   CARD FOOTER
   ================================= */
.login-footer,
.register-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.login-footer p,
.register-footer p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.login-footer a,
.register-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.login-footer a:hover,
.register-footer a:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

/* =================================
   RESPONSIVE DESIGN (Media Queries)
   ================================= */

/* Medium devices (tablets, less than 768px) */
@media (max-width: 768px) {
    .login-container,
    .register-container {
        margin: 1rem auto;
    }

    .shape-1 {
        width: 200px;
        height: 200px;
        top: -100px;
        right: -100px;
    }

    .shape-2 {
        width: 250px;
        height: 250px;
        bottom: -125px;
        left: -125px;
    }

    .shape-3 {
        width: 150px;
        height: 150px;
    }
}

/* Small devices (landscape phones, less than 576px) */
@media (max-width: 576px) {
    .login-header,
    .register-header {
        padding: 2rem 1.5rem;
    }

    .login-body,
    .register-body {
        padding: 2rem 1.5rem;
    }

    .login-title,
    .register-title {
        font-size: 1.5rem;
    }

    .logo-container {
        width: 70px;
        height: 70px;
    }

    .logo-container img {
        width: 40px;
        height: 40px;
    }

    .progress-bar-container {
        padding: 0 1.5rem;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }
}

/* Extra small devices (portrait phones, less than 420px) */
@media (max-width: 420px) {
    body {
        padding: 0; /* No vertical padding, align items to start */
        align-items: flex-start;
    }
    .login-container,
    .register-container {
        padding: 0; /* Container takes full width */
        margin: 0;
        max-width: 100%;
    }
    
    .login-card,
    .register-card {
        border-radius: 0; /* No radius on full-width card */
        box-shadow: none;
        min-height: 100vh;
    }
    
    .login-card:hover,
    .register-card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .login-header,
    .register-header {
        padding: 2rem 1.25rem;
    }

    .login-body,
    .register-body {
        padding: 2rem 1.25rem;
    }

    .login-title,
    .register-title {
        font-size: 1.35rem;
    }

    .login-subtitle,
    .register-subtitle {
        font-size: 0.9rem;
    }
    
    .progress-bar-container {
        padding: 0 1.25rem;
    }
}
