/* auth-styles.css - CSS chung cho trang Login và Register */

:root {
    --primary-purple: #8B5CF6;
    --secondary-purple: #A855F7;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-light: #ffffff;
    --text-secondary-light: rgba(255, 255, 255, 0.9);
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 20px 60px rgba(0, 0, 0, 0.15);
    --border-radius: 20px;
    --transition: all 0.3s ease-in-out;
    --button-gradient: linear-gradient(135deg, #ff6b9d 0%, #c44569 100%);
}

/* Body với background gradient */
body {
    background: var(--background-gradient);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Main content */
main {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    position: relative;
    overflow: hidden;
}

/* Animated Background Overlay */
main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    backdrop-filter: blur(10px);
    animation: backgroundMove 20s ease-in-out infinite alternate;
    z-index: 1;
}

@keyframes backgroundMove {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.05) rotate(1deg); opacity: 0.9; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Floating Particles */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 2;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    opacity: 0;
    animation: float 25s infinite linear;
    will-change: transform, opacity;
}

.particle:nth-child(1) { width: 20px; height: 20px; left: 10%; animation-delay: 0s; top: 10%; }
.particle:nth-child(2) { width: 15px; height: 15px; left: 20%; animation-delay: 4s; top: 70%; }
.particle:nth-child(3) { width: 25px; height: 25px; left: 35%; animation-delay: 8s; top: 30%; }
.particle:nth-child(4) { width: 18px; height: 18px; left: 50%; animation-delay: 12s; top: 80%; }
.particle:nth-child(5) { width: 22px; height: 22px; left: 65%; animation-delay: 16s; top: 20%; }
.particle:nth-child(6) { width: 12px; height: 12px; left: 75%; animation-delay: 20s; top: 60%; }
.particle:nth-child(7) { width: 16px; height: 16px; left: 5%; animation-delay: 24s; top: 45%; }
.particle:nth-child(8) { width: 20px; height: 20px; left: 85%; animation-delay: 28s; top: 15%; }

@keyframes float {
    0% { transform: translateY(100vh) translateX(0) rotate(0deg); opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { transform: translateY(-100px) translateX(30px) rotate(360deg); opacity: 0; }
}

/* Auth Container - class chung cho cả login và register */
.login-container, .auth-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card, .auth-card {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    padding: 45px 35px;
    animation: slideUp 0.8s ease-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.login-card::before, .auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
    opacity: 0.8;
}

.login-card:hover, .auth-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.2);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header - class chung */
.login-header, .auth-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-title, .auth-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 12px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.5px;
}

.login-subtitle, .auth-subtitle {
    color: var(--text-secondary-light);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.4;
}

/* Form Groups */
.form-group {
    margin-bottom: 25px;
}

.form-label {
    color: var(--text-secondary-light);
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 8px;
    display: block;
    transition: var(--transition);
}

.form-control {
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-light);
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

.form-control:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 16px;
    background: var(--button-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 25px rgba(255, 107, 157, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-submit::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 ease;
}

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

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(255, 107, 157, 0.4);
}

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

/* Social Login */
.social-login {
    margin-top: 30px;
}

.social-divider {
    text-align: center;
    position: relative;
    margin: 25px 0;
}

.social-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.social-divider span {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary-light);
    padding: 0 20px;
    font-size: 0.9rem;
    border-radius: 15px;
    position: relative;
    z-index: 1;
}

.social-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 20px;
}

.btn-social {
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-social:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--text-light);
}

.btn-social i {
    font-size: 18px;
    margin-right: 10px;
}

.btn-google {
    border-color: rgba(219, 68, 55, 0.4);
    background: rgba(219, 68, 55, 0.1);
}
.btn-google:hover {
    background: rgba(219, 68, 55, 0.2);
}

.btn-facebook {
    border-color: rgba(24, 119, 242, 0.4);
    background: rgba(24, 119, 242, 0.1);
}
.btn-facebook:hover {
    background: rgba(24, 119, 242, 0.2);
}

/* Footer Links */
.login-footer, .auth-footer {
    text-align: center;
    margin-top: 25px;
}

.login-footer p, .auth-footer p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary-light);
}

.footer-link {
    color: var(--text-secondary-light);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--text-light);
    text-decoration: none;
}

.register-link {
    color: #ffd700;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.register-link:hover {
    color: #ffed4e;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

/* Error Messages */
.alert {
    border-radius: 12px;
    font-weight: 500;
    text-align: left;
    margin-bottom: 20px;
    padding: 15px;
    border: none;
}

.alert-danger {
    background: rgba(255, 99, 71, 0.2);
    border: 1px solid rgba(255, 99, 71, 0.3);
    color: #ffeee6;
}

.alert-success {
    background: rgba(60, 179, 113, 0.2);
    border: 1px solid rgba(60, 179, 113, 0.3);
    color: #e6ffe6;
}

/* Responsive adjustments */
@media (min-width: 577px) {
    .social-buttons {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 576px) {
    .login-card {
        padding: 30px 25px;
        margin: 0 10px;
    }

    .login-title {
        font-size: 2rem;
    }

    main {
        padding: 30px 15px;
    }
}

/* Loading state for button */
.btn-submit.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* --- CSS để sửa avatar và mở rộng khung --- */

/* Điều chỉnh kích thước và hình dáng cho khung avatar */
.current-avatar {
    width: 120px; /* Tăng kích thước khung avatar */
    height: 120px; /* Giữ tỷ lệ để khung là hình tròn */
    border-radius: 50%; /* Đảm bảo khung là hình tròn */
    overflow: hidden; /* Cắt ảnh nếu tràn ra khỏi khung tròn */
    margin: 0 auto 15px auto; /* Căn giữa và thêm khoảng cách dưới */
    border: 3px solid rgba(255, 255, 255, 0.4); /* Border dày hơn, nổi bật hơn */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1); /* Thêm đổ bóng nhẹ */
    display: flex; /* Dùng flexbox để căn giữa ảnh bên trong */
    align-items: center;
    justify-content: center;
}

/* Đảm bảo ảnh avatar không bị méo và lấp đầy khung */
.current-avatar img {
    width: 100%; /* Chiều rộng ảnh bằng 100% của khung */
    height: 100%; /* Chiều cao ảnh bằng 100% của khung */
    object-fit: cover; /* Quan trọng: Đảm bảo ảnh lấp đầy khung mà không bị méo, cắt bớt nếu cần */
    border-radius: 50%; /* Đảm bảo ảnh bên trong cũng tròn */
}

/* Mở rộng chiều rộng tối đa của auth-card */
.auth-container {
    max-width: 500px; /* Tăng chiều rộng tối đa cho khung (card) */
    padding: 25px; /* Điều chỉnh padding nếu cần */
}

/* Điều chỉnh padding của auth-card để nó không bị bó hẹp khi rộng ra */
.auth-card {
    padding: 50px 40px; /* Tăng padding bên trong auth-card */
}

/* Responsive adjustments for smaller screens - đảm bảo vẫn đẹp trên mobile */
@media (max-width: 576px) {
    .auth-container {
        max-width: 95%; /* Cho phép chiếm gần hết chiều rộng màn hình trên mobile */
        padding: 15px;
    }

    .auth-card {
        padding: 35px 25px; /* Giảm padding trên mobile */
    }

    .current-avatar {
        width: 100px; /* Nhỏ lại một chút trên mobile */
        height: 100px;
    }
}