/* -------------------------- *
 *    LOGIN CSS               *
 * -------------------------- */

.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    -webkit-transition: opacity 0.3s ease, visibility 0.3s ease;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.login-modal {
    background: -webkit-linear-gradient(145deg, var(--bg-secondary), var(--bg-card));
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-card));
    width: 100%;
    max-width: 450px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(var(--primary-rgb), 0.2);
    -webkit-transform: translateY(20px) scale(0.97);
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    -webkit-transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    position: relative;
    margin: auto;
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 36px);
    max-height: calc(100vh - 36px);
    overflow: hidden;
    box-sizing: border-box;
}

.login-modal-overlay.active .login-modal {
    -webkit-transform: translateY(0) scale(1);
    transform: translateY(0) scale(1);
    opacity: 1;
}

.login-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(var(--primary-rgb), 0.1), transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.login-header {
    padding: 24px 25px 20px;
    text-align: center;
    position: relative;
    z-index: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.login-logo {
    font-size: 30px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 6px;
    font-family: 'Montserrat', sans-serif;
    line-height: 1.2;
}

.login-title {
    font-size: 20px;
    color: var(--white);
    margin-bottom: 4px;
    line-height: 1.2;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.login-form {
    padding: 24px 25px;
    position: relative;
    z-index: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    box-sizing: border-box;
}

.login-form::-webkit-scrollbar {
    width: 6px;
}

.login-form::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.login-form::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.login-form::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.form-group {
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
}

.form-group label {
    display: block;
    color: var(--text-grey);
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
    -webkit-transition: color 0.3s;
    transition: color 0.3s;
}

.form-control {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.07);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 13px 18px;
    border-radius: 12px;
    color: var(--white);
    font-size: 15px;
    box-sizing: border-box;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.form-control:focus {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.15);
    outline: none;
}

.form-group.active label {
    color: var(--primary-color);
}

.form-group.has-error label {
    color: var(--color-e74c3c) !important;
}

.form-group.has-error .form-control {
    border-color: var(--color-e74c3c) !important;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.2) !important;
}

.forgot-password {
    text-align: right;
    margin-bottom: 20px;
}

.forgot-password a {
    color: var(--text-secondary);
    font-size: 14px;
    text-decoration: none;
    -webkit-transition: color 0.3s ease;
    transition: color 0.3s ease;
}

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

.login-btn-page {
    width: 100%;
    background-color: var(--primary-color);
    color: var(--black);
    border: none;
    padding: 15px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    -webkit-transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    margin-bottom: 18px;
    box-sizing: border-box;
}

.login-btn-page:hover {
    background-color: var(--color-1fdf64);
    -webkit-transform: translateY(-3px);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.login-btn-page::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: -webkit-linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0));
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0));
    -webkit-transform: rotate(30deg) translateY(100%);
    transform: rotate(30deg) translateY(100%);
    -webkit-transition: transform 0.7s ease;
    transition: transform 0.7s ease;
}

.login-btn-page:hover::after {
    -webkit-transform: rotate(30deg) translateY(-100%);
    transform: rotate(30deg) translateY(-100%);
}

.login-btn-page:active {
    -webkit-transform: translateY(-1px);
    transform: translateY(-1px);
}

.social-login {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.social-btn {
    background-color: rgba(255, 255, 255, 0.08);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.social-btn i {
    color: var(--white);
    font-size: 18px;
}

.social-btn:hover {
    -webkit-transform: translateY(-3px);
    transform: translateY(-3px);
    background-color: rgba(255, 255, 255, 0.15);
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: var(--color-666666);
    font-size: 14px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
}

.login-divider::before {
    margin-right: 15px;
}

.login-divider::after {
    margin-left: 15px;
}

.register-link {
    text-align: center;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.register-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.register-link a:hover {
    text-decoration: underline;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
    z-index: 10;
}

.close-modal i {
    color: var(--text-grey);
    font-size: 16px;
}

.close-modal:hover {
    background-color: rgba(255, 255, 255, 0.2);
    -webkit-transform: rotate(90deg);
    transform: rotate(90deg);
}

/* Loading State for Login Button */
.login-btn-page.loading {
    background-color: var(--bg-secondary);
    color: transparent;
    pointer-events: none;
}

.login-btn-page.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    -webkit-animation: spin 0.8s linear infinite;
    animation: spin 0.8s linear infinite;
}

@-webkit-keyframes spin {
    to { -webkit-transform: translate(-50%, -50%) rotate(360deg); transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes spin {
    to { -webkit-transform: translate(-50%, -50%) rotate(360deg); transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive Adjustments for Mobile */
@media (max-width: 576px) {
    .login-modal-overlay {
        padding: 12px 10px;
        align-items: center;
    }

    .login-modal {
        width: 100%;
        max-width: 390px;
        border-radius: 14px;
        max-height: calc(100dvh - 20px);
        max-height: calc(100vh - 20px);
    }

    .login-header {
        padding: 18px 16px 12px;
    }

    .login-logo {
        font-size: 24px;
        margin-bottom: 4px;
    }

    .login-title {
        font-size: 17px;
        margin-bottom: 3px;
    }

    .login-subtitle {
        font-size: 12.5px;
    }

    .login-form {
        padding: 16px 18px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 12.5px;
        margin-bottom: 5px;
    }

    .form-control {
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 10px;
    }

    .forgot-password {
        margin-bottom: 14px;
    }

    .forgot-password a {
        font-size: 12.5px;
    }

    .login-btn-page {
        padding: 12px;
        font-size: 15px;
        margin-bottom: 12px;
    }

    .login-divider {
        margin: 10px 0;
        font-size: 12.5px;
    }

    .social-login {
        gap: 12px;
        margin-bottom: 14px;
    }

    .social-btn {
        width: 38px;
        height: 38px;
    }

    .social-btn i {
        font-size: 15px;
    }

    .register-link {
        margin-top: 12px;
        font-size: 12.5px;
    }

    .close-modal {
        top: 12px;
        right: 12px;
        width: 28px;
        height: 28px;
    }

    .close-modal i {
        font-size: 14px;
    }
}

/* Landscape / Small-height Mobile View */
@media (max-height: 620px) {
    .login-modal-overlay {
        padding: 8px 10px;
        align-items: flex-start;
    }

    .login-modal {
        max-height: calc(100dvh - 16px);
        max-height: calc(100vh - 16px);
        margin: auto;
    }

    .login-header {
        padding: 12px 16px 8px;
    }

    .login-logo {
        font-size: 20px;
        margin-bottom: 2px;
    }

    .login-title {
        font-size: 15px;
        margin-bottom: 2px;
    }

    .login-subtitle {
        display: none;
    }

    .login-form {
        padding: 12px 16px;
    }

    .form-group {
        margin-bottom: 8px;
    }

    .forgot-password {
        margin-bottom: 10px;
    }

    .login-btn-page {
        padding: 10px;
        margin-bottom: 10px;
    }

    .social-login {
        margin-bottom: 10px;
    }
}