/**
 * Kindergarten-Themed Login Styles
 * Soft pastel colors, rounded corners, friendly design for school management
 */

/* ===== CSS Variables - Pastel Color Palette ===== */
:root {
    --kindergarten-blue: #E3F2FD;
    --kindergarten-green: #E8F5E9;
    --kindergarten-yellow: #FFF8E1;
    --kindergarten-pink: #FCE4EC;
    --kindergarten-purple: #F3E5F5;

    --primary-blue: #5C9BCB;
    --primary-green: #7CB342;
    --accent-orange: #FFA726;

    --text-primary: #37474F;
    --text-secondary: #607D8B;
    --border-color: #CFD8DC;

    --shadow-soft: 0 10px 40px rgba(92, 155, 203, 0.15);
    --shadow-input: 0 2px 8px rgba(92, 155, 203, 0.1);
}

/* ===== Sunny Sky Background with Moving Clouds ===== */
/* ===== Body/HTML - Remove default backgrounds ===== */
body,
html {
    margin: 0;
    padding: 0;
}

/* ===== Sunny Sky Background with Moving Clouds ===== */
.sky-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1; /* Mobile: stay behind everything */
    overflow: hidden;
    background: linear-gradient(180deg, #4FC3F7 0%, #81D4FA 40%, #B3E5FC 100%);
}

/* Desktop/Tablet (>768px): Raise z-index to appear behind login-container */
@media (min-width: 769px) {
    .sky-background {
        z-index: 0; /* Lower, not too high */
    }

    .login-container {
        position: relative;
        z-index: 1; /* Login container above sky */
    }
}

/* ===== Sun ===== */
.sun-container {
    position: absolute;
    top: 50px;
    right: 80px;
    width: 140px;
    height: 140px;
}

.sun {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90px;
    height: 90px;
    background: radial-gradient(circle, #FFEB3B 0%, #FBC02D 60%, #F57C00 100%);
    border-radius: 50%;
    box-shadow: 0 0 60px rgba(255, 235, 59, 0.8), 0 0 100px rgba(251, 192, 45, 0.5);
}

.sun-rays {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    background: repeating-conic-gradient(
        from 0deg,
        transparent 0deg 5deg,
        rgba(255, 255, 255, 0.4) 5deg 10deg
    );
    border-radius: 50%;
    animation: sun-rotate 20s linear infinite;
}

@keyframes sun-rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===== Clouds ===== */
.cloud-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

.cloud {
    position: absolute;
    background: #FFFFFF;
    border-radius: 50px;
    animation: float-cloud linear infinite;
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: #FFFFFF;
    border-radius: 50%;
}

/* Cloud Small */
.cloud-small {
    width: 120px;
    height: 40px;
}

.cloud-small::before {
    top: -25px;
    left: 20px;
    width: 35px;
    height: 35px;
}

.cloud-small::after {
    top: -18px;
    right: 20px;
    width: 28px;
    height: 28px;
}

/* Cloud Medium */
.cloud-medium {
    width: 160px;
    height: 55px;
}

.cloud-medium::before {
    top: -35px;
    left: 25px;
    width: 48px;
    height: 48px;
}

.cloud-medium::after {
    top: -25px;
    right: 25px;
    width: 38px;
    height: 38px;
}

/* Cloud Large */
.cloud-large {
    width: 200px;
    height: 70px;
}

.cloud-large::before {
    top: -45px;
    left: 30px;
    width: 60px;
    height: 60px;
}

.cloud-large::after {
    top: -32px;
    right: 30px;
    width: 48px;
    height: 48px;
}

/* Cloud Animation - move from left to right across screen */
@keyframes float-cloud {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(200vw + 500px));
    }
}

/* Different speeds for each layer (parallax effect) */
.cloud-layer-1 .cloud { animation-duration: 45s; opacity: 0.95; }
.cloud-layer-2 .cloud { animation-duration: 60s; opacity: 0.88; }
.cloud-layer-3 .cloud { animation-duration: 38s; opacity: 0.92; }
.cloud-layer-4 .cloud { animation-duration: 75s; opacity: 0.85; }

/* ===== Login Container ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ===== Login Card ===== */
.kindergarten-card {
    background: #FFFFFF;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    max-width: 960px;
    width: 100%;
    display: flex;
    flex-direction: row;
}

/* ===== Illustration Side ===== */
.kindergarten-card__illustration {
    flex: 1;
    background: linear-gradient(135deg, var(--kindergarten-blue) 0%, var(--kindergarten-purple) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 400px; /* Minimum height for illustration area */
    position: relative;
    overflow: hidden;
}

.kindergarten-card__illustration::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate-bg 30s linear infinite;
}

@keyframes rotate-bg {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== SVG Wrappers - Desktop/Mobile Responsive ===== */
.svg-desktop-wrapper,
.svg-mobile-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Desktop SVG - shown on larger screens */
.svg-desktop-wrapper {
    display: block;
}

/* Mobile SVG - hidden by default, shown on smaller screens */
.svg-mobile-wrapper {
    display: none;
}

/* ===== Reunification Day Theme SVG Containers ===== */
.kindergarten-svg-container--mobile {
    display: none;
}

@media (max-width: 992px) {
    .kindergarten-svg-container--mobile {
        display: block;
        background-image: url('/Content/img/3004_xs.png');
        background-size: cover;
        width: 100%;
        height: 100%;
        position: relative;
    }
}

/* SVG Container styles */
.kindergarten-svg-container {
    width: 100%;
    height: 100%;
    position: relative;
    background-image: url('/Content/img/3004.png');
    background-size: cover;
}

/* SVG element - stretches to fill container completely */
.kindergarten-svg-container svg {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Stretch and crop to fill container */
    display: block;
}

/* ===== Form Side ===== */
.kindergarten-card__form {
    flex: 1.2;
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
}

/* ===== Logo Area ===== */
.login-logo-area {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo-area__logo {
    width: 80px;
    height: 40px;
    background: url('/content/img/edulink-logo.png') no-repeat center center;
    background-size: contain;
    margin: 0 auto 15px;
}

.login-logo-area__name {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* ===== Welcome Text ===== */
.login-welcome {
    text-align: center;
    margin-bottom: 35px;
}

.login-welcome__title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.login-welcome__subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
}

/* ===== Form Elements ===== */
.login-form .form-group {
    margin-bottom: 24px;
    position: relative;
}

/* Ensure form maintains layout during submit */
.login-form {
    flex-shrink: 0; /* Prevent form from collapsing */
}

.login-form__label-wrapper {
    position: relative;
}

.login-form__input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    background: #FAFAFA;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.login-form__input::placeholder {
    color: #B0BEC5;
}

.login-form__input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: #FFFFFF;
    box-shadow: var(--shadow-input);
}

.login-form__input.error {
    border-color: #EF5350;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.login-form__icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
    transition: color 0.3s ease;
}

.login-form__input:focus + .login-form__icon,
.login-form__input:not(:placeholder-shown) + .login-form__icon {
    color: var(--primary-blue);
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 5px;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--primary-blue);
}

/* ===== Validation Messages ===== */
.login-form__error-message {
    color: #EF5350;
    font-size: 13px;
    margin-top: 6px;
    display: none;
}

.login-form__error-message.visible {
    display: block;
}

/* ===== Remember Me & Forgot Password ===== */
.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.remember-me__checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: #FFFFFF;
}

.remember-me__checkbox::after {
    content: '✓';
    color: white;
    font-size: 12px;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.remember-me input:checked + .remember-me__checkbox {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
}

.remember-me input:checked + .remember-me__checkbox::after {
    opacity: 1;
    transform: scale(1);
}

.remember-me input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.forgot-password {
    font-size: 14px;
    color: var(--primary-blue);
    text-decoration: none;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #2A7AB8;
    text-decoration: underline;
}

/* ===== Login Button ===== */
.login-button {
    width: 100%;
    height: 52px;
    min-height: 52px;
    padding: 0 16px;
    line-height: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #4A90E2 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: box-shadow 0.3s ease, background 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box;
    flex-shrink: 0;
    transform: none !important;
    -webkit-transform: none !important;
}

.login-button:hover:not(.login-loading) {
    box-shadow: 0 6px 20px rgba(92, 155, 203, 0.4);
}

    .login-button:active:not(.login-loading) {
        transform: none;
        box-shadow: none;
    }

/* Disabled/Loading state - prevent pointer events and maintain appearance */
    .login-button.login-loading,
    .login-button:disabled {
        cursor: not-allowed;
        opacity: 1; /* Keep full opacity, don't fade out */
        pointer-events: none; /* Prevent clicks while loading */
    }

.login-button__text {
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease;
    transform: none;
}

.login-button.login-loading .login-button__text {
    opacity: 0;
    transform: none;
    pointer-events: none;
}

.login-button__spinner {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    animation: none;
}

.login-button.login-loading .login-button__spinner {
    opacity: 1;
    visibility: visible;
    animation: login-spinner 0.8s linear infinite;
}

@keyframes login-spinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Divider ===== */
.login-divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.login-divider__line {
    height: 1px;
    background: var(--border-color);
    margin: 0 auto;
    width: 100%;
}

/* ===== SSO Button ===== */
.sso-button {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    background: #FFFFFF;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sso-button:hover {
    background: var(--kindergarten-blue);
    border-color: var(--primary-blue);
}

/* SSO Icon - Base styles */
.sso-button__icon {
    margin-right: 12px;
    flex-shrink: 0;
}

/* Image icon variant (for SSO) */
.sso-button__icon--image {
    width: 28px;
    height: 28px;
    background-image: url('/Content/img/LogoSo.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

/* ===== Social Links ===== */
.login-social {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.login-social__link {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
}

.login-social__link--facebook {
    background: #E8F4FD;
    color: #1877F2;
}

.login-social__link--youtube {
    background: #FFE5E5;
    color: #FF0000;
}

.login-social__link--home {
    background: #E8F5E9;
    color: #4CAF50;
}

.login-social__link:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===== Error Alert ===== */
.login-error-alert {
    background: #FFEBEE;
    border-left: 4px solid #EF5350;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: none;
}

.login-error-alert.visible {
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease;
}

/* ===== OTP Info Alert ===== */
.otp-info-alert {
    background: #E3F2FD;
    border-left: 4px solid var(--primary-blue);
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    animation: slideIn 0.3s ease;
}

.otp-info-alert__icon {
    font-size: 24px;
    margin-right: 12px;
    flex-shrink: 0;
}

.otp-info-alert__content {
    color: #1565C0;
    font-size: 14px;
    line-height: 1.5;
}

/* ===== OTP Countdown ===== */
.otp-countdown {
    text-align: center;
    margin-bottom: 20px;
    padding: 12px;
    background: #FFF8E1;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.otp-countdown a {
    color: var(--primary-green);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

/* ===== Back to Login Link ===== */
.login-back-to-login {
    text-align: center;
    margin-top: 24px;
    margin-bottom: 10px;
}

.back-to-login-link {
    color: var(--text-secondary);
    font-size: 14px;
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.back-to-login-link:hover {
    color: var(--primary-blue);
}

.back-to-login-link__arrow {
    font-size: 18px;
}

/* ===== Select Input Styles (for LoginSSO) ===== */
.login-form__select,
.select2-container--default .select2-selection--single {
    height: 54px !important; /* Matches input height: 16px padding × 2 + 15px font + 2px border × 2 = ~54-60px */
    min-height: 54px !important;
    max-height: 54px !important;
}

/* Select2 selection area - remove default padding that adds height */
.select2-container--default .select2-selection--single {
    padding: 0 !important;
}

/* Rendered text area inside select2 - align vertically */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 54px !important; /* Full height for vertical centering */
    padding-left: 52px !important; /* Space for icon */
    padding-right: 20px !important;
    height: 54px !important;
}

/* Select2 clear button alignment */
.select2-container--default .select2-selection--single .select2-selection__clear {
    width: 24px !important;
    height: 24px !important;
    margin-top: 15px !important; /* (54 - 24) / 2 */
}

/* Select2 dropdown arrow alignment */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 54px !important;
    top: 0 !important;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-error-alert__icon {
    font-size: 24px;
    margin-right: 12px;
}

.login-error-alert__text {
    color: #C62828;
    font-size: 14px;
    line-height: 1.5;
}

/* ===== Responsive Design ===== */
@media (max-width: 992px) {
    /* Switch SVGs - hide desktop, show mobile */
    .svg-desktop-wrapper {
        display: none;
    }

    .svg-mobile-wrapper {
        display: block;
    }

    .kindergarten-card {
        flex-direction: column;
        max-width: 500px;
    }

    .kindergarten-card__illustration {
        padding: 15px;
        min-height: 380px; /* Taller for vertical SVG */
        order: -1; /* Illustration on top of form */
    }

    .kindergarten-card__form {
        padding: 40px 30px;
    }
}

@media (max-width: 576px) {
    .login-container {
        padding: 15px;
    }

    .kindergarten-card {
        border-radius: 20px;
    }

    .kindergarten-card__illustration {
        padding: 15px;
        min-height: 280px;
    }

    .kindergarten-card__form {
        padding: 35px 25px;
    }

    .login-logo-area__name {
        font-size: 24px;
    }

    .login-welcome__title {
        font-size: 22px;
    }

    .login-form__input {
        padding: 14px 18px 14px 46px;
        font-size: 14px;
    }

    .login-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
