/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazir FD', 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    color: #1e293b;
    transition: background-color 0.3s ease;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    font-variant-numeric: tabular-nums;
}

* {
    font-feature-settings: "ss02";
}

.container {
    max-width: 420px;
    width: 100%;
    z-index: 1;
}

/* Form containers */
.form-container {
    background: white;
    border-radius: 24px;
    padding: 40px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 20px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}


@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.logo-image {
    max-width: 200px;
    height: auto;
    border-radius: 16px;
    width: 100%;
    max-width: 180px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.07));
    transition: transform 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.02);
}

.form-container p {
    color: #64748b;
    margin-bottom: 32px;
    line-height: 1.6;
    font-size: 16px;
    font-weight: 400;
}

/* Form elements */
form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-group {
    position: relative;
    width: 100%;
}

input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    background: #ffffff;
    color: #1e293b;
    box-sizing: border-box;
}

input:focus {
    outline: none;
    border-color: #1626b7;
    box-shadow:
        0 0 0 3px rgba(22, 38, 183, 0.1),
        0 1px 3px 0 rgba(22, 38, 183, 0.1);
    transform: translateY(-1px);
}

input:hover:not(:focus) {
    border-color: #cbd5e1;
}

input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Input validation states */
input:valid {
    border-color: #10b981;
}

input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

/* Buttons */
button {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    position: relative;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button[type="submit"] {
    background: #1626b7;
    color: white;
    box-shadow: 0 4px 12px rgba(22, 38, 183, 0.25);
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(22, 38, 183, 0.35);
    background: #1e40af;
}

button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(22, 38, 183, 0.25);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#resendBtn {
    background: #f1f5f9;
    color: #475569;
    margin-top: 16px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    padding: 12px 24px;
    font-weight: 500;
}

#resendBtn:hover:not(.countdown-active) {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #334155;
}

/* Countdown state styling */
#resendBtn.countdown-active {
    cursor: not-allowed;
    transition: all 0.3s ease;
}

#resendBtn.countdown-active:hover {
    transform: none;
    box-shadow: none;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    min-width: 300px;
    max-width: 500px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    position: relative;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #10b981;
    color: white;
    border: none;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.3);
}

.toast.error {
    background: #ef4444;
    color: white;
    border: none;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.3);
}

.toast.warning {
    background: #f59e0b;
    color: white;
    border: none;
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.3);
}

.toast.info {
    background: #3b82f6;
    color: white;
    border: none;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3);
}

.toast .close-btn {
    position: absolute;
    top: 8px;
    left: 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toast .close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}



/* Hidden class */
.hidden {
    display: none;
}

/* Loading animation */
.loading {
    opacity: 0.8;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* Form transitions */
.form-container {
    animation: slideInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Focus animations */
input:focus {
    animation: focusPulse 0.3s ease;
}

@keyframes focusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(22, 38, 183, 0.1);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(22, 38, 183, 0.1);
    }
}

/* Validation animations */
.valid-animation {
    animation: validPulse 0.3s ease;
}

@keyframes validPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Button shimmer effect */
button:not(:disabled):hover {
    animation: none;
}

button:not(:disabled):hover::before {
    animation: shimmer 0.5s ease-in-out;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */

/* Large Desktop */
@media (min-width: 1200px) {
    .container {
        max-width: 450px;
    }

    .logo-image {
        max-width: 220px;
    }
}

/* Desktop */
@media (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 420px;
    }

    .logo-image {
        max-width: 200px;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991px) {
    .container {
        max-width: 380px;
        padding: 25px;
    }

    .form-container {
        padding: 25px;
    }

    .logo-image {
        max-width: 160px;
    }

    input {
        padding: 14px 18px;
        font-size: 16px;
    }

    button {
        padding: 14px 28px;
        font-size: 16px;
    }
}

/* Mobile Large */
@media (min-width: 481px) and (max-width: 767px) {
    .container {
        max-width: 90%;
        padding: 15px;
    }

    .form-container {
        padding: 20px;
        border-radius: 20px;
    }

    .logo-image {
        max-width: 140px;
        border-radius: 8px;
    }

    .form-container p {
        font-size: 15px;
        margin-bottom: 20px;
    }

    input {
        padding: 13px 16px;
        font-size: 16px;
    }

    button {
        padding: 13px 26px;
        font-size: 16px;
        border-radius: 12px;
    }
}

/* Mobile Small */
@media (max-width: 480px) {
    .container {
        max-width: 95%;
        padding: 10px;
    }

    .form-container {
        padding: 18px;
        border-radius: 16px;
    }

    .logo-image {
        max-width: 120px;
        border-radius: 6px;
    }

    .form-container p {
        font-size: 14px;
        margin-bottom: 18px;
    }

    input {
        padding: 12px 15px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 10px;
    }

    button {
        padding: 12px 24px;
        font-size: 16px;
        border-radius: 10px;
    }


    /* Adjust toast for mobile */
    .toast-container {
        top: 15px;
        left: 10px;
        right: 10px;
        transform: none;
    }

    .toast {
        max-width: none;
        margin-bottom: 8px;
        font-size: 13px;
        padding: 12px 16px;
        border-radius: 10px;
    }
}

/* Extra Small Mobile */
@media (max-width: 360px) {
    .container {
        padding: 8px;
    }

    .form-container {
        padding: 15px;
    }

    .logo-image {
        max-width: 100px;
    }

    input {
        padding: 11px 14px;
    }

    button {
        padding: 11px 20px;
        font-size: 15px;
    }

    .toast {
        font-size: 12px;
        padding: 10px 14px;
    }
}

/* Focus states for accessibility */
button:focus,
input:focus {
    outline: 2px solid #1626b7;
    outline-offset: 2px;
}
