@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    padding: 20px;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ========== CONTAINER ========== */
.container {
    position: relative;
    width: 100%;
    height: 38rem;
    max-width: 720px;
    min-height: auto;
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
}

.forms-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

/* ========== FORM CONTAINERS ========== */
.form-container {
    position: absolute;
    top: 0;
    height: 100%;
    transition: all 0.6s ease-in-out;
}

.signin-container,
.signup-container {
    width: 50%;
    left: 0;
    z-index: 2;
}

.signup-container {
    opacity: 0;
    z-index: 1;
}

.container.right-panel-active .signin-container {
    transform: translateX(100%);
    opacity: 0;
}

.container.right-panel-active .signup-container {
    transform: translateX(100%);
    opacity: 1;
    z-index: 5;
}

/* ========== FORM STYLING ========== */
form {
    background: #fff;
    display: flex;
    flex-direction: column;
    padding: 0 clamp(20px, 5vw, 50px);
    height: 100%;
    justify-content: center;
    align-items: center;
    text-align: center;
}

h1 {
    font-weight: bold;
    margin: 0 0 10px;
    color: #333;
    font-size: clamp(20px, 4vw, 28px);
}

span {
    font-size: clamp(11px, 2vw, 12px);
    color: #666;
    margin: 10px 0 15px;
}

/* ========== INPUT FIELDS ========== */
.input-field {
    position: relative;
    width: 100%;
    max-width: 380px;
    margin: 5px 0;
}

input {
    background: #f6f6f6;
    width: 100%;
    padding: 12px 40px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: clamp(13px, 2vw, 14px);
    transition: all 0.3s ease;
}

input:focus {
    border-color: #4ECDC4;
    box-shadow: 0 0 5px rgba(78,205,196,0.5);
}

.input-field i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    transition: all 0.3s ease;
    font-size: clamp(14px, 2vw, 16px);
}

.input-field .toggle-password {
    right: 15px;
    left: auto;
    cursor: pointer;
    background: #f6f6f6;
    padding: 2px;
    border-radius: 50%;
    z-index: 10;
}

.input-field .toggle-password:hover {
    color: #4ECDC4;
}

.input-field input:focus + i {
    color: #4ECDC4;
}

/* ========== BUTTONS ========== */
.btn {
    background: #4ECDC4;
    color: #fff;
    border: none;
    padding: 12px 45px;
    border-radius: 25px;
    font-size: clamp(12px, 2vw, 14px);
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.3s ease;
    margin: 10px 0;
}

.btn:hover {
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.98);
}

.btn.ghost {
    background: transparent;
    border: 2px solid #fff;
}

/* ========== FORM FOOTER ========== */
.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 380px;
    margin: 10px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 6px;
}

.remember-me input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
}

.remember-me label {
    color: #666;
    cursor: pointer;
    font-size: clamp(12px, 2vw, 14px);
    margin: 0;
}

.forgot-password,
.back-to-login {
    color: #666;
    font-size: clamp(12px, 2vw, 14px);
    text-decoration: none;
    transition: color 0.3s ease;
}

.forgot-password:hover,
.back-to-login:hover {
    color: #4ECDC4;
    text-decoration: underline;
}

/* ========== MOBILE FORM TOGGLE ========== */
.mobile-form-toggle {
    display: none; /* Hidden on desktop */
}

/* ========== OVERLAY ========== */
.overlay-container {
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    overflow: hidden;
    transition: transform 0.6s ease-in-out;
    z-index: 100;
}

.container.right-panel-active .overlay-container {
    transform: translateX(-100%);
}

.overlay {
    position: relative;
    color: #fff;
    background: linear-gradient(45deg, #4ECDC4, #556270);
    left: -100%;
    height: 100%;
    width: 200%;
    transform: translateX(0);
    transition: transform 0.6s ease-in-out;
}

.container.right-panel-active .overlay {
    transform: translateX(50%);
}

.overlay-panel {
    position: absolute;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 clamp(20px, 4vw, 40px);
    height: 100%;
    width: 50%;
    text-align: center;
    transition: transform 0.6s ease-in-out;
}

.overlay-panel h1 {
    color: #fff;
    font-size: clamp(20px, 4vw, 28px);
}

.overlay-panel p {
    font-size: clamp(12px, 2vw, 14px);
    line-height: 1.6;
    margin: 15px 0;
}

.overlay-right {
    right: 0;
    transform: translateX(0);
}

.overlay-left {
    transform: translateX(-20%);
}

.container.right-panel-active .overlay-left {
    transform: translateX(0);
}

.container.right-panel-active .overlay-right {
    transform: translateX(20%);
}

/* ========== OTP VERIFICATION ========== */
.otp-verification {
    text-align: center;
    width: 100%;
    padding: 20px;
}

.otp-message {
    color: #666;
    margin: 20px 0;
    font-size: clamp(12px, 2vw, 14px);
}

.otp-inputs {
    margin: 20px auto;
    max-width: 380px;
}

.otp-input {
    text-align: center !important;
    letter-spacing: 5px !important;
    font-size: clamp(16px, 3vw, 20px) !important;
}

.resend-otp {
    font-size: clamp(12px, 2vw, 13px);
    color: #666;
    margin: 15px 0;
}

.resend-otp a {
    color: #4ECDC4;
    text-decoration: none;
}

.resend-otp a:hover {
    text-decoration: underline;
}

/* ========== ADMIN 2FA VERIFICATION ========== */
.admin-2fa-verification {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid #ff6b35;
    box-shadow: 0 15px 35px rgba(255, 107, 53, 0.2);
    display: none;
    width: 100%;
    padding: 20px;
}

.admin-2fa-verification h1 {
    color: #ff6b35;
    font-size: clamp(20px, 4vw, 28px);
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.admin-2fa-icon {
    color: #ff6b35 !important;
    margin-right: 10px !important;
}

.admin-2fa-message {
    color: #fff;
    font-size: clamp(12px, 2vw, 14px);
    text-align: center;
    margin-bottom: 25px;
    padding: 0 20px;
    line-height: 1.5;
    opacity: 0.9;
}

.admin-2fa-inputs {
    margin-bottom: 25px;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

.admin-2fa-field {
    position: relative;
    margin-bottom: 20px;
}

.admin-2fa-field i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff6b35 !important;
    font-size: clamp(16px, 3vw, 18px);
    z-index: 2;
}

.admin-2fa-input {
    width: 100%;
    padding: 15px 15px 15px 50px;
    border: 2px solid #ff6b35;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.95);
    font-size: clamp(16px, 3vw, 18px) !important;
    font-weight: bold !important;
    text-align: center !important;
    letter-spacing: 3px !important;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.2);
}

.admin-2fa-input:focus {
    outline: none;
    border-color: #ff4500;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
    transform: translateY(-2px);
}

.admin-2fa-btn {
    background: linear-gradient(45deg, #ff6b35, #ff4500);
    border: none;
    color: white;
    padding: 12px 40px;
    border-radius: 25px;
    font-size: clamp(13px, 2vw, 16px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.3);
    margin-bottom: 20px;
}

.admin-2fa-btn:hover {
    background: linear-gradient(45deg, #ff4500, #dc3500);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
}

.resend-admin-2fa {
    text-align: center;
    margin: 15px 0;
    color: blue;
    font-size: clamp(12px, 2vw, 14px);
}

.resend-admin-2fa .resend-link {
    color: #ff6b35 !important;
    text-decoration: underline !important;
    font-weight: 500 !important;
    transition: all 0.3s ease;
}

.resend-admin-2fa .resend-link:hover {
    color: #fff !important;
    text-shadow: 0 0 10px rgba(255, 107, 53, 0.8);
}

.admin-back-link {
    display: inline-block;
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none;
    font-size: clamp(12px, 2vw, 14px);
    margin-top: 15px;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.admin-back-link:hover {
    color: #fff !important;
    border-bottom-color: #fff;
}

/* ========== FORGOT & RESET PASSWORD ========== */
.forgot-password-container,
.reset-password-container {
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;
    transition: all 0.6s ease-in-out;
    z-index: 2;
    padding: 20px;
}

.forgot-password-container form,
.reset-password-container form {
    max-width: 450px;
    margin: 0 auto;
}

.forgot-password-container p,
.reset-password-container p {
    font-size: clamp(12px, 2vw, 14px);
    font-weight: 300;
    line-height: 1.6;
    letter-spacing: 0.5px;
    margin: 15px 0;
    color: #666;
}

/* ========== MESSAGES ========== */
.error-message,
.info-message,
.admin-error,
.admin-info {
    position: relative;
    width: 100%;
    max-width: 380px;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: clamp(12px, 2vw, 14px);
    margin: 15px auto;
    text-align: center;
    transition: all 0.3s ease;
    opacity: 0;
}

.error-message.show,
.info-message.show {
    opacity: 1;
}

.error-message {
    background-color: #fff2f0;
    color: #dc3545;
    border: 1px solid #ffa4a4;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.1);
}

.info-message {
    background-color: #e8f4ff;
    color: #0066cc;
    border: 1px solid #99ccff;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.1);
}

.admin-error {
    background: rgba(244, 67, 54, 0.9);
    color: #fff;
    border: 1px solid #ff6b35;
}

.admin-info {
    background: rgba(76, 175, 80, 0.9);
    color: #fff;
    border: 1px solid #4caf50;
}

/* ========== TABLET STYLES (768px - 1024px) ========== */
@media screen and (max-width: 1024px) {
    .container {
        max-width: 650px;
        min-height: 580px;
        max-height: 95vh; /* NEW: Limits height on tablets */
    }
    
    .signin-container,
    .signup-container {
        width: 50%;
    }
    
    form {
        padding: 0 30px;
    }
}

/* NEW: Add specific media query for small laptop/desktop screens */
@media screen and (max-height: 700px) {
    body {
        padding: 10px;
        align-items: flex-start; /* Align to top instead of center */
    }
    
    .container {
        min-height: auto;
        max-height: 98vh;
        margin: 10px 0;
    }
    
    form {
        padding: 20px clamp(20px, 4vw, 40px);
        justify-content: flex-start;
        overflow-y: auto; /* Allow scrolling within form if needed */
        max-height: 98vh;
    }
    
    h1 {
        margin: 10px 0 8px;
        font-size: clamp(18px, 3.5vw, 24px);
    }
    
    span {
        margin: 8px 0 12px;
    }
    
    .input-field {
        margin: 6px 0;
    }
    
    input {
        margin: 5px 0;
        padding: 10px 40px;
    }
    
    .btn {
        margin: 8px 0;
        padding: 10px 40px;
    }
    
    .form-footer {
        margin: 8px 0;
    }
    
    .overlay-panel {
        padding: 20px clamp(15px, 3vw, 30px);
    }
    
    .overlay-panel h1 {
        font-size: clamp(18px, 3.5vw, 24px);
        margin-bottom: 8px;
    }
    
    .overlay-panel p {
        font-size: clamp(11px, 2vw, 13px);
        margin: 10px 0;
    }
}

/* NEW: Even smaller height screens */
@media screen and (max-height: 600px) {
    .container {
        min-height: auto;
        max-height: 100vh;
    }
    
    form {
        padding: 15px 25px;
        max-height: 100vh;
    }
    
    h1 {
        font-size: 20px;
        margin: 8px 0 5px;
    }
    
    span {
        font-size: 11px;
        margin: 5px 0 8px;
    }
    
    .input-field {
        margin: 4px 0;
    }
    
    input {
        margin: 4px 0;
        padding: 9px 35px;
    }
    
    .btn {
        margin: 6px 0;
        padding: 9px 35px;
    }
}

/* ========== MOBILE STYLES (max-width: 768px) ========== */

@media screen and (max-width: 768px) {
    body {
        padding: 0;
        align-items: stretch;
        min-height: 100vh;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        flex-direction: column;
        display: flex;
        border-radius: 0;
        margin: 0;
    }
    
    .forms-container {
        position: relative;
        width: 100%;
        height: auto;
        min-height: fit-content;
        order: 1;
    }
    
    .form-container,
    .signin-container,
    .signup-container {
        position: relative;
        width: 100% !important;
        height: auto;
        min-height: fit-content;
        padding: 30px 20px;
        transform: none !important;
        opacity: 1 !important;
    }
    
    /* Hide the non-active form on mobile */
    .container:not(.right-panel-active) .signup-container {
        display: none;
    }
    
    .container.right-panel-active .signin-container {
        display: none;
    }
    
    form {
        padding: 20px;
        min-height: fit-content;
        height: auto;
    }
    
    .input-field {
        margin: 8px 0;
    }
    
    input {
        padding: 14px 40px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* COMPLETELY HIDE the fancy overlay on mobile */
    .overlay-container {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Show simple mobile toggle instead */
    .mobile-form-toggle {
        display: block !important;
        text-align: center;
        padding: 20px;
        background: #fff;
        border-top: 1px solid #eee;
        order: 2;
        border-radius: 0 0 15px 15px;
    }
    
    .mobile-form-toggle p {
        color: #666;
        font-size: 14px;
        margin: 0;
        line-height: 1.5;
    }
    
    .mobile-form-toggle a {
        color: #4ECDC4;
        text-decoration: none;
        font-weight: 600;
    }
    
    .mobile-form-toggle a:hover,
    .mobile-form-toggle a:active {
        color: #3db8ac;
        text-decoration: underline;
    }
    
    .form-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .forgot-password-container,
    .reset-password-container {
        padding: 15px;
    }
    
    .otp-verification,
    .admin-2fa-verification {
        padding: 15px;
    }
}

/* ========== SMALL MOBILE (max-width: 480px) ========== */
@media screen and (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .container {
        border-radius: 10px;
        min-height: auto;
    }
    
    form {
        padding: 15px;
    }
    
    h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    span {
        font-size: 11px;
        margin: 8px 0 12px;
    }
    
    .input-field {
        max-width: 100%;
    }
    
    input {
        padding: 12px 35px;
        margin: 6px 0;
    }
    
    .btn {
        padding: 11px 35px;
        font-size: 12px;
    }
    
    .overlay-panel {
        padding: 25px 15px;
    }
    
    .overlay-panel h1 {
        font-size: 20px;
    }
    
    .overlay-panel p {
        font-size: 12px;
        margin: 10px 0;
    }
    
    .form-footer {
        font-size: 12px;
    }
    
    .admin-2fa-input,
    .otp-input {
        padding: 12px 12px 12px 45px;
        font-size: 16px !important;
    }
}

/* ========== LANDSCAPE MODE ========== */
@media screen and (max-height: 600px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding: 10px;
    }
    
    .container {
        min-height: auto;
        margin: 10px 0;
    }
    
    form {
        padding: 15px 30px;
        justify-content: flex-start;
        padding-top: 20px;
        padding-bottom: 20px;
    }
    
    h1 {
        margin: 10px 0;
    }
    
    .input-field {
        margin: 4px 0;
    }
    
    input {
        margin: 4px 0;
        padding: 10px 35px;
    }
    
    .btn {
        margin: 8px 0;
        padding: 10px 35px;
    }
    
    .overlay-panel {
        padding: 20px;
    }
}

/* ========== EXTRA SMALL DEVICES (max-width: 360px) ========== */
@media screen and (max-width: 360px) {
    .container {
        border-radius: 8px;
    }
    
    form {
        padding: 12px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    input {
        padding: 10px 30px;
        font-size: 14px;
    }
    
    .input-field i {
        left: 12px;
        font-size: 14px;
    }
    
    .input-field .toggle-password {
        right: 12px;
    }
    
    .btn {
        padding: 10px 30px;
        font-size: 11px;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    body {
        background: white;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .overlay-container {
        display: none;
    }
}
