/**
 * MindForge Modal Components
 * Extracted from front-page.php inline styles
 * Provides consistent modal styling across the application
 */

/* Modal Base */
.signin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.signin-modal[style*="display: none"] {
    opacity: 0;
    pointer-events: none;
}

/* Modal Backdrop */
.signin-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

/* Modal Container */
.signin-modal__container {
    position: relative;
    background: #1f2937;
    border-radius: 1rem;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 28rem;
    width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    z-index: 10000;
    animation: modal-enter 0.3s ease-out;
}

@keyframes modal-enter {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Modal Content */
.signin-modal__content {
    position: relative;
    padding: 0;
}

/* Modal Header */
.signin-modal__header {
    padding: 2rem 2rem 1rem;
    text-align: center;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.signin-modal__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e5e7eb;
    margin: 0 0 0.5rem;
}

.signin-modal__subtitle {
    font-size: 0.9rem;
    color: #9ca3af;
    margin: 0;
}

.signin-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1.5rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.signin-modal__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    transform: scale(1.1);
}

.signin-modal__close:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Modal Body */
.signin-modal__body {
    padding: 2rem;
}

/* Auth Form Styles */
.auth-form {
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #e5e7eb;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    
    /* Dipped neumorphic effect */
    box-shadow: 
        inset 4px 4px 8px rgba(0, 0, 0, 0.3),
        inset -4px -4px 8px rgba(255, 255, 255, 0.08);
}

.form-group input:focus {
    outline: none;
    /* Maintain dipped effect but add subtle orange border */
    box-shadow: 
        inset 4px 4px 8px rgba(0, 0, 0, 0.3),
        inset -4px -4px 8px rgba(255, 255, 255, 0.08),
        0 0 0 2px rgba(251, 146, 60, 0.3);
    background: var(--color-bg-primary);
}

.form-group input::placeholder {
    color: #9ca3af;
}

.form-group small {
    display: block;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Form Messages */
.form-messages {
    min-height: 1.5rem;
    margin-top: 1rem;
}

.form-messages .error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.form-messages .success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.form-messages .info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Auth Views */
#login-view, 
#register-view {
    transition: opacity 0.3s ease;
}

#login-view[style*="display: none"],
#register-view[style*="display: none"] {
    opacity: 0;
    pointer-events: none;
}

/* Auth Actions - Register and Forgot Password buttons */
.auth-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-actions .btn {
    flex: 1;
    max-width: 150px;
}

@media (max-width: 480px) {
    .auth-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .auth-actions .btn {
        max-width: none;
    }
}

/* Auth Button Row - For main action buttons */
.auth-button-row {
    margin: 1rem 0;
}

.auth-button-row.single-centered {
    display: flex;
    justify-content: center;
}

.auth-button-row .btn {
    min-width: 120px;
}

/* Social Login Section */
.social-login {
    margin: 1.5rem 0;
}

/* Signin Divider */
.signin-divider {
    position: relative;
    margin: 1.5rem 0;
    text-align: center;
}

.signin-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.signin-divider__text {
    background: #1f2937;
    color: #9ca3af;
    font-size: 0.875rem;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

/* Modal Footer */
.signin-modal__footer {
    padding: 1rem 2rem 2rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.signin-footer__text {
    font-size: 0.75rem;
    color: #9ca3af;
    line-height: 1.5;
}

.signin-footer__link {
    color: #60a5fa;
    text-decoration: none;
}

.signin-footer__link:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* Modal Body Scroll */
.signin-modal__body {
    max-height: 60vh;
    overflow-y: auto;
}

.signin-modal__body::-webkit-scrollbar {
    width: 6px;
}

.signin-modal__body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.signin-modal__body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.signin-modal__body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Responsive Modal */
@media (max-width: 640px) {
    .signin-modal__container {
        width: 95vw;
        margin: 1rem;
    }
    
    .signin-modal__header,
    .signin-modal__body,
    .signin-modal__footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .signin-modal__header {
        padding-top: 1.5rem;
    }
    
    .signin-modal__body {
        max-height: 50vh;
    }
    
    .signin-modal__title {
        font-size: 1.25rem;
    }
}

/* Modal Open Body Class */
body.modal-open {
    overflow: hidden;
}

/* Error Toast for Modals */
.error-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ef4444;
    color: white;
    padding: 12px 20px;
    border-radius: 5px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 300px;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

.error-toast.show {
    opacity: 1;
    transform: translateX(0);
}