/* Modern Login Page Styles */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --success-color: #4caf50;
    --info-color: #2196f3;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --dark-color: #212121;
    --light-color: #f5f5f5;
    --text-color: #333333;
    --text-muted: #6c757d;
    --border-color: #e0e0e0;
    --border-radius: 10px;
    --box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    background-color: #f5f7fa;
    color: var(--text-color);
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    font-size: 14px;
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Main Auth Wrapper */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.85), rgba(63, 55, 201, 0.75));
    z-index: 1;
}

.auth-container {
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 2;
}

/* Auth Card */
.auth-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    animation: fadeIn 0.8s ease-in-out;
    padding: 40px;
}

.login-form-container {
    width: 100%;
    margin: 0 auto;
}

.login-header {
    position: relative;
    bottom: 15px;
    margin-top: -5px;
}

.header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.welcome-content {
    text-align: left;
    flex: 1;
}

.login-logo {
    margin-left: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.login-logo img {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
    transition: var(--transition);
}

.login-logo img:hover {
    transform: scale(1.05);
}

.welcome-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 5px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease;
}

.welcome-title.animated {
    opacity: 1;
    transform: translateY(0);
}

.school-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease 0.1s;
}

.school-title.animated {
    opacity: 1;
    transform: translateY(0);
}

.animated-bar {
    width: 80px;
    height: 4px;
    background: var(--primary-color);
    margin: 0 0 20px 0;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: scaleX(0.5);
    transition: all 0.5s ease 0.2s;
}

.animated-bar.animated {
    opacity: 1;
    transform: scaleX(1);
}

.animated-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    animation: barAnimation 2s infinite;
}

/* Form Styles */
.login-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--transition);
    background: #f9f9f9;
}

.input-group.input-focused {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    color: var(--text-muted);
    font-size: 16px;
}

.form-control {
    flex: 1;
    border: none;
    background: transparent;
    height: 50px;
    padding: 0 15px;
    color: var(--dark-color);
    font-size: 15px;
    width: 100%;
    outline: none;
}

.form-control:focus {
    outline: none;
}

.password-toggle {
    padding: 0 15px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

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

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* Custom Checkbox */
.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: var(--transition);
}

.custom-checkbox:hover input ~ .checkmark {
    background-color: #e9e9e9;
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 7px;
    top: 3px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.forgot-password a {
    color: var(--primary-color);
    font-size: 14px;
    text-decoration: none;
    transition: var(--transition);
}

.forgot-password a:hover {
    text-decoration: underline;
}

/* Login Button */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 50px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
    margin-top: 10px;
}

.btn-login:hover, .btn-login.btn-hover {
    background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

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

.btn-login:focus {
    outline: none;
}

.btn-text {
    margin-right: 10px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-login.btn-hover .btn-icon {
    transform: translateX(5px);
}

/* --- Login Button Spinner and Shake Animation --- */
.btn-login .spinner-border {
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle;
    margin-right: 0.5em;
    display: none;
}
.btn-login.loading .spinner-border {
    display: inline-block;
}
.btn-login.loading .btn-text,
.btn-login.loading .btn-icon {
    opacity: 0.5;
}
@keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
    100% { transform: translateX(0); }
}
.btn-login.shake {
    animation: shake 0.5s;
}

/* Login Footer */
.login-footer {
    text-align: center;
    margin-top: 30px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Error Messages */
span.error {
    color: var(--danger-color);
    font-size: 12px;
    display: block;
    margin-top: 5px;
}

.has-error .input-group {
    border-color: var(--danger-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes barAnimation {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}


/* --- Enhanced AJAX Login Error Box (with transitions) --- */
.login-error-box {
    background: rgba(244, 67, 54, 0.10);
    border: 1.5px solid #f44336;
    color: #b71c1c;
    border-radius: 7px;
    font-size: 15px;
    font-weight: 500;
    padding: 12px 18px;
    margin-bottom: 18px;
    box-shadow: 0 2px 12px 0 rgba(244,67,54,0.13), 0 0 0 0 rgba(244,67,54,0.15);
    display: none;
    animation: fadeInDown 0.5s;
    letter-spacing: 0.01em;
    position: relative;
    transition: background 0.3s, box-shadow 0.3s, color 0.3s;
}
.login-error-box:before {
    content: '\26A0';
    color: #f44336;
    font-size: 18px;
    margin-right: 8px;
    vertical-align: middle;
    transition: color 0.3s;
}
.login-error-box.pulse {
    animation: errorPulse 1.2s infinite alternate;
}
@keyframes errorPulse {
    0% { box-shadow: 0 2px 12px 0 rgba(244,67,54,0.13), 0 0 0 0 rgba(244,67,54,0.15); }
    100% { box-shadow: 0 2px 24px 0 rgba(244,67,54,0.22), 0 0 8px 4px rgba(244,67,54,0.10); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Improved Shake Animation for Login Button --- */
@keyframes shake-strong {
    0% { transform: translateX(0); }
    10% { transform: translateX(-12px); }
    20% { transform: translateX(12px); }
    30% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    50% { transform: translateX(-8px); }
    60% { transform: translateX(8px); }
    70% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
    90% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}
.btn-login.shake {
    animation: shake-strong 0.7s cubic-bezier(.36,.07,.19,.97) both;
}

/* --- Button Color Transitions & Shadow Pulse --- */
.btn-login {
    transition: background 0.3s, box-shadow 0.3s, color 0.2s, transform 0.2s;
}
.btn-login.loading, .btn-login:active {
    background: linear-gradient(90deg, #3f37c9 0%, #4361ee 100%);
    color: #fff;
    box-shadow: 0 0 0 0 rgba(67,97,238,0.15), 0 4px 15px rgba(67,97,238,0.25);
    animation: btnPulse 1.2s infinite alternate;
}
@keyframes btnPulse {
    0% { box-shadow: 0 4px 15px rgba(67,97,238,0.25); }
    100% { box-shadow: 0 8px 32px 0 rgba(67,97,238,0.35), 0 0 8px 2px rgba(67,97,238,0.10); }
}

/* --- Always show spinner when loading --- */
.btn-login .spinner-border {
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle;
    margin-right: 0.5em;
    display: none;
    transition: opacity 0.2s;
}
.btn-login.loading .spinner-border {
    display: inline-block !important;
    opacity: 1;
}


/* Responsive Styles */
@media (max-width: 576px) {
    .auth-container {
        max-width: 100%;
    }
    
    .auth-card {
        padding: 30px 20px;
    }
    
    .header-flex {
        flex-direction: column-reverse;
        align-items: center;
        text-align: center;
    }
    
    .welcome-content {
        text-align: center;
        margin-top: 15px;
    }
    
    .login-logo {
        margin-left: 0;
        margin-bottom: 10px;
    }
    
    .animated-bar {
        margin: 0 auto 20px;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .welcome-title {
        font-size: 18px;
    }
    
    .school-title {
        font-size: 20px;
    }
    
    .login-logo img {
        height: 60px;
    }
}

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

.pulse {
    animation: pulse 0.8s ease-in-out;
}

/* Forgot Password Styles */
.forgot-instructions {
    margin-bottom: 25px;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
}

.alert-success {
    background-color: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.2);
    color: var(--success-color);
}

.alert-danger {
    background-color: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.2);
    color: var(--danger-color);
}

.mr-2 {
    margin-right: 10px;
}

.mb-4 {
    margin-bottom: 20px;
}

.back-to-login {
    text-align: center;
    margin-top: 20px;
}

.back-to-login a {
    color: var(--primary-color);
    font-size: 14px;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.back-to-login a i {
    margin-right: 8px;
    font-size: 12px;
}

.back-to-login a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Legacy Support */
.no-padding {
    padding: 0;
}

.slideIn {
    animation: fadeIn 0.8s ease-in-out;
    visibility: visible !important;
}