/* ========== Login Page Styles ========== */

/* Page Container */
.auth-page {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 1.5rem);
    background: var(--light-secondary);
    flex: 1;
    min-height: 0;
}

/* Container uses Bootstrap's default container class */

.auth-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: clamp(500px, 60vh, 700px);
    background: var(--light-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Left Side: Brand Section */
.auth-brand-section {
    background: linear-gradient(135deg, #1E3A5F 0%, #2C5282 50%, #1E3A5F 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    color: var(--light-bg);
    overflow: hidden;
}

.auth-brand-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
    z-index: 0;
}

.auth-brand-content {
    position: relative;
    z-index: 2;
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.auth-brand-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: clamp(0.5rem, 1.5vw, 1rem);
    color: var(--light-bg);
    transition: all 0.3s ease;
}

.auth-brand-subtitle {
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 400;
    margin-bottom: clamp(1rem, 3vw, 2rem);
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.auth-brand-description {
    margin-bottom: clamp(1.5rem, 4vw, 3rem);
}

.auth-brand-description p {
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.6;
    color: #FFFFFF;
    margin: 0;
    transition: all 0.3s ease;
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.auth-brand-features {
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 1.5vw, 1rem);
    transition: all 0.3s ease;
}

.feature-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.25rem, 1vw, 0.5rem);
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.feature-item i {
    font-size: clamp(1rem, 2vw, 1.1rem);
    color: rgba(255, 255, 255, 0.95);
}

/* Right Side: Form Section */
.auth-form-section {
    padding: clamp(1.5rem, 4vw, 3rem);
    background: var(--light-bg);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.auth-form-section .row {
    height: 100%;
    margin: 0;
}

.auth-form-section .col-12 {
    padding: 0;
}

.auth-form-wrapper {
    width: 100%;
    position: relative;
    z-index: 1;
}

.auth-form-header {
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 3rem);
}

.auth-form-title {
    font-size: clamp(1.75rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: clamp(0.25rem, 1vw, 0.5rem);
    transition: all 0.3s ease;
}

.auth-form-subtitle {
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    color: var(--text-secondary);
    margin: 0;
    transition: all 0.3s ease;
}

/* Form Loading Spinner (Initial Load) */
.auth-form-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    width: 100%;
}

.auth-form-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
    border-color: var(--primary-color);
    border-right-color: transparent;
    animation: spinner-border 0.75s linear infinite;
}

.auth-form-loading .spinner-border.text-primary {
    border-color: var(--primary-color);
    border-right-color: transparent;
}

/* Form Loading Overlay */
#loginFormApp .form-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    border-radius: var(--border-radius-lg);
    backdrop-filter: blur(2px);
}

#loginFormApp .form-loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
    border-color: var(--primary-color);
    border-right-color: transparent;
    animation: spinner-border 0.75s linear infinite;
}

#loginFormApp .form-loading-overlay .spinner-border.text-primary {
    border-color: var(--primary-color);
    border-right-color: transparent;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* Form Styles */
#loginFormApp {
    position: relative;
    width: 100%;
    min-height: 300px;
}

#loginFormApp .form-content-disabled {
    opacity: 0.6 !important;
    pointer-events: none !important;
    user-select: none !important;
    position: relative;
    z-index: 1;
    transition: opacity 0.3s ease;
}

#loginFormApp .form-content-disabled *,
#loginFormApp .form-content-disabled .el-input,
#loginFormApp .form-content-disabled .el-button,
#loginFormApp .form-content-disabled .el-checkbox,
#loginFormApp .form-content-disabled .el-link {
    pointer-events: none !important;
    cursor: not-allowed !important;
}

#loginFormApp .el-form {
    margin-bottom: clamp(1rem, 3vw, 2rem);
}

/* Password label row */
.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.form-label-row > span {
    flex: 0 1 auto;
}

.forgot-password-link {
    font-size: clamp(0.8rem, 1.8vw, 0.85rem);
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Element Plus Form - Label Position Top */
#loginFormApp .el-form--label-top .el-form-item__label {
    padding-bottom: 0.5rem;
}

/* Ensure required asterisk is shown by Element Plus and aligned */
#loginFormApp .el-form-item.is-required .el-form-item__label {
    display: flex;
    align-items: flex-start;
}

#loginFormApp .el-form-item.is-required .el-form-item__label::before {
    content: '*';
    color: var(--el-color-danger);
    margin-right: 4px;
    flex-shrink: 0;
    line-height: 1.5;
    margin-top: 0.125em;
}

/* Checkbox text wrap */
#loginFormApp .el-checkbox__label {
    white-space: normal;
    word-wrap: break-word;
}

/* Element Plus Input */
.auth-form .el-input {
    width: 100%;
    position: relative;
    z-index: 1;
}

.auth-form .el-input__wrapper {
    border-radius: var(--border-radius);
    position: relative;
    z-index: 1;
}

/* Element Plus Button */
.auth-submit-btn {
    width: 100%;
    position: relative;
    z-index: 1;
}

.auth-register-btn {
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Element Plus Checkbox and Link */
.auth-form .el-checkbox {
    position: relative;
    z-index: 1;
}

.auth-form .el-link {
    position: relative;
    z-index: 1;
}

/* Agreement Checkbox - Responsive */
.agreement-checkbox {
    font-size: clamp(0.8rem, 1.8vw, 0.875rem);
    line-height: 1.5;
    position: relative;
    z-index: 1;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
}

.agreement-checkbox .el-checkbox__label {
    color: var(--text-secondary);
    font-size: clamp(0.8rem, 1.8vw, 0.875rem);
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
}

.agreement-checkbox .el-link {
    font-size: clamp(0.8rem, 1.8vw, 0.875rem);
    white-space: normal;
    word-wrap: break-word;
}

/* Divider */
.auth-form-divider {
    text-align: center;
    margin: clamp(1rem, 3vw, 2rem) 0 clamp(0.75rem, 2vw, 1.5rem);
    position: relative;
}

.auth-form-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.auth-form-divider span {
    position: relative;
    background: var(--light-bg);
    padding: 0 clamp(0.5rem, 1.5vw, 1rem);
    color: var(--text-secondary);
    font-size: clamp(0.85rem, 2vw, 0.9rem);
}

/* Footer */
.auth-form-footer {
    text-align: center;
}

/* Captcha Dialog Styles */
.captcha-dialog :deep(.el-dialog) {
    width: 100% !important;
    max-width: 350px;
    margin: 5vh auto;
    box-sizing: border-box;
}

.captcha-dialog :deep(.el-dialog__body) {
    padding: 20px;
    box-sizing: border-box;
}

.captcha-dialog-content {
    text-align: center;
    padding: 10px 0;
}

.captcha-image-wrapper {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.captcha-loading {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.captcha-image {
    width: 100%;
    max-width: 280px;
    height: 120px;
    object-fit: contain;
    cursor: pointer;
    display: block;
    margin: 0 auto;
}

.captcha-input {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

/* Smooth responsive transitions */
@media (max-width: 991.98px) {
    .auth-wrapper {
        grid-template-columns: 1fr;
    }
    
    .auth-brand-section {
        display: none;
    }
}

/* Captcha Dialog Responsive */
@media (max-width: 575.98px) {
    .captcha-dialog :deep(.el-dialog) {
        width: 95% !important;
        max-width: 95% !important;
        margin: 2vh auto;
        padding: 0;
    }

    .captcha-dialog :deep(.el-dialog__body) {
        padding: 15px;
    }

    .captcha-image-wrapper {
        height: 100px;
    }

    .captcha-image {
        width: 100%;
        max-width: 280px;
        height: 100px;
    }

    .captcha-input {
        max-width: 100%;
    }
}
