/* Authentication UI Styles for MECE Agent */

/* =====================================================
   Modal Overlay
   ===================================================== */

.auth-modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(46, 52, 64, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.auth-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}


/* =====================================================
   Modal Content
   ===================================================== */

.auth-modal {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
    position: relative;
}

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

.auth-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 5px 10px;
    line-height: 1;
    transition: color 0.2s;
}

.auth-modal-close:hover {
    color: #333;
}


/* =====================================================
   Modal Header
   ===================================================== */

.auth-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-modal-header h2 {
    font-size: 28px;
    color: #2E3440;
    margin-bottom: 10px;
}

.auth-modal-header p {
    font-size: 14px;
    color: #666;
}

.auth-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.5;
}


/* =====================================================
   Tab Switcher
   ===================================================== */

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.auth-tab {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab:hover {
    color: #666;
}

.auth-tab.active {
    color: #A3BE8C;
    border-bottom-color: #A3BE8C;
}


/* =====================================================
   Form Containers
   ===================================================== */

.auth-form-container {
    display: none;
}

.auth-form-container.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Tab content visibility */
.auth-tab-content {
    display: none;
}

.auth-tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}


/* =====================================================
   Form Elements
   ===================================================== */

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

.auth-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.auth-form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.auth-form-group input:focus {
    outline: none;
    border-color: #A3BE8C;
    box-shadow: 0 0 0 3px rgba(163, 190, 140, 0.1);
}

.auth-form-group input.error {
    border-color: #BF616A;
}


/* =====================================================
   Error Messages
   ===================================================== */

.auth-error {
    display: none;
    background: #BF616A;
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    animation: shake 0.3s ease;
}

.auth-error.active {
    display: block;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.auth-field-error {
    display: none;
    color: #BF616A;
    font-size: 13px;
    margin-top: 5px;
}

.auth-field-error.active {
    display: block;
}


/* =====================================================
   Buttons
   ===================================================== */

.auth-submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #A3BE8C 0%, #EBCB8B 100%);
    color: #2E3440;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 15px;
}

.auth-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(163, 190, 140, 0.4);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-submit-btn.loading {
    position: relative;
    color: transparent;
}

.auth-submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid #2E3440;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* =====================================================
   OAuth Divider
   ===================================================== */

.auth-divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
    color: #999;
    font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.auth-divider span {
    padding: 0 15px;
}


/* =====================================================
   OAuth Buttons
   ===================================================== */

.auth-oauth-btn {
    width: 100%;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-oauth-btn:hover {
    border-color: #A3BE8C;
    background: #f9f9f9;
}

.auth-oauth-btn img {
    width: 20px;
    height: 20px;
}


/* =====================================================
   Remember Me Checkbox
   ===================================================== */

.auth-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.auth-checkbox-group input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.auth-checkbox-group label {
    margin: 0;
    font-weight: normal;
    font-size: 14px;
    color: #666;
    cursor: pointer;
}


/* =====================================================
   Footer Links
   ===================================================== */

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.auth-footer p {
    font-size: 14px;
    color: #666;
}

.auth-footer a {
    color: #A3BE8C;
    text-decoration: none;
    font-weight: 600;
}

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


/* =====================================================
   Success Message
   ===================================================== */

.auth-success {
    display: none;
    background: #A3BE8C;
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

.auth-success.active {
    display: block;
    animation: fadeIn 0.3s ease;
}


/* =====================================================
   Mobile Responsive
   ===================================================== */

@media (max-width: 768px) {
    .auth-modal {
        padding: 30px 20px;
        width: 95%;
    }

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

    .auth-tab {
        font-size: 14px;
        padding: 10px 15px;
    }

    .auth-form-group input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}


/* =====================================================
   Loading State for Page
   ===================================================== */

.auth-page-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 10000;
}

.auth-page-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #A3BE8C;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}


/* =====================================================
   Password Reset Links
   ===================================================== */

.forgot-password-link {
    text-align: right;
    margin-bottom: 15px;
    margin-top: -10px;
}

.forgot-password-link a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-password-link a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.auth-back-to-login {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.auth-back-to-login a {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-back-to-login a:hover {
    color: #764ba2;
    text-decoration: underline;
}
