/**
 * CSS cho trang đăng nhập custom
 * Dành riêng cho role fong_giao_vien và fong_admin_b2b
 *
 * @module FongToanMiniClassroomLogin
 * @since 1.0.0
 *
 * @related_files
 * - /modules/toan_mini_classroom/src/autoload-login/fong-custom-login.php
 * - /modules/toan_mini_classroom/src/templates/login/login-template.php
 * - /modules/toan_mini_classroom/src/public/js/fong-toan-mini-classroom-login.js
 */

/* Container chính */
.fong-toan-mini-classroom-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    min-height: 100vh;
    position: relative;
    overflow-y: auto;
}

.fong-toan-mini-classroom-login-wrapper {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 1px 8px rgba(0, 0, 0, 0.07);
    max-width: 500px;
    width: 100%;
    overflow: hidden;
    padding: 40px;
    margin: 30px 20px;
    transform: translateY(0);
    transition: transform 0.3s, box-shadow 0.3s;
}

.fong-toan-mini-classroom-login-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12), 0 5px 15px rgba(0, 0, 0, 0.07);
}

/* Header */
.fong-toan-mini-classroom-login-header {
    text-align: center;
    margin-bottom: 35px;
}

/* Logo */
.login-logo {
    margin-bottom: 25px;
}

.login-logo-image {
    max-width: 150px;
    max-height: 80px;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

.login-logo-image:hover {
    transform: scale(1.05);
}

.fong-toan-mini-classroom-login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1d2327;
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.fong-toan-mini-classroom-login-header h1:after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #2271b1, #4f94d4);
    border-radius: 2px;
}

.login-description {
    color: #666;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Thông báo lỗi */
.fong-toan-mini-classroom-login-error {
    background-color: #fff3f3;
    border-left: 4px solid #f44336;
    color: #d32f2f;
    padding: 16px 18px;
    margin-bottom: 25px;
    border-radius: 6px;
    font-size: 14px;
    animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
    position: relative;
    box-shadow: 0 3px 10px rgba(220, 0, 0, 0.15);
    border: 1px solid #ffcdd2;
}

.fong-toan-mini-classroom-login-error p {
    margin: 0;
    line-height: 1.6;
}

.fong-toan-mini-classroom-login-error strong {
    display: block;
    width: calc(100% - 25px);
    font-size: 15px;
}

/* Animation for error message */
@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, 0, 0);
    }
    
    20%, 80% {
        transform: translate3d(2px, 0, 0);
    }
    
    30%, 50%, 70% {
        transform: translate3d(-4px, 0, 0);
    }
    
    40%, 60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Form */
.fong-toan-mini-classroom-login-form-container {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    transition: color 0.2s;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    background-color: #f9f9f9;
    height: 48px;
    box-sizing: border-box;
}

.form-group input[type="text"]:hover,
.form-group input[type="password"]:hover {
    border-color: #b4b9be;
    background-color: #fff;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1, 0 0 8px rgba(34, 113, 177, 0.15);
    outline: none;
    background-color: #fff;
}

/* Password input với toggle */
.password-input-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #777;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    z-index: 2;
}

.toggle-password:hover {
    color: #2271b1;
}

.toggle-password .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Field validation */
.field-validation {
    font-size: 12px;
    margin-top: 5px;
    min-height: 20px;
    transition: all 0.3s ease;
}

.valid-feedback {
    color: #4caf50;
}

.error-feedback {
    color: #f44336;
}

/* Validating message */
.validating-message {
    color: #ff9800;
    font-style: italic;
}

/* User validation info */
.user-validation-info {
    display: flex;
    align-items: center;
    margin-top: 5px;
}

.user-validation-info .user-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
}

.user-validation-info .user-info {
    display: flex;
    flex-direction: column;
}

.user-validation-info .user-name {
    font-weight: 500;
    color: #333;
}

.user-validation-info .user-role {
    font-size: 10px;
    color: #666;
}

/* Remember me */
.remember-me {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
}

.remember-me label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
    font-weight: normal;
    font-size: 14px;
    color: #444;
    transition: color 0.2s;
}

.remember-me label:hover {
    color: #2271b1;
}

.remember-me input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 3px;
    min-width: 16px;
    min-height: 16px;
}

/* Submit button */
.login-submit-button {
    width: 100%;
    background-color: #4a90e2;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.login-submit-button:hover {
    background-color: #357ae8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.login-submit-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-submit-button:disabled {
    background-color: #b0c4de;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Login actions */
.login-actions {
    display: flex;
    justify-content: center;
    margin-top: 25px;
    font-size: 14px;
}

.login-actions a {
    color: #2271b1;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}

.login-actions a:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #2271b1;
    transition: width 0.3s;
}

.login-actions a:hover {
    color: #135e96;
}

.login-actions a:hover:after {
    width: 100%;
}

.separator {
    margin: 0 12px;
    color: #ddd;
}

/* Footer */
.fong-toan-mini-classroom-login-footer {
    text-align: center;
    margin-top: 35px;
    color: #777;
    font-size: 13px;
}

.fong-toan-mini-classroom-login-footer p {
    margin: 0;
}

/* Loading state */
.login-loading {
    position: relative;
    pointer-events: none;
}

.login-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
    backdrop-filter: blur(2px);
    border-radius: 12px;
}

.login-loading .login-submit-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Animation for button */
.login-submit-button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.login-submit-button:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    20% {
        transform: scale(25, 25);
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* Responsive */
@media screen and (max-width: 600px) {
    .fong-toan-mini-classroom-login-container {
        padding: 0;
        align-items: flex-start;
    }
    
    .fong-toan-mini-classroom-login-wrapper {
        padding: 25px;
        margin: 15px;
        border-radius: 10px;
        max-width: 100%;
    }
    
    .login-logo-image {
        max-width: 120px;
        max-height: 60px;
    }
    
    .fong-toan-mini-classroom-login-header h1 {
        font-size: 22px;
    }
    
    .login-description {
        font-size: 14px;
    }
    
    .form-group input[type="text"], 
    .form-group input[type="password"],
    .login-submit-button {
        height: 45px;
    }
    
    .login-submit-button {
        padding: 10px;
        font-size: 15px;
    }
    
    .login-actions {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .separator {
        display: none;
    }
}

/* Thêm mới - CSS độc lập cho các thông báo lỗi field */
p.field-validation {
    font-size: 14px;
    min-height: 20px;
    display: block;
    margin-top: 5px;
    transition: all 0.3s ease;
}

p.field-validation.error-feedback {
    color: #dc3545;
    font-weight: 500;
    background-color: rgba(220, 53, 69, 0.05);
    padding: 5px 10px;
    border-radius: 4px;
    border-left: 3px solid #dc3545;
    animation: shake 0.5s ease-in-out;
}

p.field-validation.valid-feedback {
    color: #28a745;
    font-weight: 500;
    background-color: rgba(40, 167, 69, 0.05);
    padding: 5px 10px;
    border-radius: 4px;
    border-left: 3px solid #28a745;
}

/* Thêm hiệu ứng nhấp nháy cho thông báo lỗi mới */
@keyframes validationFlash {
    0% { background-color: rgba(220, 53, 69, 0.2); }
    50% { background-color: rgba(220, 53, 69, 0); }
    100% { background-color: rgba(220, 53, 69, 0.2); }
}

/* Áp dụng hiệu ứng nhấp nháy khi có lỗi */
.form-group.has-error input {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Style cho icons trong thông báo */
p.field-validation .error-message,
p.field-validation .valid-message {
    display: flex;
    align-items: center;
}

p.field-validation .error-message::before {
    content: "⚠️";
    margin-right: 5px;
}

p.field-validation .valid-message::before {
    content: "✅";
    margin-right: 5px;
}

/* Thêm style cho input khi có lỗi */
input.input-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    background-color: rgba(220, 53, 69, 0.05) !important;
}

/* Hiệu ứng shake cho input error khi trang load */
@keyframes inputErrorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

input.input-error {
    animation: inputErrorShake 0.5s ease-in-out;
}

.form-group.has-error input {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
} 