/* ========================================
   Auth Pages Stylesheet
   Shared styles for authentication pages
   ======================================== */

:root {
    --primary-color: #2e8b57;
    --primary-light: #5fb483;
    --primary-dark: #1e6b42;
    --secondary-color: #4a90e2;
    --accent-color: #f39c12;
    --danger-color: #e74c3c;
    --success-color: #27ae60;
    --info-color: #3498db;
    --text-dark: #2c3e50;
    --text-medium: #546e7a;
    --text-light: #7f8c8d;
    --bg-light: #fafbfc;
    --bg-white: #ffffff;
    --border-light: #e1e8ed;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IRANSans', 'dana', sans-serif;
    background: 
        linear-gradient(135deg, rgba(227, 242, 237, 0.95) 0%, rgba(240, 248, 245, 0.9) 50%, rgba(250, 252, 251, 0.95) 100%),
        linear-gradient(45deg, #e8f5e9 25%, transparent 25%, transparent 75%, #e8f5e9 75%, #e8f5e9),
        linear-gradient(45deg, #e8f5e9 25%, transparent 25%, transparent 75%, #e8f5e9 75%, #e8f5e9);
    background-size: 400% 400%, 60px 60px, 60px 60px;
    background-position: 0% 50%, 0 0, 30px 30px;
    animation: gradientShift 20s ease infinite;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(46, 139, 87, 0.08) 0%, transparent 35%),
        radial-gradient(circle at 85% 80%, rgba(74, 144, 226, 0.06) 0%, transparent 35%),
        radial-gradient(circle at 50% 50%, rgba(243, 156, 18, 0.04) 0%, transparent 40%);
    z-index: 0;
    pointer-events: none;
    animation: pulseBackground 15s ease-in-out infinite;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(46, 139, 87, 0.02) 2px,
            rgba(46, 139, 87, 0.02) 4px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(74, 144, 226, 0.015) 2px,
            rgba(74, 144, 226, 0.015) 4px
        );
    z-index: 0;
    pointer-events: none;
}

@keyframes pulseBackground {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Page Loader */
.page_loader {
    position: fixed;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e3f2ed 0%, #d4e8df 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page_loader::after {
    content: '';
    width: 60px;
    height: 60px;
    border: 5px solid rgba(74, 157, 111, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Decorative Background Waves */
.login-container::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 300px;
    background: 
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%234a9d6f" fill-opacity="0.05" d="M0,192L48,197.3C96,203,192,213,288,229.3C384,245,480,267,576,250.7C672,235,768,181,864,181.3C960,181,1056,235,1152,234.7C1248,235,1344,181,1392,154.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom,
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%235fb483" fill-opacity="0.03" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,138.7C960,139,1056,117,1152,106.7C1248,96,1344,96,1392,96L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
    z-index: 0;
    pointer-events: none;
    opacity: 0.7;
}

.login-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 300px;
    background: 
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%234a90e2" fill-opacity="0.04" d="M0,64L48,85.3C96,107,192,149,288,154.7C384,160,480,128,576,128C672,128,768,160,864,160C960,160,1056,128,1152,112C1248,96,1344,96,1392,96L1440,96L1440,0L1392,0C1344,0,1248,0,1152,0C1056,0,960,0,864,0C768,0,672,0,576,0C480,0,384,0,288,0C192,0,96,0,48,0L0,0Z"></path></svg>') no-repeat top;
    background-size: cover;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
}

/* Login Container */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: white;
    border-radius: 24px;
    box-shadow: 
        0 12px 40px rgba(0,0,0,0.08),
        0 2px 8px rgba(0,0,0,0.04),
        inset 0 1px 0 rgba(255,255,255,0.8);
    overflow: hidden;
    max-width: 1000px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    animation: slideUp 0.6s ease;
    border: 1px solid rgba(46, 139, 87, 0.08);
}

.login-card.single-column {
    grid-template-columns: 1fr;
    max-width: 600px;
}

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

/* Form Section */
.form-section {
    padding: 45px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo-wrapper {
    text-align: center;
    margin-bottom: 25px;
}

.logo-wrapper img {
    max-width: 130px;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.form-header {
    text-align: center;
    margin-bottom: 28px;
}

.form-header h2 {
    color: var(--text-dark);
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.form-header h3 {
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.form-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-label i {
    margin-left: 8px;
    color: var(--primary-color);
}

.input-wrapper {
    position: relative;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: linear-gradient(to bottom, #ffffff, #fafbfc);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 4px rgba(109, 184, 142, 0.12);
}

.form-control::placeholder {
    color: #bdc3c7;
}

.form-control.is-invalid {
    border-color: var(--danger-color) !important;
    background: #fff5f5;
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1);
}

/* Password Toggle */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-light);
    font-size: 1.2rem;
    transition: color 0.3s ease;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.password-wrapper .form-control {
    padding-left: 50px;
}

/* Captcha Styling */
.captcha-wrapper {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
}

.captcha-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.captcha-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(to bottom, #fafbfc, #f5f7f9);
    padding: 12px;
    border-radius: 12px;
    border: 2px solid #e1e8ed;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.captcha-display:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 6px rgba(46, 139, 87, 0.08);
}

.captcha-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    padding: 10px;
    min-width: 310px;
}

.captcha-image-wrapper img,
.captcha-image {
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 180px;
    height: auto !important;
    min-height: 50px;
}

.captcha-image-wrapper img:hover,
.captcha-image:hover {
    transform: scale(1.05);
}

/* Style default captcha widget */
input#id_captcha_0 {
    /* Hidden field - must be in DOM for form submission */
}

.captcha-image-wrapper .captcha {
    width: 180px !important;
    height: auto !important;
    min-height: 50px !important;
    border-radius: 8px;
    display: block !important;
}

/* Force image to maintain aspect ratio */
.captcha-image-wrapper .captcha,
.captcha-image-wrapper img {
    object-fit: contain;
}

.captcha-refresh-btn {
    background: var(--primary-light);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.captcha-refresh-btn:hover {
    background: var(--primary-color);
    transform: rotate(180deg);
}

.captcha-refresh-btn:active {
    transform: rotate(180deg) scale(0.95);
}

.captcha-input-wrapper {
    position: relative;
}

.captcha-input-wrapper input {
    padding-right: 45px;
}

.captcha-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.captcha-hint {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.captcha-hint i {
    font-size: 1rem;
}

/* Captcha Success Indicator */
.captcha-success {
    display: none;
    align-items: center;
    gap: 8px;
    color: var(--success-color);
    font-size: 0.9rem;
    margin-top: 8px;
    animation: slideIn 0.3s ease;
}

.captcha-success.show {
    display: flex;
}

.captcha-success i {
    font-size: 1.2rem;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Keyboard accessibility */
.captcha-refresh-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.captcha-image:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Captcha Loading State */
.captcha-loading {
    position: relative;
}

.captcha-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes captchaRefresh {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.refreshing {
    animation: captchaRefresh 0.6s ease;
}

/* Alert Messages */
.alert-custom {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: shake 0.5s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.alert-error {
    background: #ffebee;
    border: 2px solid #ef9a9a;
    color: #c62828;
}

.alert-success {
    background: #e8f5e9;
    border: 2px solid #a5d6a7;
    color: #2e7d32;
}

.alert-custom i {
    font-size: 1.5rem;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 
        0 4px 12px rgba(46, 139, 87, 0.2),
        0 2px 4px rgba(46, 139, 87, 0.1);
}

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

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 157, 111, 0.25);
}

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

.btn-submit.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #e57373);
    box-shadow: 
        0 4px 12px rgba(231, 76, 60, 0.2),
        0 2px 4px rgba(231, 76, 60, 0.1);
}

.btn-submit.btn-danger:hover {
    box-shadow: 
        0 8px 20px rgba(231, 76, 60, 0.25),
        0 4px 8px rgba(231, 76, 60, 0.15);
}

/* Links */
.form-links {
    margin-top: 22px;
    text-align: center;
}

.form-links p {
    color: var(--text-light);
    font-size: 0.93rem;
    margin-bottom: 12px;
}

.form-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.form-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.divider {
    margin: 20px 0;
    text-align: center;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
}

/* Info Section */
.info-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    padding: 45px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.15),
        inset 0 -1px 0 rgba(0,0,0,0.05);
}

.info-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.05)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,138.7C960,139,1056,117,1152,106.7C1248,96,1344,96,1392,96L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
    opacity: 0.3;
}

.info-content {
    position: relative;
    z-index: 1;
}

.info-icon {
    font-size: 3.8rem;
    margin-bottom: 22px;
    animation: float 3s ease-in-out infinite;
    opacity: 0.95;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.info-section h1 {
    font-size: 1.9rem;
    font-weight: bold;
    margin-bottom: 16px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.info-section p {
    font-size: 0.98rem;
    line-height: 1.7;
    opacity: 0.92;
    max-width: 380px;
}

.info-features {
    margin-top: 30px;
    display: grid;
    gap: 16px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.12);
    padding: 14px 18px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.feature-item i {
    font-size: 1.5rem;
}

.feature-item span {
    font-size: 0.95rem;
}

/* Success Message */
.success-message {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 5rem;
    color: var(--success-color);
    margin-bottom: 30px;
    animation: scaleIn 0.6s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-message h3 {
    color: var(--text-dark);
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.success-message p {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 30px;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.button-group .btn-submit {
    flex: 1;
}

/* SMS Code Input */
.sms-code-group {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.sms-code-group .form-control {
    flex: 1;
}

.countdown-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    color: var(--danger-color);
    font-weight: 600;
}

.countdown-container span {
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 992px) {
    .login-card {
        grid-template-columns: 1fr;
    }

    .info-section {
        order: -1;
        padding: 35px 28px;
    }

    .form-section {
        padding: 35px 28px;
    }

    .info-section h1 {
        font-size: 1.7rem;
    }
    
    .info-icon {
        font-size: 3.2rem;
    }
}

@media (max-width: 576px) {
    .form-section {
        padding: 30px 20px;
    }

    .form-header h2 {
        font-size: 1.5rem;
    }

    .captcha-wrapper {
        grid-template-columns: 1fr;
    }

    .captcha-display {
        justify-content: center;
    }

    .captcha-image-wrapper {
        min-width: 200px;
    }

    .captcha-image-wrapper img,
    .captcha-image-wrapper .captcha,
    .captcha-image {
        max-width: 200px;
    }

    .captcha-hint {
        font-size: 0.8rem;
    }

    .back-home span {
        display: none;
    }

    .back-home {
        padding: 12px 15px;
    }

    .button-group {
        flex-direction: column;
    }

    .sms-code-group {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Back to Home Button */
.back-home {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.95);
    color: var(--primary-color);
    padding: 12px 25px;
    border-radius: 50px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid rgba(74, 157, 111, 0.2);
}

.back-home:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    border-color: var(--primary-color);
}

.back-home i {
    font-size: 1.2rem;
}

