/* Optimized Auth Modal Styles */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background-color: var(--modal-backdrop);
    display: grid;
    place-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.auth-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 1000px;
    min-height: 600px;
    background-color: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.auth-modal.is-open .modal-container {
    transform: scale(1);
}

.modal-image-side {
    flex: 1 1 50%;
    background: linear-gradient(135deg, rgba(12, 192, 223, 0.9), rgba(255, 222, 89, 0.9)),
        url('data:image/svg+xml,%3Csvg width="400" height="600" xmlns="http://www.w3.org/2000/svg"%3E%3Cdefs%3E%3Cpattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"%3E%3Cpath d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/%3E%3C/pattern%3E%3C/defs%3E%3Crect width="100%25" height="100%25" fill="url(%23grid)"/%3E%3C/svg%3E');
    background-size: cover, 40px 40px;
    background-position: center, center;
    display: block;
}

/* When custom image is set via inline style, it will override the default background */
.modal-image-side[style*="background-image"] {
    background: none;
}

.modal-form-side {
    flex: 1 1 50%;
    padding: 50px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    border: none;
    background: transparent;
    padding: 10px;
    line-height: 0;
    border-radius: 99px;
    cursor: pointer;
    z-index: 10;
}

.modal-close-btn:hover {
    background-color: var(--surface);
}

.auth-form {
    width: 100%;
}

.auth-form h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--text-primary);
}

.auth-form p {
    margin: 0 0 28px;
    color: var(--text-muted);
    font-size: 16px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-control {
    width: 100%;
    height: 52px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 18px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: var(--ring);
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 0;
}

.password-toggle:hover {
    color: var(--text-primary);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

.password-validation-icon {
    position: absolute;
    top: 50%;
    right: 48px;
    transform: translateY(-50%);
    line-height: 0;
    z-index: 1;
}

.password-validation-icon svg {
    width: 20px;
    height: 20px;
}

.password-validation-icon .validation-check {
    display: none;
    color: #0cc0df;
}

.password-validation-icon .validation-cross {
    display: none;
    color: #ef4444;
}

.password-validation-icon.match .validation-check {
    display: block;
}

.password-validation-icon.mismatch .validation-cross {
    display: block;
}

/* Eye toggle visibility - with validation icon */
.form-group .form-control[type="password"]~.password-toggle .eye-open {
    display: block;
}

.form-group .form-control[type="password"]~.password-toggle .eye-closed {
    display: none;
}

.form-group .form-control[type="text"]~.password-toggle .eye-open {
    display: none;
}

.form-group .form-control[type="text"]~.password-toggle .eye-closed {
    display: block;
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 52px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-primary {
    background: var(--brand-gradient);
    color: var(--text-inverse);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--brand-rgb), 0.3);
}

.btn-google {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
    gap: 12px;
}

.btn-google:hover {
    background-color: var(--surface-hover);
}

.separator {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    margin: 20px 0;
    font-size: 13px;
    font-weight: 500;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.separator:not(:empty)::before {
    margin-right: .5em;
}

.separator:not(:empty)::after {
    margin-left: .5em;
}

.form-footer-link {
    text-align: center;
    margin-top: 16px;
    font-size: 15px;
    color: var(--text-muted);
}

.form-footer-link a {
    color: var(--brand);
    font-weight: 600;
    cursor: pointer;
}

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

.forgot-password-link {
    display: block;
    text-align: right;
    font-size: 14px;
    color: var(--brand);
    font-weight: 500;
    margin: -8px 0 16px;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .modal-image-side {
        display: none;
    }

    .modal-container {
        max-width: 480px;
        width: 92%;
        min-height: auto;
    }

    .modal-form-side {
        padding: 40px 32px;
    }

    .auth-form h2 {
        font-size: 24px;
    }

    .auth-form p {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .modal-container {
        max-width: 95%;
        width: 95%;
    }

    .modal-form-side {
        padding: 32px 24px;
    }
}