/* Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

/* Login Container */
/* Container & Form Wrapper */
.container {
    width: 100%;
    max-width: 420px;
    perspective: 1000px;
}

.forms-wrapper {
    background: rgba(255, 255, 255, 0.95);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
    position: relative;
    transition: height 0.3s ease;
}

/* Common Form Styles */
.form-box {
    width: 100%;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.form-box.hidden {
    display: none;
    /* fallback */
    opacity: 0;
    pointer-events: none;
    position: absolute;
    /* Take out of flow when hiding loop */
}

/* Header */
.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.5rem;
}

.form-header p {
    color: #718096;
    font-size: 0.95rem;
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    position: relative;
    /* For absolute positioning of toggle button */
}

/* Toggle Password Button */
.toggle-password {
    position: absolute;
    right: 12px;
    top: 38px;
    /* Adjust based on label height + padding */
    background: none;
    border: none;
    cursor: pointer;
    color: #a0aec0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: #667eea;
}


.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
}

.form-group input {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #a0aec0;
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: #fc8181;
    box-shadow: 0 0 0 3px rgba(252, 129, 129, 0.1);
}

.error-text {
    font-size: 0.8rem;
    color: #e53e3e;
    margin-top: 0.25rem;
    min-height: 1.2em;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.error-text.visible {
    opacity: 1;
}

/* Button Styles */
.btn-submit {
    width: 100%;
    background: linear-gradient(to right, #667eea, #764ba2);
    color: white;
    padding: 0.875rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    margin-top: 0.5rem;
}

.btn-submit:hover {
    opacity: 0.9;
}

.btn-submit:active {
    transform: scale(0.98);
}

/* Toggle Text */
.toggle-text {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #718096;
}

.toggle-text a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.toggle-text a:hover {
    text-decoration: underline;
}

/* Responsiveness */
@media (max-width: 480px) {
    .login-container {
        padding: 2rem 1.5rem;
        width: 100%;
    }

    .login-header h1 {
        font-size: 1.5rem;
    }
}

/* Modal/Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.popup-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.popup-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-overlay.hidden .popup-content {
    transform: scale(0.9);
}

.popup-icon-container {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.popup-icon-container svg {
    width: 48px;
    height: 48px;
}

.popup-success svg {
    color: #48bb78;
}

.popup-error svg {
    color: #f56565;
}

#popup-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.5rem;
}

#popup-message {
    color: #4a5568;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

#popup-close-btn {
    background: linear-gradient(to right, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    outline: none;
}

#popup-close-btn:hover {
    opacity: 0.9;
}