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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Animated background particles */
.bg-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.particle:nth-child(1) {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    width: 120px;
    height: 120px;
    top: 60%;
    left: 80%;
    animation-delay: 2s;
}

.particle:nth-child(3) {
    width: 60px;
    height: 60px;
    top: 80%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 450px;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.government-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.7);
    position: relative;
    overflow: hidden;
}

.government-logo::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.logo-icon {
    font-size: 3rem;
    color: white;
    z-index: 2;
    position: relative;
}

.welcome-text {
    color: #2c3e50;
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 2.5rem;
    font-weight: 400;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    color: #555;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafbfc;
    outline: none;
}

.form-control:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

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

.icon-input {
    position: relative;
}

.icon-input::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-size: contain;
    opacity: 0.6;
    z-index: 2;
}

.email-input::before {
    content: '📧';
    font-size: 1.2rem;
}

.password-input::before {
    content: '🔒';
    font-size: 1.2rem;
}

.icon-input .form-control {
    padding-left: 3rem;
}

.sign-in-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.sign-in-btn::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;
}

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

.sign-in-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

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

.footer-text {
    text-align: center;
    color: #95a5a6;
    font-size: 0.875rem;
    margin-top: 2rem;
    line-height: 1.5;
}

.footer-text strong {
    color: #667eea;
    font-weight: 600;
}

/* Responsive design */
@media (max-width: 480px) {
    .login-container {
        margin: 1rem;
        padding: 2rem 1.5rem;
    }

    .welcome-text {
        font-size: 1.5rem;
    }

    .government-logo {
        width: 100px;
        height: 100px;
    }
}

/* Loading animation */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading .sign-in-btn::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 10px;
}

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

/* Custom spinner positioning for the sign-in button */
.sign-in-btn.kt-spinner.kt-spinner--right:before,
.sign-in-btn.kt-spinner.kt-spinner--right.kt-spinner--sm:before,
.sign-in-btn.kt-spinner.kt-spinner--right.kt-spinner--sm.kt-spinner--light:before {
    right: 1.5rem !important;
    top: 50% !important;
    margin-top: -10px !important;
    position: absolute !important;
}

/* Adjust padding for the button when spinner is active */
.sign-in-btn.kt-spinner.kt-spinner--right,
.sign-in-btn.kt-spinner.kt-spinner--right.kt-spinner--sm,
.sign-in-btn.kt-spinner.kt-spinner--right.kt-spinner--sm.kt-spinner--light {
    padding-right: 3.5rem !important;
    position: relative !important;
}

/* Ensure the spinner is visible with proper styling */
.sign-in-btn.kt-spinner:before {
    content: '' !important;
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid #ffffff !important;
    border-right: 2px solid transparent !important;
    border-radius: 50% !important;
    animation: kt-spinner .5s linear infinite !important;
}

/*
Note: CSS updates to adjust icon position when validation error message is shown below the input field
- Moves the icon inside .icon-input to the bottom when:
  1) The input is invalid (HTML5 validation), or
  2) A sibling error message element exists inside the same .form-group (class .error-message or .invalid-feedback)
This is scoped to the login page styles and will not affect other pages unless they use the same structure.
*/

/* Case 1: HTML5 validation invalid state */
.icon-input:has(input:invalid)::before {
    top: auto;
    bottom: 0.75rem; /* equal to vertical padding to sit nicely inside input */
    transform: none;
}

/* Case 2: Custom error message rendered below the input within the same .form-group */
.form-group:has(.error-message) .icon-input::before,
.form-group:has(.invalid-feedback) .icon-input::before {
    top: auto;
    bottom: 0.75rem;
    transform: none;
}

/* Optional: Only move icon for the email field if you want to scope tighter */
.form-group:has(.error-message) .email-input::before,
.form-group:has(.invalid-feedback) .email-input::before,
.email-input:has(input:invalid)::before {
    top: auto;
    bottom: 0.75rem;
    transform: none;
}
