/**
 * Estilos para Sistema de Autenticação MineMind
 */

/* Modais de Autenticação */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
    padding: 20px;
    box-sizing: border-box;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 400px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
    margin: 0 auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Formulários */
.auth-form {
    padding: 0 24px 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input:invalid {
    border-color: #ef4444;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.form-actions {
    margin: 24px 0;
}

.btn-primary {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.form-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.form-footer p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.form-footer a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* Mensagens */
.error-message {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 24px;
    font-size: 14px;
    border-left: 4px solid #dc2626;
    display: none;
}

.error-message:not(:empty) {
    display: block;
}

.loading-message {
    background: #eff6ff;
    color: #2563eb;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 24px;
    font-size: 14px;
    border-left: 4px solid #2563eb;
    text-align: center;
}

.success-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    z-index: 1001;
    animation: slideInRight 0.3s ease-out;
}

/* Botões de Autenticação */
.auth-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.auth-button:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.auth-button.secondary {
    background: transparent;
    color: #3b82f6;
    border: 2px solid #3b82f6;
}

.auth-button.secondary:hover {
    background: #3b82f6;
    color: white;
}

/* Menu do Usuário */
.user-menu {
    position: relative;
    display: none;
}

/* Garantir que o nome do usuário seja visível no dropdown */
#userDisplayName {
    display: block !important;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu.active {
    display: block;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #f8fafc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-info:hover {
    background: #e2e8f0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
    margin: 0;
}

.user-email {
    color: #6b7280;
    font-size: 12px;
    margin: 0;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 100;
    display: none;
}

.user-dropdown.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: none;
    border: none;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.dropdown-item:hover {
    background: #f3f4f6;
}

.dropdown-item.danger {
    color: #dc2626;
}

.dropdown-item.danger:hover {
    background: #fef2f2;
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsividade */
@media (max-width: 768px) {
    .auth-modal {
        padding: 10px;
    }
    
    .modal-content {
        width: 100%;
        max-width: none;
        max-height: calc(100vh - 20px);
        margin: 0;
    }
    
    .modal-header {
        padding: 16px 20px 0;
    }
    
    .auth-form {
        padding: 0 20px 20px;
    }
    
    .form-group input {
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .success-notification {
        top: 10px;
        right: 10px;
        left: 10px;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 12px 16px 0;
    }
    
    .auth-form {
        padding: 0 16px 16px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
}

/* Estados de carregamento */
.loading {
    position: relative;
    pointer-events: none;
}

/* Ícones de feedback */
.success-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    animation: successPulse 0.6s ease-out;
}

.success-icon i {
    font-size: 48px;
    color: #10b981;
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.error-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    animation: errorShake 0.6s ease-out;
}

.error-icon i {
    font-size: 48px;
    color: #ef4444;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* Animações */
@keyframes successPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Tema escuro (opcional) */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .modal-header {
        border-bottom-color: #374151;
    }
    
    .modal-header h2 {
        color: #f9fafb;
    }
    
    .close-btn {
        color: #9ca3af;
    }
    
    .close-btn:hover {
        background: #374151;
        color: #d1d5db;
    }
    
    .form-group label {
        color: #d1d5db;
    }
    
    .form-group input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .form-group input:focus {
        border-color: #3b82f6;
        background: #374151;
    }
    
    .form-footer {
        border-top-color: #374151;
    }
    
    .form-footer p {
        color: #9ca3af;
    }
    
    .user-info {
        background: #374151;
    }
    
    .user-info:hover {
        background: #4b5563;
    }
    
    .user-dropdown {
        background: #1f2937;
        border-color: #374151;
    }
    
    .dropdown-item {
        color: #d1d5db;
    }
    
    .dropdown-item:hover {
        background: #374151;
    }
}
