.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(7px);
    opacity: 0;
    visibility: hidden;
    transition: .4s ease;
    z-index: 9999;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-overlay .modal {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 900px;
    max-width: 95vw;
    max-height: 85vh;
    background: white;
    border-radius: 25px;
    overflow: hidden;
    display: flex;
    transform: translate(-50%, -50%) scale(.85);
    opacity: 0;
    transition: .5s cubic-bezier(.68,-0.55,.27,1.55);
    box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.modal-overlay.active .modal { transform: translate(-50%, -50%) scale(1); opacity: 1; }

.welcome-panel {
    width: 45%;
    background: linear-gradient(135deg, #e02454, #063b6f);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 45px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.welcome-panel::before, .welcome-panel::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    animation: modalFloating 6s infinite ease-in-out;
}
.welcome-panel::before { width: 250px; height: 250px; top: -100px; left: -100px; }
.welcome-panel::after  { width: 180px; height: 180px; bottom: -70px; right: -70px; }

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

.welcome-panel h2 {
    font-size: 36px;
    margin-bottom: 15px;
    z-index: 2;
    color: wheat
}
.welcome-panel p  { line-height: 1.6; opacity: .9; z-index: 2; }

.form-panel {
    width: 55%;
    padding: 35px 45px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    font-family: Arial, Helvetica, sans-serif;
    overflow-y: auto;
    scrollbar-width: none;
}
.form-panel::-webkit-scrollbar { display: none; }

.close-btn {
    position: absolute;
    top: 18px;
    right: 22px;
    width: 35px;
    height: 35px;
    border: none;
    background: linear-gradient(135deg, #e02454, #063b6f);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: .3s;
}
.close-btn:hover { background: #667eea; color: white; transform: rotate(90deg); }

.modal-form { display: none; animation: modalFormIn .4s ease; }
.modal-form.active { display: block; }

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

.modal-form h2 { font-size: 30px; color: #222; margin-bottom: 8px; }
.modal-subtitle { color: #888; margin-bottom: 28px; font-size: 14px; }

.modal-input-group { position: relative; margin-bottom: 20px; }
.modal-input-group input {
    width: 100%;
    padding: 15px 45px 15px 18px;
    border: 1px solid #ddd;
    border-radius: 12px;
    outline: none;
    font-size: 15px;
    transition: .3s;
}
.modal-input-group input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102,126,234,.12);
}
.modal-input-group i { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: #999; font-style: normal; }

.modal-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; font-size: 13px; }
.modal-options label { color: #666; }
.modal-options a { color: #667eea; text-decoration: none; font-weight: 600; cursor: pointer; }

.modal-submit-btn {
    width: 100%;
    border: none;
    padding: 15px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e02454, #063b6f);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: .3s;
    box-shadow: 0 8px 20px rgba(102,126,234,.3);
}
    .modal-submit-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 25px rgba(102,126,234,.4);
        background: linear-gradient(135deg, #e02454, #063b6f);
    }

.modal-switch-text { text-align: center; margin-top: 25px; color: #777; font-size: 14px; }
.modal-switch-text button { border: none; background: none; color: #667eea; font-weight: 700; cursor: pointer; margin-left: 5px; }

.modal-divider { display: flex; align-items: center; gap: 10px; margin: 22px 0; color: #aaa; font-size: 12px; }
.modal-divider::before, .modal-divider::after { content: ""; height: 1px; flex: 1; background: #eee; }

.modal-social { display: none; gap: 10px; }
.modal-social button { flex: 1; padding: 11px; border: 1px solid #ddd; background: white; border-radius: 10px; cursor: pointer; transition: .3s; }
.modal-social button:hover { background: #f7f7f7; transform: translateY(-2px); }

.forgot-icon {
    width: 70px; height: 70px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg,#667eea,#764ba2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    color: white;
    box-shadow: 0 10px 25px rgba(102,126,234,.3);
}
.modal-forgot-form { text-align: center; }
.modal-forgot-form .modal-subtitle { line-height: 1.6; }

.modal-back-login { margin-top: 22px; border: none; background: none; color: #667eea; font-weight: 600; cursor: pointer; }

.modal-reset-message { display: none; margin-top: 18px; padding: 12px; border-radius: 10px; background: #e8f8ef; color: #23834b; font-size: 14px; }
.modal-reset-message.show { display: block; animation: modalFormIn .4s ease; }

@media(max-width:700px) {
    .modal-overlay .modal { width: 95%; min-height: auto; flex-direction: column; border-radius: 20px; max-height: 92vh; overflow-y: auto; }
    .welcome-panel { width: 100%; min-height: 180px; padding: 30px 20px; }
    .welcome-panel h2 { font-size: 28px; }
    .form-panel { width: 100%; padding: 40px 25px 30px; }
}
